sdl3_ttf_sys/generated/
textengine.rs1use sdl3_sys::everything::*;
2
3use super::ttf::*;
4
5#[repr(transparent)]
17#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
18pub struct TTF_DrawCommand(pub ::core::ffi::c_int);
19
20impl ::core::cmp::PartialEq<::core::ffi::c_int> for TTF_DrawCommand {
21 #[inline(always)]
22 fn eq(&self, other: &::core::ffi::c_int) -> bool {
23 &self.0 == other
24 }
25}
26
27impl ::core::cmp::PartialEq<TTF_DrawCommand> for ::core::ffi::c_int {
28 #[inline(always)]
29 fn eq(&self, other: &TTF_DrawCommand) -> bool {
30 self == &other.0
31 }
32}
33
34impl From<TTF_DrawCommand> for ::core::ffi::c_int {
35 #[inline(always)]
36 fn from(value: TTF_DrawCommand) -> Self {
37 value.0
38 }
39}
40
41#[cfg(feature = "debug-impls")]
42impl ::core::fmt::Debug for TTF_DrawCommand {
43 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
44 #[allow(unreachable_patterns)]
45 f.write_str(match *self {
46 Self::NOOP => "TTF_DRAW_COMMAND_NOOP",
47 Self::FILL => "TTF_DRAW_COMMAND_FILL",
48 Self::COPY => "TTF_DRAW_COMMAND_COPY",
49
50 _ => return write!(f, "TTF_DrawCommand({})", self.0),
51 })
52 }
53}
54
55impl TTF_DrawCommand {
56 pub const NOOP: Self = Self((0 as ::core::ffi::c_int));
57 pub const FILL: Self = Self((1 as ::core::ffi::c_int));
58 pub const COPY: Self = Self((2 as ::core::ffi::c_int));
59}
60
61pub const TTF_DRAW_COMMAND_NOOP: TTF_DrawCommand = TTF_DrawCommand::NOOP;
62pub const TTF_DRAW_COMMAND_FILL: TTF_DrawCommand = TTF_DrawCommand::FILL;
63pub const TTF_DRAW_COMMAND_COPY: TTF_DrawCommand = TTF_DrawCommand::COPY;
64
65#[cfg(feature = "metadata")]
66impl sdl3_sys::metadata::GroupMetadata for TTF_DrawCommand {
67 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
68 &crate::metadata::textengine::METADATA_TTF_DrawCommand;
69}
70
71#[repr(C)]
79#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
80#[cfg_attr(feature = "debug-impls", derive(Debug))]
81pub struct TTF_FillOperation {
82 pub cmd: TTF_DrawCommand,
84 pub rect: SDL_Rect,
86}
87
88#[repr(C)]
96#[derive(Clone, Copy)]
97#[cfg_attr(feature = "debug-impls", derive(Debug))]
98pub struct TTF_CopyOperation {
99 pub cmd: TTF_DrawCommand,
101 pub text_offset: ::core::ffi::c_int,
108 pub glyph_font: *mut TTF_Font,
110 pub glyph_index: Uint32,
112 pub src: SDL_Rect,
114 pub dst: SDL_Rect,
116 pub reserved: *mut ::core::ffi::c_void,
117}
118
119impl ::core::default::Default for TTF_CopyOperation {
120 #[inline(always)]
122 fn default() -> Self {
123 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
124 }
125}
126
127#[repr(C)]
132#[derive(Clone, Copy)]
133pub union TTF_DrawOperation {
134 pub cmd: TTF_DrawCommand,
135 pub fill: TTF_FillOperation,
136 pub copy: TTF_CopyOperation,
137}
138
139impl ::core::default::Default for TTF_DrawOperation {
140 #[inline(always)]
142 fn default() -> Self {
143 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
144 }
145}
146
147#[repr(C)]
148#[cfg_attr(feature = "debug-impls", derive(Debug))]
149pub struct TTF_TextData {
150 pub font: *mut TTF_Font,
152 pub color: SDL_FColor,
154 pub needs_layout_update: ::core::primitive::bool,
156 pub layout: *mut TTF_TextLayout,
158 pub x: ::core::ffi::c_int,
160 pub y: ::core::ffi::c_int,
162 pub w: ::core::ffi::c_int,
164 pub h: ::core::ffi::c_int,
166 pub num_ops: ::core::ffi::c_int,
168 pub ops: *mut TTF_DrawOperation,
170 pub num_clusters: ::core::ffi::c_int,
172 pub clusters: *mut TTF_SubString,
174 pub props: SDL_PropertiesID,
176 pub needs_engine_update: ::core::primitive::bool,
178 pub engine: *mut TTF_TextEngine,
180 pub engine_text: *mut ::core::ffi::c_void,
182}
183
184impl ::core::default::Default for TTF_TextData {
185 #[inline(always)]
187 fn default() -> Self {
188 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
189 }
190}
191
192#[repr(C)]
205#[cfg_attr(feature = "debug-impls", derive(Debug))]
206pub struct TTF_TextEngine {
207 pub version: Uint32,
209 pub userdata: *mut ::core::ffi::c_void,
211 pub CreateText: ::core::option::Option<
212 unsafe extern "C" fn(
213 userdata: *mut ::core::ffi::c_void,
214 text: *mut TTF_Text,
215 ) -> ::core::primitive::bool,
216 >,
217 pub DestroyText: ::core::option::Option<
219 unsafe extern "C" fn(userdata: *mut ::core::ffi::c_void, text: *mut TTF_Text),
220 >,
221}
222
223impl TTF_TextEngine {
224 #[inline]
226 pub const fn new() -> Self {
227 const { ::core::assert!(::core::mem::size_of::<Self>() <= ::core::primitive::u32::MAX as usize) };
228 let mut this = unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() };
229 this.version = ::core::mem::size_of::<Self>() as ::core::primitive::u32;
230 this
231 }
232}
233
234impl ::core::default::Default for TTF_TextEngine {
235 #[inline(always)]
237 fn default() -> Self {
238 Self::new()
239 }
240}
241
242const _: () = ::core::assert!(
243 (((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 4_usize)
244 && (::core::mem::size_of::<TTF_TextEngine>() == 16_usize))
245 || ((::core::mem::size_of::<*mut ::core::ffi::c_void>() == 8_usize)
246 && (::core::mem::size_of::<TTF_TextEngine>() == 32_usize)))
247);
248
249#[repr(C)]
250pub struct TTF_TextLayout {
251 _opaque: [::core::primitive::u8; 0],
252}
253
254#[cfg(doc)]
255use crate::everything::*;