### pub fn parse(data: &[u8]) -> Result<(Vec, Vec<(u8, u8, u8)>), Error> Source: https://docs.rs/rustitch/0.2.2/rustitch/pec/fn.parse.html Parses a standalone PEC file starting with the #PEC0001 prefix. ```APIDOC ## Function: parse ### Description Parses a standalone PEC file that includes the '#PEC0001' prefix followed by PEC data. ### Signature `pub fn parse(data: &[u8]) -> Result<(Vec, Vec<(u8, u8, u8)>), Error>` ### Parameters - **data** (&[u8]) - The raw byte slice containing the PEC file content. ### Returns - **Result** - A Result containing a tuple of (Vec, Vec<(u8, u8, u8)>) on success, or an Error on failure. ``` -------------------------------- ### parse Source: https://docs.rs/rustitch/0.2.2/rustitch/pec/index.html Parses a standalone PEC file starting with the #PEC0001 prefix. ```APIDOC ## parse ### Description Parses a standalone PEC file that begins with the #PEC0001 prefix followed by the PEC data. ``` -------------------------------- ### pub fn parse(data: &[u8]) -> Result<(Vec, Vec<(u8, u8, u8)>), Error> Source: https://docs.rs/rustitch/0.2.2/rustitch/sew/fn.parse.html Parses a SEW (Janome) embroidery file from a byte slice. The function processes the file structure including color counts, thread palette indices, and stitch data starting at offset 0x1D78. ```APIDOC ## Function: parse ### Description Parses a SEW (Janome) embroidery file. The function interprets the file format, including the color count, thread palette, and stitch data sequence. ### Signature `pub fn parse(data: &[u8]) -> Result<(Vec, Vec<(u8, u8, u8)>), Error>` ### Parameters - **data** (&[u8]) - The raw byte data of the SEW file. ### Returns - **Result** - A Result containing a tuple of a vector of `StitchCommand` objects and a vector of thread palette indices (represented as RGB tuples), or an `Error` if parsing fails. ### File Format Details - **Color Count**: u16 LE at offset 0x00. - **Thread Palette**: color_count × u16 LE indices at offset 0x02. - **Stitch Data**: Located at fixed offset 0x1D78. - **Control Logic**: Uses escape byte 0x80 followed by control bytes for color changes, jumps/moves, and normal stitches. ``` -------------------------------- ### parse_pec_header Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/pec/fn.parse_pec_header.html Parses the PEC header starting at the PEC section offset. Returns the header and the byte offset (relative to pec_data start) where stitch data begins. ```APIDOC ## Function: parse_pec_header ### Description Parses the PEC header starting at the PEC section offset. Returns the header and the byte offset (relative to pec_data start) where stitch data begins. ### Signature `pub fn parse_pec_header(pec_data: &[u8]) -> Result<(PecHeader, usize), Error>` ### Parameters - **pec_data** (&[u8]) - The byte slice containing the PEC data to be parsed. ### Returns - **Result<(PecHeader, usize), Error>** - A Result containing a tuple with the parsed `PecHeader` and the `usize` byte offset where the stitch data begins, or an `Error` if parsing fails. ``` -------------------------------- ### parse_pec_header Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/pec/index.html Parses the PEC header starting at the PEC section offset. ```APIDOC ## parse_pec_header ### Description Parses the PEC header starting at the PEC section offset. Returns the header and the byte offset (relative to pec_data start) where stitch data begins. ### Signature `pub fn parse_pec_header(data: &[u8]) -> (PecHeader, usize)` ``` -------------------------------- ### pub fn thumbnail_format(data: &[u8], size: u32, fmt: Format) -> Result, Error> Source: https://docs.rs/rustitch/0.2.2/rustitch/fn.thumbnail_format.html Parses input image data and renders a thumbnail PNG. ```APIDOC ## thumbnail_format ### Description Parses any supported format and renders a thumbnail PNG. ### Signature `pub fn thumbnail_format(data: &[u8], size: u32, fmt: Format) -> Result, Error>` ### Parameters - **data** (&[u8]) - The raw image data to be processed. - **size** (u32) - The target size for the thumbnail. - **fmt** (Format) - The format of the input data. ### Returns - **Result, Error>** - Returns a vector containing the PNG thumbnail data on success, or an Error if the operation fails. ``` -------------------------------- ### pub fn parse_and_resolve(data: &[u8]) -> Result Source: https://docs.rs/rustitch/0.2.2/rustitch/dst/fn.parse_and_resolve.html Parses a DST file and resolves it to a renderable design. ```APIDOC ## parse_and_resolve ### Description Parses a DST file provided as a byte slice and resolves it into a renderable design object. ### Signature `pub fn parse_and_resolve(data: &[u8]) -> Result` ### Parameters - **data** (&[u8]) - Required - The raw byte data of the DST file to be parsed. ### Returns - **Result** - Returns a `ResolvedDesign` on success, or an `Error` if parsing or resolution fails. ``` -------------------------------- ### pub fn detect_from_extension(path: &Path) -> Option Source: https://docs.rs/rustitch/0.2.2/rustitch/format/fn.detect_from_extension.html Detects the file format by analyzing the extension of the provided file path. ```APIDOC ## rustitch::format::detect_from_extension ### Description Detects the file format from a given file path by inspecting its extension. ### Signature `pub fn detect_from_extension(path: &Path) -> Option` ### Parameters - **path** (&Path) - Required - The file path to analyze for an extension. ### Returns - **Option** - Returns the detected Format if the extension is recognized, otherwise returns None. ``` -------------------------------- ### pub fn parse_and_resolve(data: &[u8]) -> Result Source: https://docs.rs/rustitch/0.2.2/rustitch/xxx/fn.parse_and_resolve.html Parses an XXX file provided as a byte slice and resolves it to a renderable design. ```APIDOC ## parse_and_resolve ### Description Parses an XXX file and resolves it to a renderable design. ### Signature `pub fn parse_and_resolve(data: &[u8]) -> Result` ### Parameters - **data** (&[u8]) - Required - The raw byte data of the XXX file to be parsed. ### Returns - **Result** - Returns a `ResolvedDesign` on success, or an `Error` if parsing or resolution fails. ``` -------------------------------- ### pub fn parse_and_resolve(data: &[u8]) -> Result Source: https://docs.rs/rustitch/0.2.2/rustitch/exp/fn.parse_and_resolve.html Parses an EXP file provided as a byte slice and resolves it into a renderable ResolvedDesign object. ```APIDOC ## parse_and_resolve ### Description Parses an EXP file and resolves it to a renderable design. ### Signature `pub fn parse_and_resolve(data: &[u8]) -> Result` ### Parameters - **data** (&[u8]) - Required - The raw byte data of the EXP file to be parsed. ### Returns - **Result** - Returns a `ResolvedDesign` on success, or an `Error` if parsing or resolution fails. ``` -------------------------------- ### pub fn parse_and_resolve(data: &[u8]) -> Result Source: https://docs.rs/rustitch/0.2.2/rustitch/pec/fn.parse_and_resolve.html Parses a standalone PEC file from a byte slice and resolves it to a renderable design. ```APIDOC ## Function: parse_and_resolve ### Description Parses a standalone PEC file provided as a byte slice and resolves it into a renderable `ResolvedDesign` object. ### Signature `pub fn parse_and_resolve(data: &[u8]) -> Result` ### Parameters - **data** (&[u8]) - Required - The raw byte data of the PEC file to be parsed. ### Returns - **Result** - Returns a `ResolvedDesign` on success, or an `Error` if parsing or resolution fails. ``` -------------------------------- ### pub fn parse_and_resolve(data: &[u8]) -> Result Source: https://docs.rs/rustitch/0.2.2/rustitch/sew/fn.parse_and_resolve.html Parses a SEW file provided as a byte slice and resolves it into a renderable design. ```APIDOC ## Function: parse_and_resolve ### Description Parses a SEW file and resolves it to a renderable design. ### Signature `pub fn parse_and_resolve(data: &[u8]) -> Result` ### Parameters - **data** (&[u8]) - Required - The raw byte data of the SEW file to be parsed. ### Returns - **Result** - Returns a `ResolvedDesign` on success, or an `Error` if parsing or resolution fails. ``` -------------------------------- ### parse Source: https://docs.rs/rustitch/0.2.2/rustitch/vp3/index.html Parses a VP3 file. ```APIDOC ## parse ### Description Parses a VP3 file. ### Signature `pub fn parse(data: &[u8]) -> Result` ``` -------------------------------- ### pub fn thumbnail(pes_data: &[u8], size: u32) -> Result, Error> Source: https://docs.rs/rustitch/0.2.2/rustitch/fn.thumbnail.html Parses a PES file from a byte slice and renders a thumbnail PNG of the specified size. ```APIDOC ## thumbnail ### Description Parses a PES file and renders a thumbnail PNG of the given size. ### Signature `pub fn thumbnail(pes_data: &[u8], size: u32) -> Result, Error>` ### Parameters - **pes_data** (&[u8]) - Required - The raw byte data of the PES file. - **size** (u32) - Required - The desired size for the thumbnail. ### Returns - **Result, Error>** - Returns a Result containing the PNG image data as a vector of bytes on success, or an Error if the operation fails. ``` -------------------------------- ### pub fn parse(data: &[u8]) -> Result Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/fn.parse.html Parses a PES file from raw byte input. ```APIDOC ## parse ### Description Parses a PES file from raw bytes. ### Signature `pub fn parse(data: &[u8]) -> Result` ### Parameters - **data** (&[u8]) - Required - The raw byte slice representing the PES file content. ### Returns - **Result** - Returns a `PesDesign` struct on success, or an `Error` if parsing fails. ``` -------------------------------- ### render_thumbnail(design: &ResolvedDesign, size: u32) -> Result, Error> Source: https://docs.rs/rustitch/0.2.2/rustitch/fn.render_thumbnail.html Renders a resolved embroidery design to a PNG image of the given size. ```APIDOC ## render_thumbnail ### Description Render a resolved embroidery design to a PNG image of the given size. ### Signature `pub fn render_thumbnail(design: &ResolvedDesign, size: u32) -> Result, Error>` ### Parameters - **design** (&ResolvedDesign) - The resolved embroidery design to render. - **size** (u32) - The target size for the rendered PNG image. ### Returns - **Result, Error>** - A Result containing the PNG image data as a byte vector on success, or an Error if the rendering fails. ``` -------------------------------- ### parse_and_resolve Source: https://docs.rs/rustitch/0.2.2/rustitch/vp3/index.html Parses a VP3 file and resolves it to a renderable design. ```APIDOC ## parse_and_resolve ### Description Parse a VP3 file and resolve to a renderable design. ### Signature `pub fn parse_and_resolve(data: &[u8]) -> Result` ``` -------------------------------- ### thumbnail Source: https://docs.rs/rustitch/0.2.2/rustitch/index.html Parses a PES file and renders a thumbnail PNG of the specified size. ```APIDOC ## thumbnail ### Description Parse a PES file and render a thumbnail PNG of the given size. ### Signature `pub fn thumbnail(data: &[u8], size: (u32, u32)) -> Result, Error>` ``` -------------------------------- ### parse_and_resolve Source: https://docs.rs/rustitch/0.2.2/rustitch/exp/index.html Parses an EXP file and resolves it to a renderable design. ```APIDOC ## parse_and_resolve ### Description Parses an EXP file and resolves to a renderable design. ### Signature `pub fn parse_and_resolve(data: &[u8]) -> Result` ``` -------------------------------- ### parse_and_resolve Source: https://docs.rs/rustitch/0.2.2/rustitch/xxx/index.html Parses an XXX file and resolves it to a renderable design. ```APIDOC ## parse_and_resolve ### Description Parses an XXX file and resolves to a renderable design. ### Signature `pub fn parse_and_resolve(reader: R) -> Result where R: Read + Seek` ``` -------------------------------- ### parse_and_resolve(data: &[u8]) Source: https://docs.rs/rustitch/0.2.2/rustitch/vp3/fn.parse_and_resolve.html Parses a VP3 file provided as a byte slice and returns a Result containing the ResolvedDesign or an Error. ```APIDOC ## Function: parse_and_resolve ### Description Parses a VP3 file and resolves it to a renderable design. ### Signature `pub fn parse_and_resolve(data: &[u8]) -> Result` ### Parameters - **data** (&[u8]) - Required - The raw byte data of the VP3 file to be parsed. ### Returns - **Result** - Returns a `ResolvedDesign` on success, or an `Error` if parsing or resolution fails. ``` -------------------------------- ### detect_from_extension Source: https://docs.rs/rustitch/0.2.2/rustitch/format/index.html Detects the file format based on the provided file extension string. ```APIDOC ## detect_from_extension ### Description Detect format from file extension. ### Signature `pub fn detect_from_extension(ext: &str) -> Option` ``` -------------------------------- ### render_thumbnail Source: https://docs.rs/rustitch/0.2.2/rustitch/index.html Renders a resolved embroidery design to a PNG image of the specified size. ```APIDOC ## render_thumbnail ### Description Render a resolved embroidery design to a PNG image of the given size. ### Signature `pub fn render_thumbnail(design: &ResolvedDesign, size: (u32, u32)) -> Result, Error>` ``` -------------------------------- ### parse Source: https://docs.rs/rustitch/0.2.2/rustitch/jef/index.html Parses a JEF file. ```APIDOC ## parse ### Description Parses a JEF file. ``` -------------------------------- ### default_colors Source: https://docs.rs/rustitch/0.2.2/rustitch/palette/index.html Builds a color list for a specified number of thread slots by cycling through the DEFAULT_PALETTE. ```APIDOC ## default_colors ### Description Build a color list for `n` thread slots by cycling through `DEFAULT_PALETTE`. ### Signature `pub fn default_colors(n: usize) -> Vec` ``` -------------------------------- ### pub fn resolve(design: &PesDesign) -> Result Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/fn.resolve.html Converts a parsed PES design into renderable segments with absolute coordinates. ```APIDOC ## rustitch::pes::resolve ### Description Converts a parsed PES design into renderable segments with absolute coordinates. ### Signature `pub fn resolve(design: &PesDesign) -> Result` ### Parameters - **design** (&PesDesign) - Required - The parsed PES design to be resolved. ### Returns - **Result** - Returns a Result containing the ResolvedDesign on success, or an Error if the resolution fails. ``` -------------------------------- ### parse_and_resolve Source: https://docs.rs/rustitch/0.2.2/rustitch/jef/index.html Parses a JEF file and resolves it to a renderable design. ```APIDOC ## parse_and_resolve ### Description Parse a JEF file and resolve to a renderable design. ``` -------------------------------- ### detect_from_extension function signature Source: https://docs.rs/rustitch/0.2.2/rustitch/format/fn.detect_from_extension.html The function signature for detecting file formats from a path. ```rust pub fn detect_from_extension(path: &Path) -> Option ``` -------------------------------- ### parse Source: https://docs.rs/rustitch/0.2.2/rustitch/dst/index.html Parses a DST (Tajima) file from raw bytes into a sequence of stitch commands. ```APIDOC ## parse ### Description Parses a DST (Tajima) file from raw bytes into stitch commands. ### Signature `pub fn parse(data: &[u8]) -> Result, Error>` ``` -------------------------------- ### parse_and_resolve Source: https://docs.rs/rustitch/0.2.2/rustitch/sew/index.html Parses a SEW file and resolves it to a renderable design. ```APIDOC ## parse_and_resolve ### Description Parses a SEW file and resolves to a renderable design. ``` -------------------------------- ### parse_and_resolve Source: https://docs.rs/rustitch/0.2.2/rustitch/dst/index.html Parses a DST file and resolves the data into a renderable design format. ```APIDOC ## parse_and_resolve ### Description Parse a DST file and resolve to a renderable design. ### Signature `pub fn parse_and_resolve(data: &[u8]) -> Result` ``` -------------------------------- ### pub fn parse(data: &[u8]) -> Result, Error> Source: https://docs.rs/rustitch/0.2.2/rustitch/exp/fn.parse.html Parses an EXP (Melco) file from raw bytes into a vector of stitch commands. The format uses 2 bytes per stitch (signed i8 dx, dy) and supports escape sequences for color changes, jumps, and trims. ```APIDOC ## pub fn parse(data: &[u8]) -> Result, Error> ### Description Parses an EXP (Melco) file from raw bytes into a vector of stitch commands. ### Signature `pub fn parse(data: &[u8]) -> Result, Error>` ### Parameters - **data** (&[u8]) - Required - The raw byte slice representing the EXP file content. ### Returns - **Result, Error>** - A vector of parsed stitch commands on success, or an error if parsing fails. ### Format Details - **Stitch**: 2 bytes (signed i8 dx, dy). - **Escape Byte (0x80)**: - **0x01**: Color change. - **0x02**: Color change (variant). - **0x04**: Jump (next 2 bytes are jump dx, dy). - **0x80**: Trim. ``` -------------------------------- ### parse_and_resolve Source: https://docs.rs/rustitch/0.2.2/rustitch/pec/index.html Parses a standalone PEC file and resolves it into a renderable design. ```APIDOC ## parse_and_resolve ### Description Parses a standalone PEC file and resolves the contents into a renderable design object. ``` -------------------------------- ### pub fn parse(data: &[u8]) -> Result<(Vec, Vec<(u8, u8, u8)>), Error> Source: https://docs.rs/rustitch/0.2.2/rustitch/jef/fn.parse.html Parses the provided byte slice into a tuple containing a vector of StitchCommand objects and a vector of color tuples. ```APIDOC ## pub fn parse(data: &[u8]) -> Result<(Vec, Vec<(u8, u8, u8)>), Error> ### Description Parses the provided byte slice into a tuple containing a vector of StitchCommand objects and a vector of color tuples (represented as (u8, u8, u8)). ### Parameters - **data** (&[u8]) - Required - The input byte slice to be parsed. ### Returns - **Result<(Vec, Vec<(u8, u8, u8)>), Error>** - A Result containing a tuple of the parsed commands and colors on success, or an Error on failure. ``` -------------------------------- ### default_colors(n: usize) -> Vec<(u8, u8, u8)> Source: https://docs.rs/rustitch/0.2.2/rustitch/palette/fn.default_colors.html Generates a color list for n thread slots by cycling through the DEFAULT_PALETTE. ```APIDOC ## Function: default_colors ### Description Builds a color list for `n` thread slots by cycling through the `DEFAULT_PALETTE`. ### Signature `pub fn default_colors(n: usize) -> Vec<(u8, u8, u8)>` ### Parameters - **n** (usize) - The number of thread slots to generate colors for. ### Returns - **Vec<(u8, u8, u8)>** - A vector of RGB tuples representing the generated color palette. ``` -------------------------------- ### parse Source: https://docs.rs/rustitch/0.2.2/rustitch/xxx/index.html Parses an XXX (Singer) embroidery file. ```APIDOC ## parse ### Description Parses an XXX (Singer) embroidery file. ### Signature `pub fn parse(reader: R) -> Result where R: Read + Seek` ``` -------------------------------- ### parse Source: https://docs.rs/rustitch/0.2.2/rustitch/exp/index.html Parses an EXP (Melco) file from raw bytes into stitch commands. ```APIDOC ## parse ### Description Parses an EXP (Melco) file from raw bytes into stitch commands. ### Signature `pub fn parse(data: &[u8]) -> Result, Error>` ``` -------------------------------- ### thumbnail_format Source: https://docs.rs/rustitch/0.2.2/rustitch/index.html Parses any supported embroidery format and renders a thumbnail PNG of the specified size. ```APIDOC ## thumbnail_format ### Description Parse any supported format and render a thumbnail PNG. ### Signature `pub fn thumbnail_format(data: &[u8], format: Format, size: (u32, u32)) -> Result, Error>` ``` -------------------------------- ### rustitch::format::detect_from_bytes Source: https://docs.rs/rustitch/0.2.2/rustitch/format/fn.detect_from_bytes.html Detects the file format from the provided byte slice containing magic bytes. ```APIDOC ## Function: detect_from_bytes ### Description Detects the file format from the provided file content (magic bytes). ### Signature `pub fn detect_from_bytes(data: &[u8]) -> Option` ### Parameters - **data** (&[u8]) - Required - A byte slice containing the file content or magic bytes to be analyzed. ### Returns - **Option** - Returns `Some(Format)` if the format is successfully detected, otherwise returns `None`. ``` -------------------------------- ### parse Source: https://docs.rs/rustitch/0.2.2/rustitch/sew/index.html Parses a SEW (Janome) embroidery file. ```APIDOC ## parse ### Description Parses a SEW (Janome) embroidery file. ``` -------------------------------- ### render_thumbnail function signature Source: https://docs.rs/rustitch/0.2.2/rustitch/fn.render_thumbnail.html The function signature for rendering an embroidery design to a PNG image. ```rust pub fn render_thumbnail( design: &ResolvedDesign, size: u32, ) -> Result, Error> ``` -------------------------------- ### resolve Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/index.html Converts a parsed PES design into renderable segments with absolute coordinates. ```APIDOC ## resolve ### Description Convert parsed PES design into renderable segments with absolute coordinates. ### Signature `pub fn resolve(design: &PesDesign) -> ResolvedDesign` ``` -------------------------------- ### detect_from_bytes Source: https://docs.rs/rustitch/0.2.2/rustitch/format/index.html Detects the file format by analyzing the provided magic bytes. ```APIDOC ## detect_from_bytes ### Description Detect format from file content (magic bytes). ### Signature `pub fn detect_from_bytes(bytes: &[u8]) -> Option` ``` -------------------------------- ### Retrieve default colors signature Source: https://docs.rs/rustitch/0.2.2/rustitch/palette/fn.default_colors.html The function signature for generating a color list based on the number of thread slots. ```rust pub fn default_colors(n: usize) -> Vec<(u8, u8, u8)> ``` -------------------------------- ### pub fn parse(data: &[u8]) -> Result, Error> Source: https://docs.rs/rustitch/0.2.2/rustitch/dst/fn.parse.html Parses a DST (Tajima) file from raw bytes into stitch commands. The function interprets the 3-byte per record format, including bit-packed dx, dy, and control flags. ```APIDOC ## parse ### Description Parses a DST (Tajima) file from raw bytes into stitch commands. The DST format uses 3 bytes per stitch record with bit-packed dx, dy, and control flags. ### Signature `pub fn parse(data: &[u8]) -> Result, Error>` ### Parameters - **data** (&[u8]) - Required - The raw byte slice representing the DST file content. ### Returns - **Result, Error>** - A vector of parsed stitch commands on success, or an error if the data is malformed. ``` -------------------------------- ### parse Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/index.html Parses a PES file from raw bytes into a PesDesign structure. ```APIDOC ## parse ### Description Parses a PES file from raw bytes. ### Signature `pub fn parse(data: &[u8]) -> Result` ``` -------------------------------- ### BoundingBox Struct Definition Source: https://docs.rs/rustitch/0.2.2/rustitch/types/struct.BoundingBox.html The structure definition for BoundingBox, containing four f32 fields representing coordinate boundaries. ```rust pub struct BoundingBox { pub min_x: f32, pub max_x: f32, pub min_y: f32, pub max_y: f32, } ``` -------------------------------- ### thumbnail function signature Source: https://docs.rs/rustitch/0.2.2/rustitch/fn.thumbnail.html The function signature for generating a thumbnail from PES data. ```rust pub fn thumbnail(pes_data: &[u8], size: u32) -> Result, Error> ``` -------------------------------- ### Accessing the PEC_PALETTE constant Source: https://docs.rs/rustitch/0.2.2/rustitch/palette/constant.PEC_PALETTE.html Defines the structure of the PEC_PALETTE constant containing 65 RGB color entries. ```rust pub const PEC_PALETTE: [(u8, u8, u8); 65]; ``` -------------------------------- ### Accessing DEFAULT_PALETTE Source: https://docs.rs/rustitch/0.2.2/rustitch/palette/constant.DEFAULT_PALETTE.html The constant defines a fixed array of 12 RGB tuples used for color cycling in formats like DST and EXP. ```rust pub const DEFAULT_PALETTE: [(u8, u8, u8); 12]; ``` -------------------------------- ### thumbnail_format function signature Source: https://docs.rs/rustitch/0.2.2/rustitch/fn.thumbnail_format.html The function signature for thumbnail_format, which takes image data, a target size, and a format, returning a PNG byte vector. ```rust pub fn thumbnail_format( data: &[u8], size: u32, fmt: Format, ) -> Result, Error> ``` -------------------------------- ### PesHeader Struct Definition Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/struct.PesHeader.html The structure definition for PesHeader, containing the version and offset fields. ```rust pub struct PesHeader { pub version: [u8; 4], pub pec_offset: u32, } ``` -------------------------------- ### Parse and resolve DST data Source: https://docs.rs/rustitch/0.2.2/rustitch/dst/fn.parse_and_resolve.html Parses a byte slice representing a DST file into a ResolvedDesign object. Returns an error if the parsing or resolution fails. ```rust pub fn parse_and_resolve(data: &[u8]) -> Result ``` -------------------------------- ### Parse SEW file signature Source: https://docs.rs/rustitch/0.2.2/rustitch/sew/fn.parse.html The function signature for parsing SEW embroidery data, returning a result containing stitch commands and thread palette indices. ```rust pub fn parse( data: &[u8], ) -> Result<(Vec, Vec<(u8, u8, u8)>), Error> ``` -------------------------------- ### pec_color function signature Source: https://docs.rs/rustitch/0.2.2/rustitch/palette/fn.pec_color.html Displays the function signature for looking up a PEC palette color. ```rust pub fn pec_color(idx: u8) -> (u8, u8, u8) ``` -------------------------------- ### PecHeader Struct Definition Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/pec/struct.PecHeader.html The structure definition for PecHeader, including its fields for label, color count, and color indices. ```rust pub struct PecHeader { pub label: String, pub color_count: u8, pub color_indices: Vec, } ``` -------------------------------- ### PesDesign Struct Definition Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/struct.PesDesign.html The primary structure definition for PesDesign, containing the header, PEC header, and a vector of stitch commands. ```rust pub struct PesDesign { pub header: PesHeader, pub pec_header: PecHeader, pub commands: Vec, } ``` -------------------------------- ### Parse PES file from raw bytes Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/fn.parse.html Use this function to deserialize raw byte data into a PesDesign object. It returns a Result containing the parsed design or an Error. ```rust pub fn parse(data: &[u8]) -> Result ``` -------------------------------- ### Define Format Enum Source: https://docs.rs/rustitch/0.2.2/rustitch/format/enum.Format.html The Format enum lists the supported embroidery file formats. ```rust pub enum Format { Pes, Dst, Exp, Jef, Vp3, Pec, Xxx, Sew, } ``` -------------------------------- ### decode_stitches Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/pec/fn.decode_stitches.html Decodes a PEC stitch byte stream into a list of commands. ```APIDOC ## Function: decode_stitches ### Description Decodes a PEC stitch byte stream into a list of commands. ### Signature `pub fn decode_stitches(data: &[u8]) -> Result, Error>` ### Parameters - **data** (&[u8]) - The byte stream containing the PEC stitch data to be decoded. ### Returns - **Result, Error>** - Returns a vector of `StitchCommand` objects on success, or an `Error` if the decoding fails. ``` -------------------------------- ### decode_stitches Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/pec/index.html Decodes a PEC stitch byte stream into a list of commands. ```APIDOC ## decode_stitches ### Description Decodes a PEC stitch byte stream into a list of commands. ### Signature `pub fn decode_stitches(data: &[u8]) -> Vec` ``` -------------------------------- ### ResolvedDesign Struct Definition Source: https://docs.rs/rustitch/0.2.2/rustitch/types/struct.ResolvedDesign.html The primary structure definition for ResolvedDesign, containing segments, colors, and bounds. ```rust pub struct ResolvedDesign { pub segments: Vec, pub colors: Vec<(u8, u8, u8)>, pub bounds: BoundingBox, } ``` -------------------------------- ### Parse DST data signature Source: https://docs.rs/rustitch/0.2.2/rustitch/dst/fn.parse.html The function signature for parsing raw byte slices into a vector of stitch commands or an error. ```rust pub fn parse(data: &[u8]) -> Result, Error> ``` -------------------------------- ### StitchCommand Enum Definition Source: https://docs.rs/rustitch/0.2.2/rustitch/types/enum.StitchCommand.html Defines the variants for embroidery machine operations, including coordinate-based movement and control commands. ```rust pub enum StitchCommand { Stitch { dx: i16, dy: i16, }, Jump { dx: i16, dy: i16, }, Trim, ColorChange, End, } ``` -------------------------------- ### Decode PEC stitch data Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/pec/fn.decode_stitches.html Parses a raw byte slice into a sequence of stitch commands. ```rust pub fn decode_stitches(data: &[u8]) -> Result, Error> ``` -------------------------------- ### Resolve PES design signature Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/fn.resolve.html The function signature for converting a PesDesign into a ResolvedDesign. ```rust pub fn resolve(design: &PesDesign) -> Result ``` -------------------------------- ### pec_color Source: https://docs.rs/rustitch/0.2.2/rustitch/palette/index.html Looks up a Brother PEC palette color by index, clamping the index to the valid range. ```APIDOC ## pec_color ### Description Look up a PEC palette color by index, clamping to valid range. ### Signature `pub fn pec_color(index: usize) -> Color` ``` -------------------------------- ### parse_pec_header function signature Source: https://docs.rs/rustitch/0.2.2/rustitch/pes/pec/fn.parse_pec_header.html The function signature for parsing a PEC header from raw byte data. ```rust pub fn parse_pec_header(pec_data: &[u8]) -> Result<(PecHeader, usize), Error> ``` -------------------------------- ### pec_color(idx: u8) -> (u8, u8, u8) Source: https://docs.rs/rustitch/0.2.2/rustitch/palette/fn.pec_color.html Retrieves a color from the PEC palette by its index. The function automatically clamps the input index to the valid range of the palette. ```APIDOC ## pec_color ### Description Look up a PEC palette color by index, clamping to valid range. ### Signature `pub fn pec_color(idx: u8) -> (u8, u8, u8)` ### Parameters - **idx** (u8) - The index of the color to retrieve from the PEC palette. ### Returns - **(u8, u8, u8)** - A tuple representing the RGB color values. ``` -------------------------------- ### Define the Error enum Source: https://docs.rs/rustitch/0.2.2/rustitch/error/enum.Error.html The Error enum represents all possible error states within the library, including variants for file format issues and encoding errors. ```rust pub enum Error { InvalidPesMagic([u8; 4]), TooShort { expected: usize, actual: usize, }, InvalidPecOffset(u32, usize), InvalidHeader(String), NoStitchData, EmptyDesign, UnsupportedFormat, Render(String), PngEncode(EncodingError), } ``` -------------------------------- ### StitchSegment Struct Definition Source: https://docs.rs/rustitch/0.2.2/rustitch/types/struct.StitchSegment.html The definition of the StitchSegment struct containing coordinate fields and a color index. ```rust pub struct StitchSegment { pub x0: f32, pub y0: f32, pub x1: f32, pub y1: f32, pub color_index: usize, } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.