### Install system dependencies Source: https://docs.rs/glycin Commands to install required system libraries and loaders on Debian/Ubuntu and Fedora. ```bash $ apt install libgtk-4-dev liblcms2-dev libfontconfig-dev libseccomp-dev glycin-loaders bubblewrap ``` ```bash $ dnf install gtk4-devel lcms2-devel fontconfig-devel libseccomp-devel glycin-loaders bubblewrap ``` -------------------------------- ### Glycin Dependencies and Installation Source: https://docs.rs/glycin/3.1.0/glycin/index.html Information on external dependencies required by Glycin and installation commands for Debian/Ubuntu and Fedora. ```APIDOC ## External Dependencies and Installation ### Required Packages Glycin requires the following libraries: `libglib2.0`, `liblcms2`, `libfontconfig`, and `libseccomp`. For the `gdk4` feature, `libgtk-4` is also necessary. For sandboxed mode, `bwrap` from `bubblewrap` is required. ### Installation Commands #### Debian/Ubuntu ```bash $ apt install libgtk-4-dev liblcms2-dev libfontconfig-dev libseccomp-dev glycin-loaders bubblewrap ``` #### Fedora ```bash $ dnf install gtk4-devel lcms2-devel fontconfig-devel libseccomp-devel glycin-loaders bubblewrap ``` ### Description This section details the system-level packages needed for Glycin to function correctly, including specific libraries for image processing and optional components for GUI integration and sandboxing. Installation commands are provided for common Linux distributions. ``` -------------------------------- ### Image Loading and Display Example Source: https://docs.rs/glycin This example demonstrates how to load an image using the glycin crate and display it using gtk4. ```APIDOC ## Example Usage This example requires the `gdk4` feature to be enabled. ### Code ```rust let file = gio::File::for_path("image.jpg"); let image = Loader::new(file).load().await?; let height = image.details().height(); let texture = image.next_frame().await?.texture(); // To display the image, pass the texture to gtk4::Image::from_paintable() // gtk4::Image::from_paintable(texture); ``` ### Description This code snippet shows how to create a `Loader` instance with a `gio::File`, load the image, retrieve its details (like height), and obtain a `gdk::Texture` from the first frame. ``` -------------------------------- ### Image Loading and Display Example Source: https://docs.rs/glycin/3.1.0/glycin/index.html This example demonstrates how to load an image using the glycin crate and display it using gtk4. ```APIDOC ## Example Usage This example requires the `gdk4` feature to be enabled. ### Code ```rust let file = gio::File::for_path("image.jpg"); let image = Loader::new(file).load().await?; let height = image.details().height(); let texture = image.next_frame().await?.texture(); // You can pass the `texture` of a `Frame` to `gtk4::Image::from_paintable()` to display the image. ``` ### Description The code snippet shows how to create a `Loader` instance with a `gio::File`, load the image asynchronously, retrieve image details like height, and obtain a `gdk::Texture` from the next frame. The resulting texture can be used with `gtk4::Image` for display. ``` -------------------------------- ### Glycin Dependencies and Installation Source: https://docs.rs/glycin Information on external dependencies required by glycin and installation commands for Debian/Ubuntu and Fedora. ```APIDOC ## External Dependencies Glycin requires the following system libraries: - `libglib2.0` - `liblcms2` - `libfontconfig` - `libseccomp` For the `gdk4` feature, `libgtk-4` is also required. Additionally, image loaders for specific formats need to be installed. Glycin provides these loaders. When using the default sandbox mode, the `bwrap` binary from `bubblewrap` is necessary. ### Installation Commands **Debian/Ubuntu:** ```bash $ apt install libgtk-4-dev liblcms2-dev libfontconfig-dev libseccomp-dev glycin-loaders bubblewrap ``` **Fedora:** ```bash $ dnf install gtk4-devel lcms2-devel fontconfig-devel libseccomp-devel glycin-loaders bubblewrap ``` ``` -------------------------------- ### Install Glycin Dependencies on Fedora Source: https://docs.rs/glycin/3.1.0/glycin/index.html Command to install necessary Glycin dependencies and loaders on Fedora systems. ```bash $ dnf install gtk4-devel lcms2-devel fontconfig-devel libseccomp-devel glycin-loaders bubblewrap ``` -------------------------------- ### Install Glycin Dependencies on Debian/Ubuntu Source: https://docs.rs/glycin/3.1.0/glycin/index.html Command to install necessary Glycin dependencies and loaders on Debian or Ubuntu systems. ```bash $ apt install libgtk-4-dev liblcms2-dev libfontconfig-dev libseccomp-dev glycin-loaders bubblewrap ``` -------------------------------- ### Get Supported Image Formats Source: https://docs.rs/glycin/3.1.0/glycin/struct.EditableImage.html Retrieves a map of supported MIME types to their corresponding ImageEditorConfig. No setup is required. ```rust pub async fn supported_formats() -> BTreeMap ``` -------------------------------- ### Get Image Details Source: https://docs.rs/glycin/3.1.0/glycin/struct.Image.html Returns the already obtained details of the image. ```rust pub fn details(&self) -> ImageDetails ``` -------------------------------- ### Get Source Definition for MemoryFormat Source: https://docs.rs/glycin/3.1.0/glycin/enum.MemoryFormat.html Defines from which channels to get the RGBA values for a given MemoryFormat. The return value is in the order [R, G, B, A]. ```rust pub const fn source_definition(self) -> [Source; 4] ``` -------------------------------- ### Get Image File Handle Source: https://docs.rs/glycin/3.1.0/glycin/struct.Image.html Returns an Option containing the File handle the image was loaded from. Returns None if loaded from a stream or binary data. ```rust pub fn file(&self) -> Option ``` -------------------------------- ### Create Empty MemoryFormatSelection Source: https://docs.rs/glycin/3.1.0/glycin/struct.MemoryFormatSelection.html Get an empty `MemoryFormatSelection` with all bits unset. ```rust fn empty() -> Self ``` -------------------------------- ### Get Image MIME Type Source: https://docs.rs/glycin/3.1.0/glycin/struct.Image.html Returns the detected MIME type of the image file. ```rust pub fn mime_type(&self) -> MimeType ``` -------------------------------- ### Get Frame Details Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Retrieves the detailed information about the frame. This method is part of the Frame implementation. ```rust pub fn details(&self) -> FrameDetails ``` -------------------------------- ### Get Active Sandbox Mechanism Source: https://docs.rs/glycin/3.1.0/glycin/struct.Image.html Returns the active sandbox mechanism used for the image. ```rust pub fn active_sandbox_mechanism(&self) -> SandboxMechanism ``` -------------------------------- ### Get Target Definition for MemoryFormat Source: https://docs.rs/glycin/3.1.0/glycin/enum.MemoryFormat.html Provides the target definition for a MemoryFormat. This is used in transformations to understand how data should be mapped. ```rust pub const fn target_definition(self) -> &'static [Target] ``` -------------------------------- ### Get Image Transformation Orientation Source: https://docs.rs/glycin/3.1.0/glycin/struct.Image.html Returns the orientation transformations to be applied to correctly orient the image. These must be applied manually if Loader::apply_transformations is false. ```rust pub fn transformation_orientation(&self) -> Orientation ``` -------------------------------- ### Creator API Methods Source: https://docs.rs/glycin/3.1.0/glycin/struct.Creator.html Methods for initializing the Creator, adding image frames, and configuring encoding settings. ```APIDOC ## new(mime_type: MimeType) ### Description Create a new image encoder instance. ### Parameters - **mime_type** (MimeType) - Required - The MIME type of the image to be encoded. ## add_frame(width, height, memory_format, texture) ### Description Adds a frame to the encoder. ### Parameters - **width** (u32) - Required - Frame width. - **height** (u32) - Required - Frame height. - **memory_format** (MemoryFormat) - Required - The format of the memory. - **texture** (Vec) - Required - The raw texture data. ## set_encoding_compression(compression) ### Description Sets the lossless compression level for the encoder. ### Parameters - **compression** (u8) - Required - Compression level from 0 (no compression) to 100 (highest). ## create() ### Description Finalizes the encoding process and returns the encoded image. ### Response - **EncodedImage** (Result) - The resulting encoded image or an error context. ``` -------------------------------- ### Implement CloneToUninit (Nightly) Source: https://docs.rs/glycin/3.1.0/glycin/enum.Operation.html An experimental nightly-only API for performing copy-assignment from a value to uninitialized memory. Use with caution. ```rust unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` -------------------------------- ### Trait Implementations Source: https://docs.rs/glycin/3.1.0/glycin/struct.Cicp.html Documentation for memory management, conversion, and subscriber attachment traits. ```APIDOC ## ToOwned Trait ### Description Provides methods for creating owned data from borrowed data. ### Methods - **to_owned(&self) -> T**: Creates owned data from borrowed data. - **clone_into(&self, target: &mut T)**: Replaces owned data with borrowed data. ## TryFrom / TryInto Traits ### Description Handles fallible type conversions. ### Methods - **try_from(value: U) -> Result**: Performs conversion from U to T. - **try_into(self) -> Result**: Performs conversion from T to U. ## WithSubscriber Trait ### Description Attaches subscribers to types for dispatching. ### Methods - **with_subscriber(self, subscriber: S) -> WithDispatch**: Attaches a specific subscriber. - **with_current_subscriber(self) -> WithDispatch**: Attaches the current default subscriber. ``` -------------------------------- ### Loading and Supported MIME Types Source: https://docs.rs/glycin/3.1.0/glycin/struct.Loader.html Details on how to load an image and retrieve a list of supported MIME types. ```APIDOC ## Loading Operations ### `pub async fn load(self) -> Result` Load basic image information and enable further operations. ### `pub async fn supported_mime_types() -> Vec` Returns a list of mime types for which loaders are configured. ``` -------------------------------- ### Loader Struct and Constructors Source: https://docs.rs/glycin/3.1.0/glycin/struct.Loader.html Information about the Loader struct and its various constructors for initializing the loader with different data sources. ```APIDOC ## Struct Loader Represents an image loader that can load images from various sources and apply transformations. ### Constructors - **`pub const DEFAULT_MIME_TYPES: &'static [&'static str]`**: Formats that the default glycin loaders support. - **`pub fn new(file: File) -> Self`**: Create a loader with a `gio::File` as source. - **`pub unsafe fn new_stream(stream: impl IsA) -> Self`**: Create a loader with a `gio::InputStream` as source. - **`pub fn new_bytes(bytes: Bytes) -> Self`**: Create a loader with `glib::Bytes` as source. - **`pub fn new_vec(buf: Vec) -> Self`**: Create a loader with `Vec` as source. ``` -------------------------------- ### Pointable Implementation Source: https://docs.rs/glycin/3.1.0/glycin/struct.Operations.html Methods for managing pointers and their associated data. ```APIDOC ## impl Pointable for T ### Constants #### ALIGN (usize) - **Description**: The alignment of the pointer. ``` ```APIDOC ## unsafe fn init(init: ::Init) -> usize ### Description Initializes a with the given initializer. ### Parameters #### Request Body - **init** (::Init) - Required - The initializer for the object. ### Response #### Success Response (200) - **usize** - The pointer to the initialized object. ``` ```APIDOC ## unsafe fn deref<'a>(ptr: usize) -> &'a T ### Description Dereferences the given pointer. ### Parameters #### Path Parameters - **ptr** (usize) - Required - The pointer to dereference. ### Response #### Success Response (200) - **&'a T** - A reference to the data at the pointer. ``` ```APIDOC ## unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T ### Description Mutably dereferences the given pointer. ### Parameters #### Path Parameters - **ptr** (usize) - Required - The pointer to mutably dereference. ### Response #### Success Response (200) - **&'a mut T** - A mutable reference to the data at the pointer. ``` ```APIDOC ## unsafe fn drop(ptr: usize) ### Description Drops the object pointed to by the given pointer. ### Parameters #### Path Parameters - **ptr** (usize) - Required - The pointer to the object to drop. ``` -------------------------------- ### Trait Implementations Overview Source: https://docs.rs/glycin/3.1.0/glycin/enum.MimeType.html Documentation for standard and custom trait implementations available for generic types. ```APIDOC ## Trait Implementations ### Into - **into(self) -> U**: Calls `U::from(self)` to perform type conversion. ### IntoEither - **into_either(self, into_left: bool) -> Either**: Converts self into a `Left` variant if `into_left` is true, otherwise `Right`. - **into_either_with(self, into_left: F) -> Either**: Converts self based on the result of the provided closure `into_left`. ### Pointable - **ALIGN**: Constant for pointer alignment. - **init(init: Init) -> usize**: Initializes an object. - **deref(ptr: usize) -> &T**: Dereferences a pointer. - **deref_mut(ptr: usize) -> &mut T**: Mutably dereferences a pointer. - **drop(ptr: usize)**: Drops the object at the pointer. ### ToOwned - **to_owned(&self) -> T**: Creates owned data from borrowed data. - **clone_into(&self, target: &mut T)**: Replaces owned data using borrowed data. ### ToString - **to_string(&self) -> String**: Converts the value to a `String`. ### TryFrom / TryInto - **try_from(value: U) -> Result**: Performs a fallible conversion. - **try_into(self) -> Result**: Performs a fallible conversion into another type. ### WithSubscriber - **with_subscriber(self, subscriber: S) -> WithDispatch**: Attaches a subscriber to the type. - **with_current_subscriber(self) -> WithDispatch**: Attaches the current default subscriber. ``` -------------------------------- ### Implement Any Trait Source: https://docs.rs/glycin/3.1.0/glycin/struct.EditableImage.html Gets the TypeId of the implementing type. This is a blanket implementation for any type T. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Default MemoryFormatSelection Source: https://docs.rs/glycin/3.1.0/glycin/struct.MemoryFormatSelection.html Get the default value for `MemoryFormatSelection`, which typically represents an empty set of flags. ```rust fn default() -> MemoryFormatSelection ``` -------------------------------- ### Load an image with Glycin Source: https://docs.rs/glycin Demonstrates loading an image from a file and retrieving its texture. Requires the gdk4 feature to be enabled. ```rust let file = gio::File::for_path("image.jpg"); let image = Loader::new(file).load().await?; let height = image.details().height(); let texture = image.next_frame().await?.texture(); ``` -------------------------------- ### Get Frame Texture Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Retrieves the texture associated with the frame. This method is part of the Frame implementation. ```rust pub fn texture(&self) -> Texture ``` -------------------------------- ### Loader Configuration Methods Source: https://docs.rs/glycin/3.1.0/glycin/struct.Loader.html Methods available on the Loader struct to configure its behavior, such as sandbox selection, cancellation, transformations, memory formats, and base directory exposure. ```APIDOC ## Loader Configuration ### `pub fn sandbox_selector(&mut self, sandbox_selector: SandboxSelector) -> &mut Self` Sets the method by which the sandbox mechanism is selected. The default without calling this function is `SandboxSelector::Auto`. ### `pub fn cancellable(&mut self, cancellable: impl IsA) -> &mut Self` Set `Cancellable` to cancel any loader operations. ### `pub fn apply_transformations(&mut self, apply_transformations: bool) -> &mut Self` Set whether to apply transformations to texture. When enabled, transformations like image orientation are applied to the texture data. This option is enabled by default. ### `pub fn accepted_memory_formats(&mut self, memory_format_selection: MemoryFormatSelection) -> &mut Self` Sets which memory formats can be returned by the loader. If the memory format doesn’t match one of the selected formats, the format will be transformed into the best suitable format selected. ### `pub fn use_expose_base_dir(&mut self, use_epose_base_dir: bool) -> &mut Self` Sets if the file’s directory can be exposed to loaders. Some loaders have the `use_base_dir` option enabled to load external files. One example is SVGs which can display external images inside the picture. By default, `use_expose_base_dir` is set to `false`. You need to enable it for the `use_base_dir` option to have any effect. The downside of enabling it is that separate sandboxes are needed for different base directories, which has a noticeable performance impact when loading many small SVGs from many different directories. ### `pub fn pool(&mut self, pool: Arc) -> &mut Self` Sets the memory pool for the loader. ``` -------------------------------- ### Get Frame Height Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Returns the height of the frame in pixels. This method is part of the Frame implementation. ```rust pub fn height(&self) -> u32 ``` -------------------------------- ### Get Frame Width Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Returns the width of the frame in pixels. This method is part of the Frame implementation. ```rust pub fn width(&self) -> u32 ``` -------------------------------- ### Pool Implementations Source: https://docs.rs/glycin/3.1.0/glycin/struct.Pool.html Provides methods for creating and accessing the Pool. ```APIDOC ## Implementations ### impl Pool #### pub fn new(config: PoolConfig) -> Arc Creates a new Pool with the given configuration. #### pub fn global() -> Arc Returns the global Pool instance. ``` -------------------------------- ### Get Underlying Bits of MemoryFormatSelection Source: https://docs.rs/glycin/3.1.0/glycin/struct.MemoryFormatSelection.html Retrieve the underlying unsigned 32-bit integer representation of the `MemoryFormatSelection` flags. ```rust fn bits(&self) -> u32 ``` -------------------------------- ### Select Best Format for MemoryFormat Source: https://docs.rs/glycin/3.1.0/glycin/struct.MemoryFormatSelection.html Use `best_format_for` to find the most suitable MemoryFormat from a selection to represent a given source format. Returns `None` if no formats are selected. ```rust assert_eq!( (MemoryFormatSelection::R8g8b8 | MemoryFormatSelection::R8g8b8a8) .best_format_for(MemoryFormat::A8b8g8r8), Some(MemoryFormat::R8g8b8a8) ); assert_eq!( (MemoryFormatSelection::R8g8b8 | MemoryFormatSelection::R8g8b8a8) .best_format_for(MemoryFormat::B8g8r8), Some(MemoryFormat::R8g8b8) ); assert_eq!( (MemoryFormatSelection::R8g8b8 | MemoryFormatSelection::R16g16b16) .best_format_for(MemoryFormat::B8g8r8), Some(MemoryFormat::R8g8b8) ); assert_eq!( (MemoryFormatSelection::R8g8b8 | MemoryFormatSelection::R16g16b16) .best_format_for(MemoryFormat::R16g16b16Float), Some(MemoryFormat::R16g16b16) ); assert_eq!( MemoryFormatSelection::empty().best_format_for(MemoryFormat::R16g16b16Float), None ); ``` -------------------------------- ### Editor API Source: https://docs.rs/glycin/3.1.0/glycin/struct.Editor.html Methods for initializing and configuring the image editor. ```APIDOC ## Editor Struct ### Description The Editor struct is used to build and execute image editing operations. It allows for configuring the sandbox environment and managing operation cancellation. ### Methods #### new(file: File) -> Self Creates a new instance of the Editor for a given file. #### edit(self) -> Result Executes the editing operation and returns an EditableImage. #### sandbox_selector(&mut self, sandbox_selector: SandboxSelector) -> &mut Self Sets the method by which the sandbox mechanism is selected. Defaults to `SandboxSelector::Auto`. #### cancellable(&mut self, cancellable: impl IsA) -> &mut Self Sets a `Cancellable` object to allow for the cancellation of ongoing editing operations. ``` -------------------------------- ### Get Frame Memory Format Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Retrieves the memory format of the frame. This method is part of the Frame implementation. ```rust pub fn memory_format(&self) -> MemoryFormat ``` -------------------------------- ### Get Frame Stride Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Returns the line stride in bytes for the frame. This method is part of the Frame implementation. ```rust pub fn stride(&self) -> u32 ``` -------------------------------- ### MemoryFormatSelection Instance Methods Source: https://docs.rs/glycin/3.1.0/glycin/struct.MemoryFormatSelection.html This section covers the instance methods for checking properties and modifying MemoryFormatSelection instances. ```APIDOC ## MemoryFormatSelection Instance Methods ### Description Instance methods for checking properties and modifying MemoryFormatSelection. ### Methods - **bits(&self) -> u32**: Gets the underlying bits value. - **is_empty(&self) -> bool**: Checks if all bits in this flags value are unset. - **is_all(&self) -> bool**: Checks if all known bits in this flags value are set. - **intersects(&self, other: MemoryFormatSelection) -> bool**: Checks if any set bits in `self` are also set in `other`. - **contains(&self, other: MemoryFormatSelection) -> bool**: Checks if all set bits in `self` are also set in `other`. - **insert(&mut self, other: MemoryFormatSelection)**: Performs a bitwise OR operation with `other`. - **remove(&mut self, other: MemoryFormatSelection)**: Performs a bitwise AND NOT operation with `other`. - **toggle(&mut self, other: MemoryFormatSelection)**: Performs a bitwise XOR operation with `other`. - **set(&mut self, other: MemoryFormatSelection, value: bool)**: Inserts `other` if `value` is true, removes it if `value` is false. - **intersection(self, other: MemoryFormatSelection) -> MemoryFormatSelection**: Returns the bitwise AND of `self` and `other`. - **union(self, other: MemoryFormatSelection) -> MemoryFormatSelection**: Returns the bitwise OR of `self` and `other`. - **difference(self, other: MemoryFormatSelection) -> MemoryFormatSelection**: Returns the bitwise AND NOT of `self` and `other`. - **symmetric_difference(self, other: MemoryFormatSelection) -> MemoryFormatSelection**: Returns the bitwise XOR of `self` and `other`. - **complement(self) -> MemoryFormatSelection**: Returns the bitwise negation of `self`, truncating unknown bits. ``` -------------------------------- ### Get Signature for MemoryFormat Type Source: https://docs.rs/glycin/3.1.0/glycin/enum.MemoryFormat.html Provides the static signature for the MemoryFormat type. This is part of the Type trait. ```rust const SIGNATURE: &'static Signature ``` -------------------------------- ### Clone Implementation Source: https://docs.rs/glycin/3.1.0/glycin/struct.ImageDetails.html Provides methods for cloning ImageDetails instances. ```APIDOC ## impl Clone for ImageDetails ### `clone()` Returns a duplicate of the `ImageDetails` value. - **Returns**: `ImageDetails` - A cloned instance. ### `clone_from()` Performs copy-assignment from a source `ImageDetails`. - **Parameters**: - `source`: `&Self` - The source `ImageDetails` to copy from. ``` -------------------------------- ### Get Frame Color State Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Retrieves a reference to the color state of the frame. This method is part of the Frame implementation. ```rust pub fn color_state(&self) -> &ColorState ``` -------------------------------- ### Access COMPAT_VERSION constant Source: https://docs.rs/glycin/3.1.0/glycin/constant.COMPAT_VERSION.html Represents the compatibility version as a u8 integer. ```rust pub const COMPAT_VERSION: u8 = 2; ``` -------------------------------- ### Get Frame Buffer Bytes Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Retrieves the raw byte buffer of the frame. This method is part of the Frame implementation. ```rust pub fn buf_bytes(&self) -> Bytes ``` -------------------------------- ### Get Number of Bytes for MemoryFormat Source: https://docs.rs/glycin/3.1.0/glycin/enum.MemoryFormat.html Returns the MemoryFormatBytes associated with a MemoryFormat variant. This method is part of the MemoryFormatInfo trait. ```rust fn n_bytes(self) -> MemoryFormatBytes ``` -------------------------------- ### BinaryData Methods Source: https://docs.rs/glycin/3.1.0/glycin/struct.BinaryData.html Methods for creating, retrieving, and managing binary data within the BinaryData struct. ```APIDOC ## BinaryData Methods ### Description Methods to interact with the BinaryData structure, including data retrieval and initialization. ### Methods - **get_full() -> Result, Error>** - Returns a copy of the binary data as a vector of bytes. - **get() -> Result** - Returns a reference to the binary data. - **from_data(value: impl AsRef<[u8]>) -> Result** - Creates a new BinaryData instance from the provided byte slice. ``` -------------------------------- ### unsafe fn clone_to_uninit Source: https://docs.rs/glycin/3.1.0/glycin/enum.MemoryFormat.html Nightly-only experimental function to copy data to an uninitialized buffer. ```APIDOC #### unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Description This is a nightly-only experimental API. Performs copy-assignment from `self` to `dest`. ``` -------------------------------- ### Get Cancellable Handle for Image Operations Source: https://docs.rs/glycin/3.1.0/glycin/struct.Image.html Provides a Cancellable handle to manage and cancel ongoing operations within this image. ```rust pub fn cancellable(&self) -> Cancellable ``` -------------------------------- ### MemoryFormatSelection Methods Source: https://docs.rs/glycin/3.1.0/glycin/struct.MemoryFormatSelection.html Methods for iterating over flags and selecting the best memory format from a selection. ```APIDOC ## iter ### Description Yield a set of contained flags values. Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value. ## iter_names ### Description Yield a set of contained named flags values. This method is like `iter`, except only yields bits in contained named flags. ## memory_formats ### Description Returns a list of selected memory formats. ## best_format_for ### Description Select the best contained format to represent the provided source format. ### Parameters #### Request Body - **src** (MemoryFormat) - Required - The source format to match against the selection. ### Response #### Success Response (200) - **result** (Option) - The best matching format, or None if no formats are selected. ``` -------------------------------- ### OperationId Enum - FromStr Implementation Source: https://docs.rs/glycin/3.1.0/glycin/enum.OperationId.html Allows converting a string slice into an OperationId variant. An example demonstrates parsing the 'Clip' variant. ```APIDOC ### impl FromStr for OperationId #### fn from_str(slice: &str) -> Result ```rust let id = OperationId::from_str("Clip").unwrap(); assert_eq!(id, OperationId::Clip) ``` #### type Err = Error The associated error which can be returned from parsing. ``` -------------------------------- ### Image Implementations Source: https://docs.rs/glycin/3.1.0/glycin/struct.Image.html Methods available for the Image struct. ```APIDOC ## impl Image ### pub async fn next_frame(&self) -> Result Loads next frame Loads texture and information of the next frame. For single still images, this can only be called once. For animated images, this function will loop to the first frame, when the last frame is reached. ### pub async fn specific_frame(&self, frame_request: FrameRequest) -> Result Loads a specific frame Loads a specific frame from the file. Loaders can ignore parts of the instructions in the `FrameRequest`. ### pub fn details(&self) -> ImageDetails Returns already obtained info ### pub fn mime_type(&self) -> MimeType Returns detected MIME type of the file ### pub fn file(&self) -> Option File the image was loaded from Is `None` if the file was loaded from a stream or binary data. ### pub fn cancellable(&self) -> Cancellable `Cancellable` to cancel operations within this image ### pub fn active_sandbox_mechanism(&self) -> SandboxMechanism Active sandbox mechanism ### pub fn transformation_orientation(&self) -> Orientation Tramsformations to be applied to orient image correctly If the `Loader::apply_transformations` has ben set to `false`, these transformations have to be applied to display the image correctly. Otherwise, they are applied automatically to the image after loading it. ``` -------------------------------- ### Get Frame Buffer Slice Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Retrieves a slice of the frame's raw byte buffer. This method is part of the Frame implementation. ```rust pub fn buf_slice(&self) -> &[u8] ``` -------------------------------- ### PoolConfig Configuration Source: https://docs.rs/glycin/3.1.0/glycin/struct.PoolConfig.html Methods for initializing and configuring the PoolConfig struct. ```APIDOC ## PoolConfig::new ### Description Creates a new instance of PoolConfig with default settings. ### Method Rust Constructor ## PoolConfig::max_parallel_operations ### Description Sets the maximum number of parallel operations allowed. ### Parameters #### Request Body - **max_parallel_operations** (usize) - Required - The maximum number of parallel operations to permit. ``` -------------------------------- ### Implement Clone for Operation Source: https://docs.rs/glycin/3.1.0/glycin/enum.Operation.html Provides methods to duplicate Operation values. `clone` creates a new value, while `clone_from` performs copy-assignment. ```rust fn clone(&self) -> Operation ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Implement Pointable Trait (deref) Source: https://docs.rs/glycin/3.1.0/glycin/struct.EditableImage.html Dereferences the given pointer to get an immutable reference. This is an unsafe operation and requires a valid pointer. ```rust unsafe fn deref<'a>(ptr: usize) -> &'a T ``` -------------------------------- ### Get Channel Type for MemoryFormat Source: https://docs.rs/glycin/3.1.0/glycin/enum.MemoryFormat.html Returns the ChannelType associated with a MemoryFormat variant. This method helps in understanding the underlying data type of the channels. ```rust pub const fn channel_type(self) -> ChannelType ``` -------------------------------- ### Operations Creation Source: https://docs.rs/glycin/3.1.0/glycin/struct.Operations.html Methods for creating new Operations instances. ```APIDOC ## Operations Creation ### `new(operations: Vec) -> Operations` Creates a new `Operations` instance from a vector of `Operation`. ### `new_orientation(orientation: Orientation) -> Operations` Creates a new `Operations` instance that applies a specified `Orientation`. ``` -------------------------------- ### TryFrom and TryInto Implementations Source: https://docs.rs/glycin/3.1.0/glycin/struct.Operations.html Traits for fallible type conversions. ```APIDOC ### impl TryFrom for T #### type Error = Infallible - **Description**: The type returned in the event of a conversion error. #### fn try_from(value: U) -> Result>::Error> ### Description Performs the conversion. ### Parameters #### Request Body - **value** (U) - Required - The value to convert. ### Response #### Success Response (200) - **Result>::Error>** - The result of the conversion. ``` ```APIDOC ### impl TryInto for T #### type Error = >::Error - **Description**: The type returned in the event of a conversion error. #### fn try_into(self) -> Result>::Error> ### Description Performs the conversion. ### Response #### Success Response (200) - **Result>::Error>** - The result of the conversion. ``` -------------------------------- ### Implement Pointable Trait (deref_mut) Source: https://docs.rs/glycin/3.1.0/glycin/struct.EditableImage.html Mutably dereferences the given pointer to get a mutable reference. This is an unsafe operation and requires a valid pointer. ```rust unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T ``` -------------------------------- ### MemoryFormatSelection Static Methods Source: https://docs.rs/glycin/3.1.0/glycin/struct.MemoryFormatSelection.html This section details the static methods available for creating and manipulating MemoryFormatSelection instances. ```APIDOC ## MemoryFormatSelection Static Methods ### Description Static methods for creating and manipulating MemoryFormatSelection. ### Methods - **empty()**: Returns a MemoryFormatSelection with all bits unset. - **all()**: Returns a MemoryFormatSelection with all known bits set. - **from_bits(bits: u32)**: Converts from a bits value. Returns `None` if any unknown bits are set. - **from_bits_truncate(bits: u32)**: Converts from a bits value, unsetting any unknown bits. - **from_bits_retain(bits: u32)**: Converts from a bits value exactly. - **from_name(name: &str)**: Gets a MemoryFormatSelection with the bits of a flag with the given name set. Returns `None` if `name` is empty or doesn’t correspond to any named flag. ``` -------------------------------- ### COMPAT_VERSION Constant Source: https://docs.rs/glycin/3.1.0/glycin/constant.COMPAT_VERSION.html Provides the compatibility version constant for the Glycin library. ```APIDOC ## COMPAT_VERSION ### Description A constant representing the compatibility version of the Glycin library. ### Value `pub const COMPAT_VERSION: u8 = 2;` ``` -------------------------------- ### SandboxMechanism Implementations Source: https://docs.rs/glycin/3.1.0/glycin/enum.SandboxMechanism.html Details on the implementations available for the SandboxMechanism enum. ```APIDOC ## Implementations ### impl SandboxMechanism #### pub async fn detect() -> Self Detects the current sandboxing mechanism. #### pub fn into_selector(self) -> SandboxSelector Converts the SandboxMechanism into a SandboxSelector. ``` -------------------------------- ### Get Frame Delay for Animations Source: https://docs.rs/glycin/3.1.0/glycin/struct.Frame.html Returns the duration to show the frame for animations. If the value is not set, the image is not animated. This method is part of the Frame implementation. ```rust pub fn delay(&self) -> Option ``` -------------------------------- ### Get Number of Channels for MemoryFormat Source: https://docs.rs/glycin/3.1.0/glycin/enum.MemoryFormat.html Returns the number of channels (e.g., R, G, B, A) for a given MemoryFormat variant. This is part of the MemoryFormatInfo trait. ```rust fn n_channels(self) -> u8 ``` -------------------------------- ### Implement Pointable Trait (init) Source: https://docs.rs/glycin/3.1.0/glycin/struct.EditableImage.html Initializes a with the given initializer. This is an unsafe operation and requires a valid initializer. ```rust unsafe fn init(init: ::Init) -> usize ``` -------------------------------- ### Get Binary Data from Edit Source: https://docs.rs/glycin/3.1.0/glycin/struct.Edit.html Retrieves the binary data associated with an `Edit` instance. This method is part of the `Edit` struct's direct implementations. ```rust pub fn data(&self) -> BinaryData ``` -------------------------------- ### WithSubscriber Implementation Source: https://docs.rs/glycin/3.1.0/glycin/struct.Operations.html Methods for attaching subscribers to a type. ```APIDOC ## fn with_subscriber(self, subscriber: S) -> WithDispatch ### Description Attaches the provided `Subscriber` to this type, returning a `WithDispatch` wrapper. ### Parameters #### Query Parameters - **subscriber** (S: Into) - Required - The subscriber to attach. ### Response #### Success Response (200) - **WithDispatch** - A wrapper containing the original type and the attached subscriber. ``` ```APIDOC ## fn with_current_subscriber(self) -> WithDispatch ### Description Attaches the current default `Subscriber` to this type, returning a `WithDispatch` wrapper. ### Response #### Success Response (200) - **WithDispatch** - A wrapper containing the original type and the attached subscriber. ``` -------------------------------- ### MemoryFormatSelection Implementations Source: https://docs.rs/glycin/3.1.0/glycin/struct.MemoryFormatSelection.html Details on the implementations for MemoryFormatSelection, including iterator support, formatting, and bitwise operations. ```APIDOC ## MemoryFormatSelection Implementations ### Description Details on the implementations for MemoryFormatSelection, including iterator support, formatting, and bitwise operations. ### `impl FromIterator` #### `from_iter(iterator: T) -> MemoryFormatSelection` where T: IntoIterator, The bitwise or (`|`) of the bits in each flags value. ### `impl IntoIterator for MemoryFormatSelection` #### `type Item = MemoryFormatSelection` The type of the elements being iterated over. #### `type IntoIter = Iter` Which kind of iterator are we turning this into? #### `into_iter(self) -> ::IntoIter` Creates an iterator from a value. ### `impl LowerHex for MemoryFormatSelection` #### `fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>` Formats the value using the given formatter. ### `impl Not for MemoryFormatSelection` #### `not(self) -> MemoryFormatSelection` The bitwise negation (`!`) of the bits in a flags value, truncating the result. #### `type Output = MemoryFormatSelection` The resulting type after applying the `!` operator. ### `impl Octal for MemoryFormatSelection` #### `fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>` Formats the value using the given formatter. ### `impl Sub for MemoryFormatSelection` #### `sub(self, other: MemoryFormatSelection) -> MemoryFormatSelection` The intersection of a source flags value with the complement of a target flags value (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `difference` won’t truncate `other`, but the `!` operator will. #### `type Output = MemoryFormatSelection` The resulting type after applying the `-` operator. ### `impl SubAssign for MemoryFormatSelection` #### `sub_assign(&mut self, other: MemoryFormatSelection)` The intersection of a source flags value with the complement of a target flags value (`&!`). This method is not equivalent to `self & !other` when `other` has unknown bits set. `difference` won’t truncate `other`, but the `!` operator will. ``` -------------------------------- ### Generic Blanket Implementations for T Source: https://docs.rs/glycin/3.1.0/glycin/struct.MemoryFormatSelection.html Demonstrates blanket implementations of common traits for any type T, showcasing generic programming capabilities. ```APIDOC ### impl Any for T #### fn type_id(&self) -> TypeId Gets the `TypeId` of `self`. ### impl Borrow for T #### fn borrow(&self) -> &T Immutably borrows from an owned value. ### impl BorrowMut for T #### fn borrow_mut(&mut self) -> &mut T Mutably borrows from an owned value. ### impl CloneToUninit for T #### unsafe fn clone_to_uninit(&self, dest: *mut u8) 🔬This is a nightly-only experimental API. (`clone_to_uninit`) Performs copy-assignment from `self` to `dest`. ### impl From for T #### fn from(t: T) -> T Returns the argument unchanged. ### impl Instrument for T #### fn instrument(self, span: Span) -> Instrumented Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. #### fn in_current_span(self) -> Instrumented Instruments this type with the current `Span`, returning an `Instrumented` wrapper. ### impl Into for T #### fn into(self) -> U Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ### impl IntoEither for T #### fn into_either(self, into_left: bool) -> Either Converts `self` into a `Left` variant of `Either` if `into_left` is `true`. Converts `self` into a `Right` variant of `Either` otherwise. #### fn into_either_with(self, into_left: F) -> Either Converts `self` into a `Left` variant of `Either` if `into_left(&self)` returns `true`. Converts `self` into a `Right` variant of `Either` otherwise. ### impl NoneValue for T #### type NoneType = T #### fn null_value() -> T The none-equivalent value. ### impl Pointable for T #### const ALIGN: usize The alignment of pointer. #### type Init = T The type for initializers. #### unsafe fn init(init: ::Init) -> usize Initializes a with the given initializer. #### unsafe fn deref<'a>(ptr: usize) -> &'a T Dereferences the given pointer. #### unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T Mutably dereferences the given pointer. #### unsafe fn drop(ptr: usize) Drops the object pointed to by the given pointer. ### impl ToOwned for T #### type Owned = T The resulting type after obtaining ownership. #### fn to_owned(&self) -> T Creates owned data from borrowed data, usually by cloning. #### fn clone_into(&self, target: &mut T) Uses borrowed data to replace owned data, usually by cloning. ### impl TryFrom for T #### type Error = Infallible The type returned in the event of a conversion error. #### fn try_from(value: U) -> Result>::Error> Performs the conversion. ### impl TryInto for T #### type Error = >::Error The type returned in the event of a conversion error. #### fn try_into(self) -> Result>::Error> Performs the conversion. ### impl WithSubscriber for T #### fn with_subscriber(self, subscriber: S) -> WithDispatch Attaches the provided `Subscriber` to this type, returning a `WithDispatch` wrapper. #### fn with_current_subscriber(self) -> WithDispatch Attaches the current default `Subscriber` to this type, returning a `WithDispatch` wrapper. ``` -------------------------------- ### TryFrom and TryInto Trait Implementations Source: https://docs.rs/glycin/3.1.0/glycin/enum.OperationId.html Implementations for `TryFrom` and `TryInto` traits, enabling fallible conversions between types. ```APIDOC ### impl TryFrom for T where U: Into, #### type Error = Infallible ### Description The type returned in the event of a conversion error. #### fn try_from(value: U) -> Result>::Error> ### Description Performs the conversion. ### Method fn ### Endpoint N/A (Function) ### impl TryInto for T where U: TryFrom, #### type Error = >::Error ### Description The type returned in the event of a conversion error. #### fn try_into(self) -> Result>::Error> ### Description Performs the conversion. ### Method fn ### Endpoint N/A (Function) ``` -------------------------------- ### Glycin Features Source: https://docs.rs/glycin/3.1.0/glycin/index.html Overview of available features for the glycin crate, such as gdk4 integration and tokio compatibility. ```APIDOC ## Features - **`gdk4`**: Enables interoperability with `gdk4` by allowing direct retrieval of `gdk::Texture` objects. - **`tokio`**: Makes glycin compatible with `zbus` by integrating with the `tokio` runtime. ### Description These features allow customization of glycin's functionality. Enabling `gdk4` provides seamless integration with GTK4 applications, while the `tokio` feature is useful for asynchronous operations within a `tokio` environment. ``` -------------------------------- ### Memory Management API Source: https://docs.rs/glycin/3.1.0/glycin/struct.Loader.html Functions for initializing, dereferencing, and dropping pointers within the Glycin memory model. ```APIDOC ## Memory Management Functions ### init - **Signature**: unsafe fn init(init: ::Init) -> usize - **Description**: Initializes a type with the given initializer. ### deref - **Signature**: unsafe fn deref<'a>(ptr: usize) -> &'a T - **Description**: Dereferences the given pointer. ### deref_mut - **Signature**: unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T - **Description**: Mutably dereferences the given pointer. ### drop - **Signature**: unsafe fn drop(ptr: usize) - **Description**: Drops the object pointed to by the given pointer. ``` -------------------------------- ### FrameRequest Configuration Source: https://docs.rs/glycin/3.1.0/glycin/struct.FrameRequest.html Methods available for configuring a FrameRequest instance. ```APIDOC ## FrameRequest Configuration ### Description Methods to configure the parameters for a frame request, such as dimensions, clipping area, and animation settings. ### Methods - **new() -> Self**: Creates a new instance of FrameRequest. - **scale(width: u32, height: u32) -> Self**: Sets the target dimensions for the frame. - **clip(x: u32, y: u32, width: u32, height: u32) -> Self**: Sets the clipping rectangle for the frame. - **loop_animation(loop_animation: bool) -> Self**: Controls if the animation loops back to the first frame after the last frame. Defaults to true. ``` -------------------------------- ### BinaryData Trait Implementations Source: https://docs.rs/glycin/3.1.0/glycin/struct.BinaryData.html Standard trait implementations for BinaryData, including file descriptor access and serialization. ```APIDOC ## BinaryData Trait Implementations ### Description BinaryData implements several standard traits for interoperability. ### Traits - **AsRawFd** - Provides `as_raw_fd() -> i32` to extract the raw file descriptor. - **Clone** - Provides `clone()` and `clone_from()` for duplicating the data. - **Serialize / Deserialize** - Supports Serde serialization and deserialization. - **From** - Allows conversion from an `OwnedFd` type. ``` -------------------------------- ### Into Trait Source: https://docs.rs/glycin/3.1.0/glycin/enum.MemoryFormat.html Enables conversion from one type to another if a `From` implementation exists. ```APIDOC ## impl Into for T ### Description Allows conversion into another type `U` if `U` implements `From`. ### Methods #### fn into(self) -> U Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ``` -------------------------------- ### Implement StructuralPartialEq for EditOutcome Source: https://docs.rs/glycin/3.1.0/glycin/enum.EditOutcome.html Provides structural equality comparison for the EditOutcome enum. This is often used in generic contexts where structural comparison is needed. ```rust impl StructuralPartialEq for EditOutcome {} ```