Skip to main content

Converted

Struct Converted 

Source
pub struct Converted<'a> { /* private fields */ }
Expand description

Components to premultiplied RGBA, one row at a time.

The second and last stage of the pipeline: it takes whatever Source produced, runs it through convert_row, and joins the mask alpha, the matte and the transfer function — all per-pixel decisions that belong to this stage.

Implementations§

Source§

impl<'a> Converted<'a>

Source

pub fn new(source: Source<'a>, palette: Option<Palette>) -> Self

Convert the rows of source, resolving indices through palette.

The palette is Some exactly when the source is Pixels::Indexed; an indexed row with no palette resolves every index to black, which is the fallback the per-pixel path had.

Source

pub fn next_row_with( &mut self, finish: impl FnOnce(&mut [Rgba8]), ) -> Option<Row<'_, Rgba8>>

The next row converted in place, handed to finish for the alpha, the matte and the transfer function before anyone else sees it.

The conversion itself produces opaque RGBA — alpha is not the colour space’s business — and finish is where the caller’s own per-pixel business goes. Passing it in rather than exposing the buffer keeps the row’s mutable lifetime inside this stage, which is what lets the next stage borrow the finished row immutably straight afterwards.

Trait Implementations§

Source§

impl<'a> Debug for Converted<'a>

Source§

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

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

impl Rows for Converted<'_>

Source§

type Pixel = Rgba8

What one pixel of a row this stage produces looks like.
Source§

fn next(&mut self) -> Option<Row<'_, Rgba8>>

The next row, or None when the image is exhausted.

Auto Trait Implementations§

§

impl<'a> Freeze for Converted<'a>

§

impl<'a> RefUnwindSafe for Converted<'a>

§

impl<'a> Send for Converted<'a>

§

impl<'a> Sync for Converted<'a>

§

impl<'a> Unpin for Converted<'a>

§

impl<'a> UnsafeUnpin for Converted<'a>

§

impl<'a> UnwindSafe for Converted<'a>

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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.