### Basic mplus! macro usage Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/macro.mplus.html Examples demonstrating various configurations for the mplus! macro, including weight aliases and character range specifications. ```rust mplus!(1, 750, x_height(5), false, 2, 4, ["Yes", "No"]); mplus!(1, 525, cap_height(7), false, 2, 4, ["キャンセル"]); mplus!(2, BOLD, line_height(20), false, 2, 4, ["Tokyo"], ["東京"]); mplus!(2, 575, line_height(20), true, 4, 4, kern(' '..='ȷ', ["ffi", "ffl"])); mplus!(code(100), SEMI_BOLD, 18, true, 1, 4, '0'..='9', [",.-"]); mplus!(code(125), 480, 13.5, true, 1, 4, 'A'..='Z', 'ぁ'..='ゖ'); ``` -------------------------------- ### All-inclusive bitmap font generation Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/macro.mplus.html Examples for generating large-scale bitmap fonts using the .. range operator, which significantly increases the output binary size. ```rust mplus!(1, 500, 50, true, 4, 8, .., ["ff", "fi", "ffi", "fl", "ffl"]); mplus!(1, 500, 50, true, 4, 8, kern(.., ["ffi", "ffl"])); ``` -------------------------------- ### BitmapFontStyleBuilder Configuration Methods Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyleBuilder.html Methods for configuring text color, background color, and decorations. ```APIDOC ## Configuration Methods - **reset_text_color()** - Resets the text color to the default value. - **reset_background_color()** - Resets the background color to the default value. - **reset_underline()** - Removes the underline decoration. - **reset_strikethrough()** - Removes the strikethrough decoration. - **underline()** - Enables underline using the text color. - **strikethrough()** - Enables strikethrough using the text color. - **text_color(text_color: T)** - Sets the text color to the specified value. - **background_color(background_color: T)** - Sets the background color to the specified value. - **underline_with_color(underline_color: T)** - Enables underline using a custom color. - **strikethrough_with_color(strikethrough_color: T)** - Enables strikethrough using a custom color. ``` -------------------------------- ### BitmapFontStyle Constructor Methods Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html Methods to instantiate a new BitmapFontStyle or create a default instance. ```rust pub const fn new(font: &'b BitmapFont<'a, C, N>, text_color: T) -> Self ``` ```rust pub const fn const_default() -> Self ``` -------------------------------- ### BitmapFontStyleBuilder::build Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyleBuilder.html Finalizes the builder and returns the configured style. ```APIDOC ## pub const fn build(self) -> BitmapFontStyle<'a, 'b, T, C, N> ### Description Consumes the builder and returns the final BitmapFontStyle object. ``` -------------------------------- ### Image Implementation Methods Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.Image.html Methods for creating and manipulating Image instances, including clipping and offset adjustments. ```rust pub const NULL: Self ``` ```rust pub const fn new(image_drawable: T, offset: Point) -> Self ``` ```rust pub fn clipped(&self, area: &Rectangle) -> Image> ``` ```rust pub fn add_offset(&self, x: i32, y: i32) -> Self ``` ```rust pub fn mul_offset(&self, x: i32, y: i32) -> Self ``` -------------------------------- ### BitmapFontMetrics Implementation Methods Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/struct.BitmapFontMetrics.html Methods for retrieving font metrics and calculating layout offsets. ```rust pub const NULL: Self ``` ```rust pub const fn y_offset(&self, baseline: Baseline) -> i32 ``` ```rust pub const fn line_height(&self) -> u32 ``` -------------------------------- ### BitmapFontStyleBuilder::new Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyleBuilder.html Creates a new, empty builder instance for configuring bitmap font styles. ```APIDOC ## pub const fn new() -> Self ### Description Creates a new, empty builder using text and background colors of type T. ``` -------------------------------- ### BitmapFontStyle::const_default Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html Creates a new BitmapFontStyle instance with default settings. ```APIDOC ## pub const fn const_default() -> Self ### Description Creates a new style with the invisible bitmap font, the default text and background colors, which are not specified, as are the decoration colors for text underline and strikethrough. ``` -------------------------------- ### BitmapFontStyle::new Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html Creates a new BitmapFontStyle instance with the specified bitmap font and text color. ```APIDOC ## pub const fn new(font: &'b BitmapFont<'a, C, N>, text_color: T) -> Self ### Description Creates a new style with the specified bitmap font and text color. ### Parameters - **font** (&'b BitmapFont<'a, C, N>) - The bitmap font to use. - **text_color** (T) - The text color to apply. ``` -------------------------------- ### CharacterStyle Trait Methods Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html Methods for configuring the visual style of text, including colors for text, background, underline, and strikethrough. ```APIDOC ## set_text_color(text_color: Option) ### Description Sets the text color for the font style. ## set_background_color(background_color: Option) ### Description Sets the background color for the font style. ## set_underline_color(underline_color: DecorationColor) ### Description Sets the underline color for the font style. ## set_strikethrough_color(strikethrough_color: DecorationColor) ### Description Sets the strikethrough color for the font style. ``` -------------------------------- ### Apply strings attribute macro Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/attr.strings.html Demonstrates applying #[strings] to a function, using #[strings::emit] to inject collected strings into an mplus! macro, and #[strings::skip] to exclude specific items. ```rust #[mplusfonts::strings] pub fn main() -> Result<(), Infallible> { let mut display: SimulatorDisplay = SimulatorDisplay::new(Size::new(120, 120)); #[strings::emit] let bitmap_font = mplus!(2, 480, 16, true, 4, 8, /* will inject ["It works!"] here */); let character_style = BitmapFontStyle::new(&bitmap_font, Rgb888::new(0, 210, 255)); Text::new("It works!", Point::new(0, 120), character_style).draw(&mut display)?; let output_settings = OutputSettingsBuilder::new().scale(6).pixel_spacing(2).build(); #[strings::skip] Window::new("Simulator", &output_settings).show_static(&display); Ok(()) } ``` -------------------------------- ### Create a fixed-width bitmap font Source: https://docs.rs/mplusfonts Initializes a bitmap font with specific typeface, weight, size, and character set parameters. ```rust let bitmap_font = mplus!(code(100), 500, 12, false, 1, 8, '0'..='9', 'A'..='F', ["x"]); ``` -------------------------------- ### Colormap::first Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/color/struct.Colormap.html Returns the first element of the colormap. ```APIDOC ## pub const fn first(&self) -> T ### Description Returns the first element of the colormap. ``` -------------------------------- ### BitmapFontMetrics Methods Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/struct.BitmapFontMetrics.html Methods available on the BitmapFontMetrics struct for calculating font layout values. ```APIDOC ## pub const fn y_offset(&self, baseline: Baseline) -> i32 ### Description Returns the y-offset for the specified text baseline in pixels. ## pub const fn line_height(&self) -> u32 ### Description Returns the line height in pixels. ``` -------------------------------- ### ImageSet::get Method Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/enum.ImageSet.html Retrieves an image from the set, handling index wrapping for array variants. ```rust pub const fn get(&self, index: usize) -> &Image> ``` -------------------------------- ### Colormap::get Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/color/struct.Colormap.html Returns the color mapped to the specified gray value. ```APIDOC ## pub fn get(&self, color: ColorType) -> T ### Description Returns the color that is mapped to the specified gray value. Supported input types include BinaryColor, Gray2, Gray4, and Gray8 depending on the Colormap size. ``` -------------------------------- ### with_colormap Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/trait.WithColormap.html Associates a colormap with the image, returning an output type that represents the image with the applied colormap. ```APIDOC ## fn with_colormap<'b>(&'a self, colormap: &'b Colormap) -> Self::Output<'b> ### Description Returns the association with a colormap, which then belongs to the image. ### Parameters - **colormap** (&'b Colormap) - Required - The colormap to associate with the image. ### Returns - **Self::Output<'b>** - The resulting image association with the provided colormap. ``` -------------------------------- ### Screen Trait Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/color/trait.Screen.html The core trait definition for implementing the screen blend mode. ```rust pub trait Screen { // Required method fn screen(self, other: Self, start: Self, end: Self) -> Self; } ``` -------------------------------- ### BitmapFontMetrics Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/struct.BitmapFontMetrics.html The structure definition containing font metric fields as f32 values. ```rust pub struct BitmapFontMetrics { pub top: f32, pub ascender: f32, pub cap_height: f32, pub x_height: f32, pub baseline: f32, pub descender: f32, pub bottom: f32, } ``` -------------------------------- ### WithColormapImage Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.WithColormapImage.html The definition of the WithColormapImage struct, requiring specific trait bounds for pixel colors and image drawables. ```rust pub struct WithColormapImage<'a, 'b, U, T, const N: usize> where T: PixelColor + Default + Invert + Screen + WeightedAvg, U: ImageDrawable + Colors, { /* private fields */ } ``` -------------------------------- ### BitmapFont Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/struct.BitmapFont.html The primary structure definition for BitmapFont, requiring specific trait bounds for pixel colors and raw data iteration. ```rust pub struct BitmapFont<'a, C, const N: usize> where C: PixelColor + From, RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator, { pub charmap: Charmap<'a, C, N>, pub metrics: BitmapFontMetrics, pub underline: DecorationDimensions, pub strikethrough: DecorationDimensions, } ``` -------------------------------- ### line_height Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html Returns the default line height for the font style. ```APIDOC ## fn line_height(&self) -> u32 ### Description Returns the default line height in pixels. ``` -------------------------------- ### BitmapFontStyle Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html The structure definition for BitmapFontStyle, requiring specific trait bounds for colors and font data. ```rust pub struct BitmapFontStyle<'a, 'b, T, C, const N: usize> where C: PixelColor + From, T: PixelColor + Default + Invert + Screen + WeightedAvg, RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator, { pub font: &'b BitmapFont<'a, C, N>, pub text_color: Option, pub background_color: Option, pub underline_color: DecorationColor, pub strikethrough_color: DecorationColor, /* private fields */ } ``` -------------------------------- ### mplus! Source: https://docs.rs/mplusfonts The mplus! macro is used to generate a BitmapFont struct expression. It allows configuration of typeface, weight, size, hinting, quantization levels, and character inclusion. ```APIDOC ## mplus!(typeface, weight, size, hinting, pos_quant, gray_quant, ...) ### Description Produces a struct expression for creating a `BitmapFont` instance. ### Parameters - **typeface** (expression) - The font family (e.g., code(100) or 2). - **weight** (integer) - Font weight (e.g., 500). - **size** (integer) - Font size in pixels per em-size. - **hinting** (boolean) - Enable or disable font hinting. - **pos_quant** (integer) - Quantization level for positions per pixel. - **gray_quant** (integer) - Quantization level for gray values (bits per pixel). - **...** (char ranges/strings) - Characters or strings to include in the font data. ### Example ```rust let bitmap_font = mplus!(code(100), 500, 12, false, 1, 8, '0'..='9', 'A'..='F', ["x"]); ``` ``` -------------------------------- ### mplus Macro Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/macro.mplus.html The procedural macro signature for generating bitmap font data structures. ```rust mplus!() { /* proc-macro */ } ``` -------------------------------- ### BitmapFontStyleBuilder struct definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyleBuilder.html The definition of the BitmapFontStyleBuilder struct with its generic constraints. ```rust pub struct BitmapFontStyleBuilder<'a, 'b, T, C, const N: usize> where C: PixelColor + From, T: PixelColor + Default + Invert + Screen + WeightedAvg, RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator, { /* private fields */ } ``` -------------------------------- ### strings Source: https://docs.rs/mplusfonts The strings attribute macro collects string literals from the code to automatically inject them into mplus! macro invocations. ```APIDOC ## #[mplusfonts::strings] ### Description Collects string literals for rewriting `mplus!` macro invocations prior to their expansion, ensuring required characters are included in the generated font. ### Usage Annotate a function containing `mplus!` calls with `#[mplusfonts::strings]` and use `#[strings::emit]` on the `mplus!` invocation to inject strings. ``` -------------------------------- ### WithColormapImageMix struct definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.WithColormapImageMix.html The definition of the WithColormapImageMix struct, requiring specific trait bounds for pixel colors and image drawables. ```rust pub struct WithColormapImageMix<'a, 'b, 'c, 'd, U, V, T, const N: usize> where T: PixelColor + Default + Invert + Screen + WeightedAvg, U: ImageDrawable + Colors, V: ImageDrawable + Colors, { /* private fields */ } ``` -------------------------------- ### measure_string Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html Calculates the metrics for a given string. ```APIDOC ## fn measure_string(&self, text: &str, position: Point, baseline: Baseline) -> TextMetrics ### Description Returns the TextMetrics for a string at the specified position and baseline without drawing it. ### Parameters - **text** (&str) - The string to measure. - **position** (Point) - The reference position. - **baseline** (Baseline) - The baseline alignment. ``` -------------------------------- ### draw_string Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html Draws a string to the specified target at a given position and baseline. ```APIDOC ## fn draw_string(&self, text: &str, position: Point, baseline: Baseline, target: &mut D) -> Result ### Description Draws a string to the provided draw target. Returns the resulting position after drawing. ### Parameters - **text** (&str) - The string to draw. - **position** (Point) - The starting position for the text. - **baseline** (Baseline) - The baseline alignment for the text. - **target** (&mut D) - The draw target to render onto. ``` -------------------------------- ### ImageRaw::new Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.ImageRaw.html Creates a new image drawable with the specified raw data and image width. ```APIDOC ## pub const fn new(data: &'a [u8], width: u32) -> Self ### Description Creates a new image drawable with the specified raw data and image width. ### Parameters - **data** (&'a [u8]) - Required - The raw image data. - **width** (u32) - Required - The width of the image. ``` -------------------------------- ### BitmapFontStyleBuilder::font Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyleBuilder.html Sets the bitmap font for the style. ```APIDOC ## pub const fn font<'z, D, const M: usize>(self, font: &'z BitmapFont<'a, D, M>) -> BitmapFontStyleBuilder<'a, 'z, T, D, M> ### Description Consumes the builder and returns a new one configured with the specified bitmap font. ``` -------------------------------- ### Define DecorationDimensions struct Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/struct.DecorationDimensions.html The core structure representing decoration dimensions with offset and height fields. ```rust pub struct DecorationDimensions { pub offset: f32, pub height: f32, } ``` -------------------------------- ### strings Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/index.html The strings attribute macro collects string literals for rewriting mplus! macro invocations prior to their expansion, ensuring only necessary characters are included. ```APIDOC ## #[mplusfonts::strings] ### Description An attribute macro used to collect string literals within a function to automatically inject them into an `mplus!` macro invocation. ``` -------------------------------- ### CharmapEntry Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/struct.CharmapEntry.html The primary structure definition for CharmapEntry, including its generic constraints and fields. ```rust pub struct CharmapEntry<'a, C, const N: usize> where C: PixelColor + From, RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator, { pub key: CharmapEntryKey<'a>, pub advance_chars: usize, pub advance_width_to: fn(CharmapEntryKey<'a>) -> f32, pub glyph: Glyph<'a, C, N>, } ``` -------------------------------- ### ImageRaw::draw Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.ImageRaw.html Draws the entire image to the provided target. ```APIDOC ## fn draw(&self, target: &mut D) -> Result<(), D::Error> ### Description Draws the entire image to the target. ### Parameters - **target** (&mut D) - Required - The draw target to render the image onto. ``` -------------------------------- ### TextRenderer Trait Methods Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html Methods for rendering text and measuring dimensions on a draw target. ```APIDOC ## draw_string(text: &str, position: Point, baseline: Baseline, target: &mut D) -> Result ### Description Draws a string to the specified target at the given position and baseline. ## draw_whitespace(width: u32, position: Point, baseline: Baseline, target: &mut D) -> Result ### Description Draws whitespace of the specified width. ## measure_string(text: &str, position: Point, baseline: Baseline) -> TextMetrics ### Description Returns the text metrics for a given string. ## line_height() -> u32 ### Description Returns the default line height for the font style. ``` -------------------------------- ### Glyph Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/glyph/struct.Glyph.html The definition of the Glyph struct, including its generic parameters and fields. ```rust pub struct Glyph<'a, C, const N: usize> where C: PixelColor + From, RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator, { pub id: GlyphId, pub images: ImageSet<'a, C, N>, pub next: Option<&'a NextGlyph<'a, C, N>>, } ``` -------------------------------- ### ImageRaw::size Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.ImageRaw.html Returns the size of the bounding box of the image. ```APIDOC ## fn size(&self) -> Size ### Description Returns the size of the bounding box. ``` -------------------------------- ### draw_whitespace Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/style/struct.BitmapFontStyle.html Draws whitespace of a specified width to the target. ```APIDOC ## fn draw_whitespace(&self, width: u32, position: Point, baseline: Baseline, target: &mut D) -> Result ### Description Draws whitespace of the given width at the specified position and baseline. ### Parameters - **width** (u32) - The width of the whitespace to draw. - **position** (Point) - The starting position. - **baseline** (Baseline) - The baseline alignment. - **target** (&mut D) - The draw target. ``` -------------------------------- ### WithColormap Trait Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/trait.WithColormap.html The trait definition including the required Output associated type and the with_colormap method. ```rust pub trait WithColormap<'a, T: Copy, const N: usize> { type Output<'b> where T: 'b, Self: 'a; // Required method fn with_colormap<'b>( &'a self, colormap: &'b Colormap, ) -> Self::Output<'b>; } ``` -------------------------------- ### ImageSet::get Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/enum.ImageSet.html Retrieves an image from the ImageSet at the specified index. If the variant is Repeated, it returns the single image. If the variant is Array, it returns the image at the given index, wrapping if the index exceeds the array length. ```APIDOC ## pub const fn get(&self, index: usize) -> &Image> ### Description Returns either the single repeated image or the image at the specified index, wrapping if greater than or equal to the length of the array. ### Parameters - **index** (usize) - Required - The index of the image to retrieve. ``` -------------------------------- ### Charmap::get Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/enum.Charmap.html Finds the charmap entry for a given input string by traversing branch nodes and matching characters until a leaf node is reached. ```APIDOC ## fn get(&self, slice: &str) -> &CharmapEntry<'a, C, N> ### Description Finds the charmap entry for a given input, traversing the branch nodes while also matching characters from the specified string slice until a leaf node is found. ### Parameters - **slice** (&str) - Required - The input string slice to match against the charmap. ### Returns - **&CharmapEntry<'a, C, N>** - The resulting charmap entry found after traversal. ``` -------------------------------- ### Image Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.Image.html The primary structure definition for Image, which is generic over types implementing ImageDrawable. ```rust pub struct Image { /* private fields */ } ``` -------------------------------- ### NextGlyph Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/glyph/struct.NextGlyph.html The definition of the NextGlyph struct, including its generic parameters and field members. ```rust pub struct NextGlyph<'a, C, const N: usize> where C: PixelColor + From, RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator, { pub x_offset: f32, pub y_offset: f32, pub glyph: Glyph<'a, C, N>, } ``` -------------------------------- ### Colormap::last Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/color/struct.Colormap.html Returns the last element of the colormap. ```APIDOC ## pub const fn last(&self) -> T ### Description Returns the last element of the colormap. ``` -------------------------------- ### fn mixed Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/trait.Mixed.html Returns the image drawable’s intersection with the specified image, color-mixed in the resulting area. ```APIDOC ## fn mixed<'b, 'c, V>(&'a self, other: &'b Image, colormap: &'c Colormap) -> Self::Output<'b, 'c, V> ### Description Returns the image drawable’s intersection with the specified image, color-mixed in the resulting area. ### Parameters - **other** (&'b Image) - Required - The other image drawable to intersect and mix with. - **colormap** (&'c Colormap) - Required - The colormap used for the mixing process. ``` -------------------------------- ### ImageMix Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.ImageMix.html The definition of the ImageMix struct, requiring generic types that implement color and image drawable traits. ```rust pub struct ImageMix<'a, 'b, 'c, U, V, T, const N: usize> where T: PixelColor + Default + Invert + Screen + WeightedAvg, U: ImageDrawable + Colors, V: ImageDrawable + Colors, { /* private fields */ } ``` -------------------------------- ### BitmapFontMetrics Struct Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/struct.BitmapFontMetrics.html The BitmapFontMetrics struct defines the vertical layout properties of a bitmap font. ```APIDOC ## struct BitmapFontMetrics ### Fields - **top** (f32) - The top of the line. - **ascender** (f32) - Typographic ascender. - **cap_height** (f32) - The top of capital letters. - **x_height** (f32) - The top of the small letter x. - **baseline** (f32) - The baseline. - **descender** (f32) - Typographic descender. - **bottom** (f32) - The bottom of the line. ``` -------------------------------- ### fn invert(self) -> Self Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/color/trait.Invert.html The invert method is a required function of the Invert trait that returns the inverse of the color instance it is called upon. ```APIDOC ## fn invert(self) -> Self ### Description Returns the inverse of the specified color. This method is implemented for various color types including Bgr555, Bgr565, Bgr666, Bgr888, BinaryColor, Gray2, Gray4, Gray8, Rgb555, Rgb565, Rgb666, and Rgb888. ### Signature `fn invert(self) -> Self` ### Notes This trait is not dyn compatible. ``` -------------------------------- ### sub_image Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/trait.ImageDrawableExt.html Returns the image drawable’s sub-image with the specified area. ```APIDOC ## fn sub_image(&self, area: &Rectangle) -> SubImage<'_, Self> ### Description Returns the image drawable’s sub-image with the specified area. ### Parameters - **area** (&Rectangle) - Required - The rectangular area to extract from the image. ### Returns - **SubImage<'_, Self>** - A sub-image drawable referencing the specified area. ``` -------------------------------- ### ImageDrawableExt Trait Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/trait.ImageDrawableExt.html The trait definition for ImageDrawableExt, which requires the implementation of the sub_image method. ```rust pub trait ImageDrawableExt: Sized { // Required method fn sub_image(&self, area: &Rectangle) -> SubImage<'_, Self>; } ``` -------------------------------- ### Invert Trait Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/color/trait.Invert.html The core trait definition for color inversion. ```rust pub trait Invert { // Required method fn invert(self) -> Self; } ``` -------------------------------- ### Mixed Trait Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/trait.Mixed.html The core trait definition for performing color-mixing operations between image drawables. ```rust pub trait Mixed<'a, U, T, C, const N: usize> where C: PixelColor + From, T: PixelColor + Default + Invert + Screen + WeightedAvg, U: ImageDrawable + Colors, { type Output<'b, 'c, V> where T: 'c, V: ImageDrawable + Colors + 'b, Self: 'a; // Required method fn mixed<'b, 'c, V>( &'a self, other: &'b Image, colormap: &'c Colormap, ) -> Self::Output<'b, 'c, V> where V: ImageDrawable + Colors; } ``` -------------------------------- ### Linear Trait Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/color/trait.Linear.html The core trait definition requiring a linear method to generate a gradient between two colors. ```rust pub trait Linear { // Required method fn linear(start: T, end: T) -> Self; } ``` -------------------------------- ### Define the WeightedAvg trait Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/color/trait.WeightedAvg.html The trait definition requires implementing the weighted_avg method to perform the weighted arithmetic mean calculation. ```rust pub trait WeightedAvg { // Required method fn weighted_avg( self, other: Self, start: Self, end: Self, other_start: Self, other_end: Self, ) -> Self; } ``` -------------------------------- ### Charmap Enum Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/enum.Charmap.html The core definition of the Charmap enum, which uses generic parameters for pixel color and raw data handling. ```rust pub enum Charmap<'a, C, const N: usize> where C: PixelColor + From, RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator, { Leaf(CharmapEntry<'a, C, N>), Branch(fn(char) -> &'a Charmap<'a, C, N>), } ``` -------------------------------- ### ImageRaw::draw_sub_image Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.ImageRaw.html Draws a specific part of the image to the target. ```APIDOC ## fn draw_sub_image( &self, target: &mut D, area: &Rectangle, ) -> Result<(), D::Error> ### Description Draws a part of the image to the target. ### Parameters - **target** (&mut D) - Required - The draw target to render the image onto. - **area** (&Rectangle) - Required - The rectangular area of the image to draw. ``` -------------------------------- ### CharmapEntryKey Type Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/type.CharmapEntryKey.html Defines CharmapEntryKey as a borrowed string slice with a lifetime parameter. ```rust pub type CharmapEntryKey<'a> = &'a str; ``` -------------------------------- ### Define GlyphId type alias Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/glyph/type.GlyphId.html Represents a glyph identifier as a 16-bit unsigned integer. ```rust pub type GlyphId = u16; ``` -------------------------------- ### ImageSet Enum Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/enum.ImageSet.html Defines the structure of ImageSet, supporting both repeated images and fixed-size arrays of images. ```rust pub enum ImageSet<'a, C, const N: usize> where C: PixelColor + From, RawDataSlice<'a, C::Raw, BigEndian>: IntoIterator, { Repeated(Image>), Array([Image>; N]), } ``` -------------------------------- ### Define ImageRaw struct Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.ImageRaw.html The definition of the ImageRaw struct, which requires a pixel color type C that can be converted from its raw representation. ```rust pub struct ImageRaw<'a, C> where C: PixelColor + From, { /* private fields */ } ``` -------------------------------- ### ImageDrawableExt::sub_image Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.SubImage.html Returns a sub-image of the current image drawable based on the provided rectangular area. ```APIDOC ## fn sub_image(&self, area: &Rectangle) -> SubImage<'_, T> ### Description Returns the image drawable’s sub-image with the specified area. ### Parameters - **area** (&Rectangle) - Required - The rectangular area defining the bounds of the sub-image. ### Returns - **SubImage<'_, T>** - A new SubImage instance representing the specified area of the original drawable. ``` -------------------------------- ### SubImage Struct Definition Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/struct.SubImage.html The definition of the SubImage struct, which holds a reference to an area of another image drawable. ```rust pub struct SubImage<'a, T> { /* private fields */ } ``` -------------------------------- ### Define the Colors trait Source: https://docs.rs/mplusfonts/0.3.4/mplusfonts/image/trait.Colors.html The trait requires the implementation of the colors method, which returns an iterator over items of type T. ```rust pub trait Colors { // Required method fn colors(&self) -> impl IntoIterator; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.