windows_capture/
settings.rs1use windows::Graphics::Capture::GraphicsCaptureItem;
2
3#[derive(Eq, PartialEq, Clone, Copy, Debug)]
4pub enum ColorFormat {
5 Rgba16F = 10,
6 Rgba8 = 28,
7 Bgra8 = 87,
8}
9
10impl Default for ColorFormat {
11 #[must_use]
12 #[inline]
13 fn default() -> Self {
14 Self::Rgba8
15 }
16}
17
18#[derive(Eq, PartialEq, Clone, Copy, Debug)]
19pub enum CursorCaptureSettings {
20 Default,
21 WithCursor,
22 WithoutCursor,
23}
24
25#[derive(Eq, PartialEq, Clone, Copy, Debug)]
26pub enum DrawBorderSettings {
27 Default,
28 WithBorder,
29 WithoutBorder,
30}
31
32#[derive(Eq, PartialEq, Clone, Debug)]
33pub struct Settings<Flags, T: TryInto<GraphicsCaptureItem>> {
35 pub(crate) item: T,
37 pub(crate) cursor_capture: CursorCaptureSettings,
39 pub(crate) draw_border: DrawBorderSettings,
41 pub(crate) color_format: ColorFormat,
43 pub(crate) flags: Flags,
45}
46
47impl<Flags, T: TryInto<GraphicsCaptureItem>> Settings<Flags, T> {
48 #[must_use]
58 #[inline]
59 pub const fn new(
60 item: T,
61 cursor_capture: CursorCaptureSettings,
62 draw_border: DrawBorderSettings,
63 color_format: ColorFormat,
64 flags: Flags,
65 ) -> Self {
66 Self {
67 item,
68 cursor_capture,
69 draw_border,
70 color_format,
71 flags,
72 }
73 }
74
75 #[must_use]
81 #[inline]
82 pub const fn item(&self) -> &T {
83 &self.item
84 }
85
86 #[must_use]
92 #[inline]
93 pub const fn cursor_capture(&self) -> CursorCaptureSettings {
94 self.cursor_capture
95 }
96
97 #[must_use]
103 #[inline]
104 pub const fn draw_border(&self) -> DrawBorderSettings {
105 self.draw_border
106 }
107
108 #[must_use]
114 #[inline]
115 pub const fn color_format(&self) -> ColorFormat {
116 self.color_format
117 }
118
119 #[must_use]
125 #[inline]
126 pub const fn flags(&self) -> &Flags {
127 &self.flags
128 }
129}