Struct CrxImage

Source
pub struct CrxImage {
    header: Header,
    color_type: ImageColorType,
    data: Vec<u8>,
    compress_level: u32,
    keep_original_bpp: bool,
    zstd: bool,
    zstd_compression_level: i32,
    row_type: CircusCrxMode,
    canvas: bool,
}
Available on crate features circus and circus-img only.
Expand description

Circus CRX Image

Fields§

§header: Header§color_type: ImageColorType§data: Vec<u8>§compress_level: u32§keep_original_bpp: bool§zstd: bool§zstd_compression_level: i32§row_type: CircusCrxMode§canvas: bool

Implementations§

Source§

impl CrxImage

Source

pub fn new<T: Read + Seek>(data: T, config: &ExtraConfig) -> Result<Self>

Creates a new CrxImage from the given data and configuration.

  • data - The reader to read the CRX image from.
  • config - Extra configuration options.
Source

pub fn with_canvas(self, canvas: bool) -> Self

Whether to draw image on canvas if canvas’s width and height are specified in image.

Source

pub fn draw_diff(&self, diff: &Self) -> Result<ImageData>

Draws another image on this image.

Returns a new ImageData with the combined image.

Source

fn decode_row0( dst: &mut Vec<u8>, dst_p: usize, src: &[u8], src_p: usize, width: u16, pixel_size: u8, ) -> Result<usize>

Source

fn decode_row1( dst: &mut Vec<u8>, dst_p: usize, src: &[u8], src_p: usize, width: u16, pixel_size: u8, prev_row_p: usize, ) -> Result<usize>

Source

fn decode_row2( dst: &mut Vec<u8>, dst_p: usize, src: &[u8], src_p: usize, width: u16, pixel_size: u8, prev_row_p: usize, ) -> Result<usize>

Source

fn decode_row3( dst: &mut Vec<u8>, dst_p: usize, src: &[u8], src_p: usize, width: u16, pixel_size: u8, prev_row_p: usize, ) -> Result<usize>

Source

fn decode_row4( dst: &mut Vec<u8>, dst_p: usize, src: &[u8], src_p: usize, width: u16, pixel_size: u8, ) -> Result<usize>

Source

fn decode_image( dst: &mut Vec<u8>, src: &[u8], width: u16, height: u16, pixel_size: u8, encode_type: &mut Vec<u8>, ) -> Result<()>

Source

fn encode_row0( dst: &mut Vec<u8>, src: &[u8], width: u16, pixel_size: u8, y: u16, )

Source

fn encode_row1( dst: &mut Vec<u8>, src: &[u8], width: u16, pixel_size: u8, y: u16, )

Source

fn encode_row2( dst: &mut Vec<u8>, src: &[u8], width: u16, pixel_size: u8, y: u16, )

Source

fn encode_row3( dst: &mut Vec<u8>, src: &[u8], width: u16, pixel_size: u8, y: u16, )

Source

fn encode_row4( dst: &mut Vec<u8>, src: &[u8], width: u16, pixel_size: u8, y: u16, )

Source

fn encode_row_best( dst: &mut Vec<u8>, src: &[u8], width: u16, pixel_size: u8, y: u16, ) -> Result<()>

Source

fn encode_image_best( src: &[u8], width: u16, height: u16, pixel_size: u8, ) -> Result<Vec<u8>>

Source

fn encode_image_fixed( src: &[u8], width: u16, height: u16, pixel_size: u8, row_type: u8, ) -> Result<Vec<u8>>

Source

fn encode_image_origin( src: &[u8], width: u16, height: u16, pixel_size: u8, row_type: &[u8], ) -> Result<Vec<u8>>

Source

pub fn create_image<T: Write + Seek>( data: ImageData, writer: T, config: &ExtraConfig, ) -> Result<()>

Creates a CRX image file from the given image data and writes it to the specified writer.

  • data - The input image data.
  • writer - The writer to write the CRX image to.
  • config - Extra configuration options.

Trait Implementations§

Source§

impl Debug for CrxImage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Script for CrxImage

Source§

fn default_output_script_type(&self) -> OutputScriptType

Returns the default output script type for this script.
Source§

fn default_format_type(&self) -> FormatOptions

