1#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
7#![allow(
8 clippy::approx_constant,
9 clippy::type_complexity,
10 clippy::unreadable_literal,
11 clippy::upper_case_acronyms
12)]
13#![cfg_attr(docsrs, feature(doc_cfg))]
14
15#[allow(unused_imports)]
16use std::ffi::{
17 c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
18};
19
20#[allow(unused_imports)]
21use glib::{GType, gboolean, gconstpointer, gpointer};
22#[allow(unused_imports)]
23use libc::{FILE, intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t};
24#[cfg(unix)]
25#[allow(unused_imports)]
26use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
27use {gio_sys as gio, glib_sys as glib, gobject_sys as gobject};
28
29pub type GlyLoaderError = c_int;
31pub const GLY_LOADER_ERROR_FAILED: GlyLoaderError = 0;
32pub const GLY_LOADER_ERROR_UNKNOWN_IMAGE_FORMAT: GlyLoaderError = 1;
33pub const GLY_LOADER_ERROR_NO_MORE_FRAMES: GlyLoaderError = 2;
34
35pub type GlyMemoryFormat = c_int;
36pub const GLY_MEMORY_B8G8R8A8_PREMULTIPLIED: GlyMemoryFormat = 0;
37pub const GLY_MEMORY_A8R8G8B8_PREMULTIPLIED: GlyMemoryFormat = 1;
38pub const GLY_MEMORY_R8G8B8A8_PREMULTIPLIED: GlyMemoryFormat = 2;
39pub const GLY_MEMORY_B8G8R8A8: GlyMemoryFormat = 3;
40pub const GLY_MEMORY_A8R8G8B8: GlyMemoryFormat = 4;
41pub const GLY_MEMORY_R8G8B8A8: GlyMemoryFormat = 5;
42pub const GLY_MEMORY_A8B8G8R8: GlyMemoryFormat = 6;
43pub const GLY_MEMORY_R8G8B8: GlyMemoryFormat = 7;
44pub const GLY_MEMORY_B8G8R8: GlyMemoryFormat = 8;
45pub const GLY_MEMORY_R16G16B16: GlyMemoryFormat = 9;
46pub const GLY_MEMORY_R16G16B16A16_PREMULTIPLIED: GlyMemoryFormat = 10;
47pub const GLY_MEMORY_R16G16B16A16: GlyMemoryFormat = 11;
48pub const GLY_MEMORY_R16G16B16_FLOAT: GlyMemoryFormat = 12;
49pub const GLY_MEMORY_R16G16B16A16_FLOAT: GlyMemoryFormat = 13;
50pub const GLY_MEMORY_R32G32B32_FLOAT: GlyMemoryFormat = 14;
51pub const GLY_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED: GlyMemoryFormat = 15;
52pub const GLY_MEMORY_R32G32B32A32_FLOAT: GlyMemoryFormat = 16;
53pub const GLY_MEMORY_G8A8_PREMULTIPLIED: GlyMemoryFormat = 17;
54pub const GLY_MEMORY_G8A8: GlyMemoryFormat = 18;
55pub const GLY_MEMORY_G8: GlyMemoryFormat = 19;
56pub const GLY_MEMORY_G16A16_PREMULTIPLIED: GlyMemoryFormat = 20;
57pub const GLY_MEMORY_G16A16: GlyMemoryFormat = 21;
58pub const GLY_MEMORY_G16: GlyMemoryFormat = 22;
59
60pub type GlySandboxSelector = c_int;
61pub const GLY_SANDBOX_SELECTOR_AUTO: GlySandboxSelector = 0;
62pub const GLY_SANDBOX_SELECTOR_BWRAP: GlySandboxSelector = 1;
63pub const GLY_SANDBOX_SELECTOR_FLATPAK_SPAWN: GlySandboxSelector = 2;
64pub const GLY_SANDBOX_SELECTOR_NOT_SANDBOXED: GlySandboxSelector = 3;
65
66pub type GlyMemoryFormatSelection = c_uint;
68pub const GLY_MEMORY_SELECTION_B8G8R8A8_PREMULTIPLIED: GlyMemoryFormatSelection = 1;
69pub const GLY_MEMORY_SELECTION_A8R8G8B8_PREMULTIPLIED: GlyMemoryFormatSelection = 2;
70pub const GLY_MEMORY_SELECTION_R8G8B8A8_PREMULTIPLIED: GlyMemoryFormatSelection = 4;
71pub const GLY_MEMORY_SELECTION_B8G8R8A8: GlyMemoryFormatSelection = 8;
72pub const GLY_MEMORY_SELECTION_A8R8G8B8: GlyMemoryFormatSelection = 16;
73pub const GLY_MEMORY_SELECTION_R8G8B8A8: GlyMemoryFormatSelection = 32;
74pub const GLY_MEMORY_SELECTION_A8B8G8R8: GlyMemoryFormatSelection = 64;
75pub const GLY_MEMORY_SELECTION_R8G8B8: GlyMemoryFormatSelection = 128;
76pub const GLY_MEMORY_SELECTION_B8G8R8: GlyMemoryFormatSelection = 256;
77pub const GLY_MEMORY_SELECTION_R16G16B16: GlyMemoryFormatSelection = 512;
78pub const GLY_MEMORY_SELECTION_R16G16B16A16_PREMULTIPLIED: GlyMemoryFormatSelection = 1024;
79pub const GLY_MEMORY_SELECTION_R16G16B16A16: GlyMemoryFormatSelection = 2048;
80pub const GLY_MEMORY_SELECTION_R16G16B16_FLOAT: GlyMemoryFormatSelection = 4096;
81pub const GLY_MEMORY_SELECTION_R16G16B16A16_FLOAT: GlyMemoryFormatSelection = 8192;
82pub const GLY_MEMORY_SELECTION_R32G32B32_FLOAT: GlyMemoryFormatSelection = 16384;
83pub const GLY_MEMORY_SELECTION_R32G32B32A32_FLOAT_PREMULTIPLIED: GlyMemoryFormatSelection = 32768;
84pub const GLY_MEMORY_SELECTION_R32G32B32A32_FLOAT: GlyMemoryFormatSelection = 65536;
85pub const GLY_MEMORY_SELECTION_G8A8_PREMULTIPLIED: GlyMemoryFormatSelection = 131072;
86pub const GLY_MEMORY_SELECTION_G8A8: GlyMemoryFormatSelection = 262144;
87pub const GLY_MEMORY_SELECTION_G8: GlyMemoryFormatSelection = 524288;
88pub const GLY_MEMORY_SELECTION_G16A16_PREMULTIPLIED: GlyMemoryFormatSelection = 1048576;
89pub const GLY_MEMORY_SELECTION_G16A16: GlyMemoryFormatSelection = 2097152;
90pub const GLY_MEMORY_SELECTION_G16: GlyMemoryFormatSelection = 4194304;
91
92pub type GlyLoaderGetMimeTypesDoneFunc = Option<unsafe extern "C" fn(*mut *mut c_char, gpointer)>;
94
95#[derive(Copy, Clone)]
97#[repr(C)]
98pub struct GlyCicp {
99 pub color_primaries: u8,
100 pub transfer_characteristics: u8,
101 pub matrix_coefficients: u8,
102 pub video_full_range_flag: u8,
103}
104
105impl ::std::fmt::Debug for GlyCicp {
106 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
107 f.debug_struct(&format!("GlyCicp @ {self:p}"))
108 .field("color_primaries", &self.color_primaries)
109 .field("transfer_characteristics", &self.transfer_characteristics)
110 .field("matrix_coefficients", &self.matrix_coefficients)
111 .field("video_full_range_flag", &self.video_full_range_flag)
112 .finish()
113 }
114}
115
116#[derive(Copy, Clone)]
117#[repr(C)]
118pub struct GlyCreatorClass {
119 pub parent_class: gobject::GObjectClass,
120}
121
122impl ::std::fmt::Debug for GlyCreatorClass {
123 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
124 f.debug_struct(&format!("GlyCreatorClass @ {self:p}"))
125 .field("parent_class", &self.parent_class)
126 .finish()
127 }
128}
129
130#[derive(Copy, Clone)]
131#[repr(C)]
132pub struct GlyEncodedImageClass {
133 pub parent_class: gobject::GObjectClass,
134}
135
136impl ::std::fmt::Debug for GlyEncodedImageClass {
137 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
138 f.debug_struct(&format!("GlyEncodedImageClass @ {self:p}"))
139 .field("parent_class", &self.parent_class)
140 .finish()
141 }
142}
143
144#[derive(Copy, Clone)]
145#[repr(C)]
146pub struct GlyFrameClass {
147 pub parent_class: gobject::GObjectClass,
148}
149
150impl ::std::fmt::Debug for GlyFrameClass {
151 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
152 f.debug_struct(&format!("GlyFrameClass @ {self:p}"))
153 .field("parent_class", &self.parent_class)
154 .finish()
155 }
156}
157
158#[derive(Copy, Clone)]
159#[repr(C)]
160pub struct GlyFrameRequestClass {
161 pub parent_class: gobject::GObjectClass,
162}
163
164impl ::std::fmt::Debug for GlyFrameRequestClass {
165 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
166 f.debug_struct(&format!("GlyFrameRequestClass @ {self:p}"))
167 .field("parent_class", &self.parent_class)
168 .finish()
169 }
170}
171
172#[derive(Copy, Clone)]
173#[repr(C)]
174pub struct GlyImageClass {
175 pub parent_class: gobject::GObjectClass,
176}
177
178impl ::std::fmt::Debug for GlyImageClass {
179 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
180 f.debug_struct(&format!("GlyImageClass @ {self:p}"))
181 .field("parent_class", &self.parent_class)
182 .finish()
183 }
184}
185
186#[derive(Copy, Clone)]
187#[repr(C)]
188pub struct GlyLoaderClass {
189 pub parent_class: gobject::GObjectClass,
190}
191
192impl ::std::fmt::Debug for GlyLoaderClass {
193 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
194 f.debug_struct(&format!("GlyLoaderClass @ {self:p}"))
195 .field("parent_class", &self.parent_class)
196 .finish()
197 }
198}
199
200#[derive(Copy, Clone)]
201#[repr(C)]
202pub struct GlyNewFrameClass {
203 pub parent_class: gobject::GObjectClass,
204}
205
206impl ::std::fmt::Debug for GlyNewFrameClass {
207 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
208 f.debug_struct(&format!("GlyNewFrameClass @ {self:p}"))
209 .field("parent_class", &self.parent_class)
210 .finish()
211 }
212}
213
214#[repr(C)]
216#[allow(dead_code)]
217pub struct GlyCreator {
218 _data: [u8; 0],
219 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
220}
221
222impl ::std::fmt::Debug for GlyCreator {
223 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
224 f.debug_struct(&format!("GlyCreator @ {self:p}")).finish()
225 }
226}
227
228#[repr(C)]
229#[allow(dead_code)]
230pub struct GlyEncodedImage {
231 _data: [u8; 0],
232 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
233}
234
235impl ::std::fmt::Debug for GlyEncodedImage {
236 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
237 f.debug_struct(&format!("GlyEncodedImage @ {self:p}"))
238 .finish()
239 }
240}
241
242#[repr(C)]
243#[allow(dead_code)]
244pub struct GlyFrame {
245 _data: [u8; 0],
246 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
247}
248
249impl ::std::fmt::Debug for GlyFrame {
250 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
251 f.debug_struct(&format!("GlyFrame @ {self:p}")).finish()
252 }
253}
254
255#[repr(C)]
256#[allow(dead_code)]
257pub struct GlyFrameRequest {
258 _data: [u8; 0],
259 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
260}
261
262impl ::std::fmt::Debug for GlyFrameRequest {
263 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
264 f.debug_struct(&format!("GlyFrameRequest @ {self:p}"))
265 .finish()
266 }
267}
268
269#[repr(C)]
270#[allow(dead_code)]
271pub struct GlyImage {
272 _data: [u8; 0],
273 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
274}
275
276impl ::std::fmt::Debug for GlyImage {
277 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
278 f.debug_struct(&format!("GlyImage @ {self:p}")).finish()
279 }
280}
281
282#[repr(C)]
283#[allow(dead_code)]
284pub struct GlyLoader {
285 _data: [u8; 0],
286 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
287}
288
289impl ::std::fmt::Debug for GlyLoader {
290 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
291 f.debug_struct(&format!("GlyLoader @ {self:p}")).finish()
292 }
293}
294
295#[repr(C)]
296#[allow(dead_code)]
297pub struct GlyNewFrame {
298 _data: [u8; 0],
299 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
300}
301
302impl ::std::fmt::Debug for GlyNewFrame {
303 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
304 f.debug_struct(&format!("GlyNewFrame @ {self:p}")).finish()
305 }
306}
307
308unsafe extern "C" {
309
310 pub fn gly_loader_error_get_type() -> GType;
314 pub fn gly_loader_error_quark() -> glib::GQuark;
315
316 pub fn gly_memory_format_get_type() -> GType;
320 pub fn gly_memory_format_has_alpha(memory_format: GlyMemoryFormat) -> gboolean;
321 pub fn gly_memory_format_is_premultiplied(memory_format: GlyMemoryFormat) -> gboolean;
322
323 pub fn gly_sandbox_selector_get_type() -> GType;
327
328 pub fn gly_memory_format_selection_get_type() -> GType;
332
333 pub fn gly_cicp_get_type() -> GType;
337 pub fn gly_cicp_copy(cicp: *mut GlyCicp) -> *mut GlyCicp;
338 pub fn gly_cicp_free(cicp: *mut GlyCicp);
339
340 pub fn gly_creator_get_type() -> GType;
344 pub fn gly_creator_new(
345 mime_type: *const c_char,
346 error: *mut *mut glib::GError,
347 ) -> *mut GlyCreator;
348 pub fn gly_creator_add_frame(
349 creator: *mut GlyCreator,
350 width: u32,
351 height: u32,
352 memory_format: GlyMemoryFormat,
353 texture: *mut glib::GBytes,
354 error: *mut *mut glib::GError,
355 ) -> *mut GlyNewFrame;
356 pub fn gly_creator_add_frame_with_stride(
357 creator: *mut GlyCreator,
358 width: u32,
359 height: u32,
360 stride: u32,
361 memory_format: GlyMemoryFormat,
362 texture: *mut glib::GBytes,
363 error: *mut *mut glib::GError,
364 ) -> *mut GlyNewFrame;
365 pub fn gly_creator_add_metadata_key_value(
366 creator: *mut GlyCreator,
367 key: *const c_char,
368 value: *const c_char,
369 ) -> gboolean;
370 pub fn gly_creator_create(
371 image: *mut GlyCreator,
372 error: *mut *mut glib::GError,
373 ) -> *mut GlyEncodedImage;
374 pub fn gly_creator_create_async(
375 creator: *mut GlyCreator,
376 cancellable: *mut gio::GCancellable,
377 callback: gio::GAsyncReadyCallback,
378 user_data: gpointer,
379 );
380 pub fn gly_creator_create_finish(
381 creator: *mut GlyCreator,
382 result: *mut gio::GAsyncResult,
383 error: *mut *mut glib::GError,
384 ) -> *mut GlyEncodedImage;
385 pub fn gly_creator_set_encoding_compression(
386 creator: *mut GlyCreator,
387 compression: u8,
388 ) -> gboolean;
389 pub fn gly_creator_set_encoding_quality(creator: *mut GlyCreator, quality: u8) -> gboolean;
390 pub fn gly_creator_set_sandbox_selector(
391 creator: *mut GlyCreator,
392 sandbox_selector: GlySandboxSelector,
393 ) -> gboolean;
394
395 pub fn gly_encoded_image_get_type() -> GType;
399 pub fn gly_encoded_image_get_data(encoded_image: *mut GlyEncodedImage) -> *mut glib::GBytes;
400
401 pub fn gly_frame_get_type() -> GType;
405 pub fn gly_frame_get_buf_bytes(frame: *mut GlyFrame) -> *mut glib::GBytes;
406 pub fn gly_frame_get_color_cicp(frame: *mut GlyFrame) -> *mut GlyCicp;
407 pub fn gly_frame_get_delay(frame: *mut GlyFrame) -> i64;
408 pub fn gly_frame_get_height(frame: *mut GlyFrame) -> u32;
409 pub fn gly_frame_get_memory_format(frame: *mut GlyFrame) -> GlyMemoryFormat;
410 pub fn gly_frame_get_stride(frame: *mut GlyFrame) -> u32;
411 pub fn gly_frame_get_width(frame: *mut GlyFrame) -> u32;
412
413 pub fn gly_frame_request_get_type() -> GType;
417 pub fn gly_frame_request_new() -> *mut GlyFrameRequest;
418 pub fn gly_frame_request_set_loop_animation(
419 frame_request: *mut GlyFrameRequest,
420 loop_animation: gboolean,
421 );
422 pub fn gly_frame_request_set_scale(
423 frame_request: *mut GlyFrameRequest,
424 width: u32,
425 height: u32,
426 );
427
428 pub fn gly_image_get_type() -> GType;
432 pub fn gly_image_get_height(image: *mut GlyImage) -> u32;
433 pub fn gly_image_get_metadata_key_value(
434 image: *mut GlyImage,
435 key: *const c_char,
436 ) -> *mut c_char;
437 pub fn gly_image_get_metadata_keys(image: *mut GlyImage) -> *mut *mut c_char;
438 pub fn gly_image_get_mime_type(image: *mut GlyImage) -> *const c_char;
439 pub fn gly_image_get_specific_frame(
440 image: *mut GlyImage,
441 frame_request: *mut GlyFrameRequest,
442 error: *mut *mut glib::GError,
443 ) -> *mut GlyFrame;
444 pub fn gly_image_get_specific_frame_async(
445 image: *mut GlyImage,
446 frame_request: *mut GlyFrameRequest,
447 cancellable: *mut gio::GCancellable,
448 callback: gio::GAsyncReadyCallback,
449 user_data: gpointer,
450 );
451 pub fn gly_image_get_specific_frame_finish(
452 image: *mut GlyImage,
453 result: *mut gio::GAsyncResult,
454 error: *mut *mut glib::GError,
455 ) -> *mut GlyFrame;
456 pub fn gly_image_get_transformation_orientation(image: *mut GlyImage) -> u16;
457 pub fn gly_image_get_width(image: *mut GlyImage) -> u32;
458 pub fn gly_image_next_frame(
459 image: *mut GlyImage,
460 error: *mut *mut glib::GError,
461 ) -> *mut GlyFrame;
462 pub fn gly_image_next_frame_async(
463 image: *mut GlyImage,
464 cancellable: *mut gio::GCancellable,
465 callback: gio::GAsyncReadyCallback,
466 user_data: gpointer,
467 );
468 pub fn gly_image_next_frame_finish(
469 image: *mut GlyImage,
470 result: *mut gio::GAsyncResult,
471 error: *mut *mut glib::GError,
472 ) -> *mut GlyFrame;
473
474 pub fn gly_loader_get_type() -> GType;
478 pub fn gly_loader_new(file: *mut gio::GFile) -> *mut GlyLoader;
479 pub fn gly_loader_new_for_bytes(bytes: *mut glib::GBytes) -> *mut GlyLoader;
480 pub fn gly_loader_new_for_stream(stream: *mut gio::GInputStream) -> *mut GlyLoader;
481 pub fn gly_loader_get_mime_types() -> *mut *mut c_char;
482 pub fn gly_loader_get_mime_types_async(
483 cancellable: *mut gio::GCancellable,
484 callback: gio::GAsyncReadyCallback,
485 user_data: gpointer,
486 );
487 pub fn gly_loader_get_mime_types_finish(
488 result: *mut gio::GAsyncResult,
489 error: *mut *mut glib::GError,
490 ) -> *mut *mut c_char;
491 pub fn gly_loader_load(loader: *mut GlyLoader, error: *mut *mut glib::GError) -> *mut GlyImage;
492 pub fn gly_loader_load_async(
493 loader: *mut GlyLoader,
494 cancellable: *mut gio::GCancellable,
495 callback: gio::GAsyncReadyCallback,
496 user_data: gpointer,
497 );
498 pub fn gly_loader_load_finish(
499 loader: *mut GlyLoader,
500 result: *mut gio::GAsyncResult,
501 error: *mut *mut glib::GError,
502 ) -> *mut GlyImage;
503 pub fn gly_loader_set_accepted_memory_formats(
504 loader: *mut GlyLoader,
505 memory_format_selection: GlyMemoryFormatSelection,
506 );
507 pub fn gly_loader_set_apply_transformations(
508 loader: *mut GlyLoader,
509 apply_transformations: gboolean,
510 );
511 pub fn gly_loader_set_sandbox_selector(
512 loader: *mut GlyLoader,
513 sandbox_selector: GlySandboxSelector,
514 );
515
516 pub fn gly_new_frame_get_type() -> GType;
520 pub fn gly_new_frame_set_color_icc_profile(
521 new_frame: *mut GlyNewFrame,
522 icc_profile: *mut glib::GBytes,
523 ) -> gboolean;
524
525}