pub struct TileCompositor {
pub width: u32,
pub height: u32,
pub background: Rgba,
}Expand description
Composites a stack of Layers into a single image tile.
Fields§
§width: u32§height: u32§background: RgbaBackground colour drawn beneath all layers.
Implementations§
Source§impl TileCompositor
impl TileCompositor
Sourcepub fn new(width: u32, height: u32, background: Rgba) -> Self
pub fn new(width: u32, height: u32, background: Rgba) -> Self
Create a new compositor for tiles of the given dimensions.
Sourcepub fn composite(&self, layers: &mut [Layer]) -> Vec<Rgba>
pub fn composite(&self, layers: &mut [Layer]) -> Vec<Rgba>
Composite layers in ascending z_order order.
Invisible layers are skipped. Each layer’s per-pixel alpha is
multiplied by layer.opacity before blending.
Sourcepub fn to_rgba_bytes(pixels: &[Rgba]) -> Vec<u8> ⓘ
pub fn to_rgba_bytes(pixels: &[Rgba]) -> Vec<u8> ⓘ
Convert a pixel slice to interleaved RGBA bytes (4 bytes per pixel).
Sourcepub fn to_rgb_bytes(pixels: &[Rgba]) -> Vec<u8> ⓘ
pub fn to_rgb_bytes(pixels: &[Rgba]) -> Vec<u8> ⓘ
Convert a pixel slice to interleaved RGB bytes (3 bytes per pixel), discarding the alpha channel.
Sourcepub fn stats(pixels: &[Rgba]) -> CompositeStats
pub fn stats(pixels: &[Rgba]) -> CompositeStats
Compute per-channel statistics on a composited pixel slice.
Auto Trait Implementations§
impl Freeze for TileCompositor
impl RefUnwindSafe for TileCompositor
impl Send for TileCompositor
impl Sync for TileCompositor
impl Unpin for TileCompositor
impl UnsafeUnpin for TileCompositor
impl UnwindSafe for TileCompositor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more