pub struct Framebuffer { /* private fields */ }Expand description
Contiguous RGBA8 pixel framebuffer handed directly to OS surfaces or GPU upload paths.
Implementations§
Source§impl Framebuffer
Pixel access, blitting, BGRA conversion, and deterministic hashing for Framebuffer.
impl Framebuffer
Pixel access, blitting, BGRA conversion, and deterministic hashing for Framebuffer.
Sourcepub fn clear(&mut self, color: Color)
pub fn clear(&mut self, color: Color)
Fills the entire framebuffer with solid color using 64-bit wide stores.
§Arguments
&Self- Mutable framebuffer.Color- Clear color.
Sourcepub fn fill_span(&mut self, x0: u32, x1: u32, y: u32, color: Color)
pub fn fill_span(&mut self, x0: u32, x1: u32, y: u32, color: Color)
Fills or composites a contiguous horizontal pixel span [x0, x1) on row y.
§Arguments
&Self- Mutable framebuffer.u32- Inclusive start X pixel coordinate.u32- Exclusive end X pixel coordinate.u32- Row Y pixel coordinate.Color- Foreground color to write or alpha-blend.
Sourcepub fn fill_span_linear(&mut self, x0: u32, x1: u32, y: u32, color: Color)
pub fn fill_span_linear(&mut self, x0: u32, x1: u32, y: u32, color: Color)
Fills or composites a contiguous horizontal pixel span [x0, x1) on row y using gamma-correct linear-light blending.
§Arguments
&Self- Mutable framebuffer.u32- Inclusive start X pixel coordinate.u32- Exclusive end X pixel coordinate.u32- Row Y pixel coordinate.Color- Foreground color to write or linear-light blend.
Sourcepub fn blend_glyph_row(
&mut self,
dx: u32,
dy: u32,
coverage: &[u8],
color: Color,
) -> usize
pub fn blend_glyph_row( &mut self, dx: u32, dy: u32, coverage: &[u8], color: Color, ) -> usize
Blends a contiguous glyph alpha coverage row directly onto framebuffer row dy starting at dx.
§Arguments
&Self- Mutable framebuffer.u32- Destination starting X pixel coordinate.u32- Destination Y pixel coordinate.&[u8]- Glyph coverage alpha bytes for the clipped horizontal slice.Color- Foreground text color.
§Returns
usize- Number of non-zero coverage pixels shaded.
Sourcepub fn blend_pixel_linear_dithered(
&mut self,
x: u32,
y: u32,
color: Color,
dither: f32,
)
pub fn blend_pixel_linear_dithered( &mut self, x: u32, y: u32, color: Color, dither: f32, )
Blends color over the pixel at (x, y) using gamma-correct linear-light compositing with optional sub-LSB dithering.
§Arguments
&Self- Mutable framebuffer.u32- X pixel coordinate.u32- Y pixel coordinate.Color- Foreground color to composite.f32- Normalized dither offset in[-0.5, 0.5]to eliminate 8-bit banding.
Sourcepub fn blend_pixel_f32_dithered(
&mut self,
x: u32,
y: u32,
color: Color,
alpha_f: f32,
dither: f32,
)
pub fn blend_pixel_f32_dithered( &mut self, x: u32, y: u32, color: Color, alpha_f: f32, dither: f32, )
Blends a foreground RGBA color with continuous floating-point alpha alpha_f in [0.0, 1.0] using linear-light compositing and IGN dithering.
§Arguments
&Self- Mutable framebuffer.u32- X pixel coordinate.u32- Y pixel coordinate.Color- Foreground RGB tint (its own alpha is already folded intoalpha_f).f32- Continuous opacity in[0.0, 1.0].f32- Normalized dither offset in[-0.5, 0.5].
Sourcepub fn blend_pixel(&mut self, x: u32, y: u32, color: Color)
pub fn blend_pixel(&mut self, x: u32, y: u32, color: Color)
Blends color over the pixel at (x, y) using fast integer Porter-Duff source-over.
§Arguments
&Self- Mutable framebuffer.u32- X pixel coordinate.u32- Y pixel coordinate.Color- Foreground color to composite.
Sourcepub fn to_bgra_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bgra_bytes(&self) -> Vec<u8> ⓘ
Sourcepub fn fnv1a_hash(&self) -> u64
pub fn fnv1a_hash(&self) -> u64
Sourcepub fn as_band_mut(&mut self) -> PixelBand<'_>
pub fn as_band_mut(&mut self) -> PixelBand<'_>
Sourcepub fn split_bands_mut(
&mut self,
y0: u32,
y1: u32,
band_count: usize,
) -> Vec<PixelBand<'_>>
pub fn split_bands_mut( &mut self, y0: u32, y1: u32, band_count: usize, ) -> Vec<PixelBand<'_>>
Splits rows [y0, y1) of this framebuffer into band_count disjoint mutable PixelBand slices for safe parallel rasterization.
§Arguments
&Self- Mutable framebuffer.u32- Inclusive starting physical Y row.u32- Exclusive ending physical Y row.usize- Requested number of parallel bands.
§Returns
Vec<PixelBand<'_>>- Non-overlapping mutable horizontal bands covering[y0, y1).