logo
pub struct Attributes { /* private fields */ }
Expand description

Starting point and settings for the quantization process

Implementations

New handle for library configuration

See also Attributes::new_image()

Make an image from RGBA pixels.

The pixels argument can be Vec<RGBA>, or Box<[RGBA]> or &[RGBA]. See Attributes::new_image_borrowed for a non-copying alternative.

Use 0.0 for gamma if the image is sRGB (most images are).

Generate palette for the image

It’s better to use set_quality()

Range 0-100, roughly like JPEG.

If the minimum quality can’t be met, the quantization will be aborted with an error.

Default is min 0, max 100, which means best effort, and never aborts the process.

If max is less than 100, the library will try to use fewer colors. Images with fewer colors are not always smaller, due to increased dithering it causes.

1-10.

Faster speeds generate images of lower quality, but may be useful for real-time generation of images.

The default is 4.

Number of least significant bits to ignore.

Useful for generating palettes for VGA, 15-bit textures, or other retro platforms.

Returns number of bits of precision truncated

Return currently set speed/quality trade-off setting

Return max number of colors set

Reads values set with set_quality

Describe dimensions of a slice of RGBA pixels

Use 0.0 for gamma if the image is sRGB (most images are).

Like new_image_stride_borrowed, but makes a copy of the pixels.

The pixels argument can be Vec<RGBA>, or Box<[RGBA]> or &[RGBA].

Set callback function to be called every time the library wants to print a message.

To share data with the callback, use Arc or Atomic* types and move || closures.

Callback for flushing output (if you buffer messages, that’s the time to flush those buffers)

Set callback function to be called every time the library makes a progress. It can be used to cancel operation early.

To share data with the callback, use Arc or Atomic* types and move || closures.

Move transparent color to the last entry in the palette

This is less efficient for PNG, but required by some broken software

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.