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 #[inline]
12 fn default() -> Self {
13 Self::Rgba8
14 }
15}
16
17#[derive(Eq, PartialEq, Clone, Copy, Debug)]
18pub enum CursorCaptureSettings {
19 Default,
20 WithCursor,
21 WithoutCursor,
22}
23
24#[derive(Eq, PartialEq, Clone, Copy, Debug)]
25pub enum DrawBorderSettings {
26 Default,
27 WithBorder,
28 WithoutBorder,
29}
30
31#[derive(Eq, PartialEq, Clone, Debug)]
32pub struct Settings<Flags, T: TryInto<GraphicsCaptureItem>> {
34 pub(crate) item: T,
36 pub(crate) cursor_capture: CursorCaptureSettings,
38 pub(crate) draw_border: DrawBorderSettings,
40 pub(crate) color_format: ColorFormat,
42 pub(crate) flags: Flags,
44}
45
46impl<Flags, T: TryInto<GraphicsCaptureItem>> Settings<Flags, T> {
47 #[must_use]
57 #[inline]
58 pub const fn new(
59 item: T,
60 cursor_capture: CursorCaptureSettings,
61 draw_border: DrawBorderSettings,
62 color_format: ColorFormat,
63 flags: Flags,
64 ) -> Self {
65 Self {
66 item,
67 cursor_capture,
68 draw_border,
69 color_format,
70 flags,
71 }
72 }
73
74 #[must_use]
80 #[inline]
81 pub const fn item(&self) -> &T {
82 &self.item
83 }
84
85 #[must_use]
91 #[inline]
92 pub const fn cursor_capture(&self) -> CursorCaptureSettings {
93 self.cursor_capture
94 }
95
96 #[must_use]
102 #[inline]
103 pub const fn draw_border(&self) -> DrawBorderSettings {
104 self.draw_border
105 }
106
107 #[must_use]
113 #[inline]
114 pub const fn color_format(&self) -> ColorFormat {
115 self.color_format
116 }
117
118 #[must_use]
124 #[inline]
125 pub const fn flags(&self) -> &Flags {
126 &self.flags
127 }
128}