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>
impl<'a> Converted<'a>
Sourcepub fn new(source: Source<'a>, palette: Option<Palette>) -> Self
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.
Sourcepub fn next_row_with(
&mut self,
finish: impl FnOnce(&mut [Rgba8]),
) -> Option<Row<'_, Rgba8>>
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.