Skip to main content

PixelBand

Struct PixelBand 

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

Zero-copy borrowed horizontal row band of a Framebuffer enabling safe multi-threaded parallel rasterization.

Implementations§

Source§

impl<'a> PixelBand<'a>

Zero-copy band rasterization primitives for PixelBand.

Source

pub fn width(&self) -> u32

Returns the full framebuffer width in physical pixels.

§Arguments
  • &Self - Pixel band reference.
§Returns
  • u32 - Width in physical pixels.
Source

pub fn y_offset(&self) -> u32

Returns the inclusive top physical Y row owned by this band.

§Arguments
  • &Self - Pixel band reference.
§Returns
  • u32 - Starting physical Y row.
Source

pub fn y_end(&self) -> u32

Returns the exclusive bottom physical Y row owned by this band.

§Arguments
  • &Self - Pixel band reference.
§Returns
  • u32 - Ending physical Y row.
Source

pub fn row_slice_mut(&mut self, y: u32) -> Option<&mut [u8]>

Returns the mutable byte slice for global physical row y if owned by this band.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - Global physical Y row coordinate.
§Returns
  • Option<&mut [u8]> - Mutable row byte slice (width * 4 bytes).
Source

pub fn two_row_slices_mut( &mut self, y_a: u32, y_b: u32, ) -> Option<(&mut [u8], &mut [u8])>

Returns two disjoint mutable row slices for global physical rows y_a < y_b owned by this band.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - Upper global physical Y row coordinate (y_a < y_b).
  • u32 - Lower global physical Y row coordinate (y_b > y_a).
§Returns
  • Option<(&mut [u8], &mut [u8])> - Pair of disjoint mutable row slices (row_a, row_b).
Source

pub fn clear(&mut self, color: Color)

Fills the entire band with solid color using 32-byte wide auto-vectorized stores.

§Arguments
  • &Self - Mutable pixel band.
  • Color - Clear color.
Source

pub fn fill_span(&mut self, x0: u32, x1: u32, y: u32, color: Color)

Fills or Porter-Duff blends horizontal span [x0, x1) on global row y.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - Inclusive start X coordinate.
  • u32 - Exclusive end X coordinate.
  • u32 - Global physical Y coordinate.
  • Color - Foreground RGBA color.
Source

pub fn fill_span_linear(&mut self, x0: u32, x1: u32, y: u32, color: Color)

Fills or LUT linear-light blends horizontal span [x0, x1) on global row y.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - Inclusive start X coordinate.
  • u32 - Exclusive end X coordinate.
  • u32 - Global physical Y coordinate.
  • Color - Foreground RGBA color.
Source

pub fn fill_span_linear_luts( &mut self, x0: u32, x1: u32, y: u32, luts: &([u8; 256], [u8; 256], [u8; 256], [u8; 256]), )

Composites horizontal span [x0, x1) on global row y using precomputed bit-exact 256-entry linear-light channel LUTs.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - Inclusive start X coordinate.
  • u32 - Exclusive end X coordinate.
  • u32 - Global physical Y coordinate.
  • &([u8; 256], [u8; 256], [u8; 256], [u8; 256]) - Precomputed per-channel lookup tables.
Source

pub fn blend_shadow_span_const_alpha( &mut self, x0: u32, x1: u32, y: u32, color: Color, alpha_f: f32, )

Composites a constant-opacity horizontal shadow span [x0, x1) on global row y with L1 LUT linear light and IGN dithering.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - Inclusive start X coordinate.
  • u32 - Exclusive end X coordinate.
  • u32 - Global physical Y coordinate.
  • Color - Shadow tint RGB.
  • f32 - Continuous shadow opacity in [0.0, 1.0].
Source

pub fn blend_glyph_row( &mut self, dx: u32, dy: u32, coverage: &[u8], color: Color, ) -> usize

Blends a contiguous glyph alpha coverage row onto global row dy starting at dx.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - Destination starting X coordinate.
  • u32 - Global destination Y coordinate.
  • &[u8] - Glyph alpha coverage slice.
  • Color - Foreground text color.
§Returns
  • usize - Number of non-zero coverage pixels shaded.
Source

pub fn blend_pixel(&mut self, x: u32, y: u32, color: Color)

Blends color over global pixel (x, y) using fast integer Porter-Duff source-over.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - X pixel coordinate.
  • u32 - Global Y pixel coordinate.
  • Color - Foreground color.
Source

pub fn blend_pixel_linear_dithered( &mut self, x: u32, y: u32, color: Color, dither: f32, )

Blends color over global pixel (x, y) using L1 LUT linear-light compositing with optional sub-LSB dithering.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - X pixel coordinate.
  • u32 - Global Y pixel coordinate.
  • Color - Foreground color.
  • f32 - Normalized dither offset in [-0.5, 0.5].
Source

pub fn blend_pixel_f32_dithered( &mut self, x: u32, y: u32, color: Color, alpha_f: f32, dither: f32, )

Blends a foreground RGB color with continuous floating-point opacity alpha_f onto global pixel (x, y) via L1 LUT linear light.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - X pixel coordinate.
  • u32 - Global Y pixel coordinate.
  • Color - Foreground RGB tint.
  • f32 - Continuous opacity in [0.0, 1.0].
  • f32 - Normalized dither offset in [-0.5, 0.5].
Source

pub fn get_pixel_rgba(&self, x: u32, y: u32) -> [u8; 4]

Reads the raw RGBA8 bytes at global pixel (x, y) if owned by this band.

§Arguments
  • &Self - Pixel band reference.
  • u32 - X pixel coordinate.
  • u32 - Global Y pixel coordinate.
§Returns
  • [u8; 4] - Pixel RGBA8 bytes ([0, 0, 0, 0] when out of bounds).
Source

pub fn set_pixel_rgba(&mut self, x: u32, y: u32, rgba: [u8; 4])

Writes raw RGBA8 bytes directly to global pixel (x, y) when owned by this band.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - X pixel coordinate.
  • u32 - Global Y pixel coordinate.
  • [u8; 4] - Target RGBA8 pixel bytes.
Source

pub fn lerp_pixel_from_saved_linear( &mut self, x: u32, y: u32, saved_rgba: [u8; 4], cov: f32, )

Blends the current rasterized pixel at (x, y) back toward saved_rgba using linear-light clip coverage cov.

§Arguments
  • &Self - Mutable pixel band.
  • u32 - X pixel coordinate.
  • u32 - Global Y pixel coordinate.
  • [u8; 4] - Pre-command saved RGBA8 pixel bytes.
  • f32 - Clip mask coverage in [0.0, 1.0] (1.0 keeps current pixel, 0.0 restores saved_rgba).

Trait Implementations§

Source§

impl<'a> Debug for PixelBand<'a>

Source§

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

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

impl<'a> Eq for PixelBand<'a>

Source§

impl<'a> PartialEq for PixelBand<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for PixelBand<'a>

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for PixelBand<'a>

§

impl<'a> Forget for PixelBand<'a>

§

impl<'a> Freeze for PixelBand<'a>
where &'a mut [u8]: Freeze,

§

impl<'a> Move for PixelBand<'a>

§

impl<'a> RefUnwindSafe for PixelBand<'a>

§

impl<'a> Send for PixelBand<'a>

§

impl<'a> Sync for PixelBand<'a>

§

impl<'a> Unpin for PixelBand<'a>
where &'a mut [u8]: Unpin,

§

impl<'a> UnsafeUnpin for PixelBand<'a>
where &'a mut [u8]: UnsafeUnpin,

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, 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.