Returns the default format options for this script.
Source§

fn is_image(&self) -> bool

Available on crate feature image only.
Returns true if this script type is an image.
Source§

fn export_image(&self) -> Result<ImageData>

Available on crate feature image only.
Exports the image data from this script.
Source§

fn import_image<'a>( &'a self, data: ImageData, file: Box<dyn WriteSeek + 'a>, ) -> Result<()>

Available on crate feature image only.
Imports an image into this script. Read more
Source§

fn is_output_supported(&self, output: OutputScriptType) -> bool

Checks if the given output script type is supported by this script.
Source§

fn custom_output_extension<'a>(&'a self) -> &'a str

Returns the output extension for this script when exporting with custom output.
Source§

fn extract_messages(&self) -> Result<Vec<Message>>

Extract messages from this script.
Source§

fn import_messages<'a>( &'a self, _messages: Vec<Message>, _file: Box<dyn WriteSeek + 'a>, _filename: &str, _encoding: Encoding, _replacement: Option<&'a ReplacementTable>, ) -> Result<()>

Import messages into this script. Read more
Source§

fn import_messages_filename( &self, messages: Vec<Message>, filename: &str, encoding: Encoding, replacement: Option<&ReplacementTable>, ) -> Result<()>

Import messages into this script. Read more
Source§

fn custom_export(&self, _filename: &Path, _encoding: Encoding) -> Result<()>

Exports data from this script. Read more
Source§

fn custom_import<'a>( &'a self, _custom_filename: &'a str, _file: Box<dyn WriteSeek + 'a>, _encoding: Encoding, _output_encoding: Encoding, ) -> Result<()>

Imports data into this script. Read more
Source§

fn custom_import_filename( &self, custom_filename: &str, filename: &str, encoding: Encoding, output_encoding: Encoding, ) -> Result<()>

Imports data into this script. Read more
Source§

fn is_archive(&self) -> bool

Returns true if this script is an archive.
Source§

fn iter_archive_filename<'a>( &'a self, ) -> Result<Box<dyn Iterator<Item = Result<String>> + 'a>>

Returns an iterator over archive filenames.
Source§

fn iter_archive_offset<'a>( &'a self, ) -> Result<Box<dyn Iterator<Item = Result<u64>> + 'a>>

Returns an iterator over archive offsets.
Source§

fn open_file<'a>( &'a self, _index: usize, ) -> Result<Box<dyn ArchiveContent + 'a>>

Opens a file in the archive by its index.
Source§

fn open_file_by_name<'a>( &'a self, name: &str, ignore_case: bool, ) -> Result<Box<dyn ArchiveContent + 'a>>

Opens a file in the archive by its name. Read more
Source§

fn open_file_by_offset<'a>( &'a self, offset: u64, ) -> Result<Box<dyn ArchiveContent + 'a>>

Opens a file in the archive by its offset.
Source§

fn archive_output_ext<'a>(&'a self) -> Option<&'a str>

Returns output extension for archive output folder.
Source§

fn import_image_filename(&self, data: ImageData, filename: &str) -> Result<()>

Available on crate feature image only.
Imports an image into this script. Read more
Source§

fn is_multi_image(&self) -> bool

Available on crate feature image only.
Returns true if this script is contains multiple images.
Source§

fn export_multi_image<'a>( &'a self, ) -> Result<Box<dyn Iterator<Item = Result<ImageDataWithName>> + 'a>>

Available on crate feature image only.
Exports multiple images from this script.
Source§

fn import_multi_image<'a>( &'a self, _data: Vec<ImageDataWithName>, _file: Box<dyn WriteSeek + 'a>, ) -> Result<()>

Available on crate feature image only.
Imports multiple images into this script. Read more
Source§

fn import_multi_image_filename( &self, data: Vec<ImageDataWithName>, filename: &str, ) -> Result<()>

Available on crate feature image only.
Imports multiple images into this script. Read more
Source§

fn extra_info<'a>(&'a self) -> Option<Box<dyn AnyDebug + 'a>>

Returns the extra information for this script.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> AnyDebug for T
where T: Debug + Any,

Source§

impl<T> ErasedDestructor for T
where T: 'static,