Skip to main content

PixfmtGray8

Struct PixfmtGray8 

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

Pixel format for non-premultiplied Gray8 (1 byte per pixel).

Port of C++ pixfmt_alpha_blend_gray<blender_gray<gray8>, rendering_buf, 1, 0>. Each pixel is a single byte representing luminance.

Since there is no alpha channel stored in the buffer, pixel() always returns a=255. Blending uses the source color’s alpha to interpolate the gray value.

Implementations§

Source§

impl<'a> PixfmtGray8<'a>

Source

pub fn new(rbuf: &'a mut RowAccessor) -> Self

Source

pub fn clear(&mut self, c: &Gray8)

Clear the entire buffer to a solid gray value.

Trait Implementations§

Source§

impl<'a> PixelFormat for PixfmtGray8<'a>

Source§

type ColorType = Gray8

Source§

fn width(&self) -> u32

Source§

fn height(&self) -> u32

Source§

fn pixel(&self, x: i32, y: i32) -> Gray8

Get the pixel color at (x, y).
Source§

fn copy_pixel(&mut self, x: i32, y: i32, c: &Gray8)

Copy (overwrite) a single pixel at (x, y) with color c.
Source§

fn copy_hline(&mut self, x: i32, y: i32, len: u32, c: &Gray8)

Copy (overwrite) a horizontal line of len pixels with color c.
Source§

fn blend_pixel(&mut self, x: i32, y: i32, c: &Gray8, cover: CoverType)

Blend a single pixel at (x, y) with color c and coverage cover.
Source§

fn blend_hline(&mut self, x: i32, y: i32, len: u32, c: &Gray8, cover: CoverType)

Blend a horizontal line of len pixels at (x, y) with uniform color and coverage.
Source§

fn blend_solid_hspan( &mut self, x: i32, y: i32, len: u32, c: &Gray8, covers: &[CoverType], )

Blend a horizontal span of len pixels with per-pixel coverage values.
Source§

fn blend_color_hspan( &mut self, x: i32, y: i32, len: u32, colors: &[Gray8], covers: &[CoverType], cover: CoverType, )

Blend a horizontal span with per-pixel colors and optional per-pixel coverage. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PixfmtGray8<'a>

§

impl<'a> RefUnwindSafe for PixfmtGray8<'a>

§

impl<'a> !Send for PixfmtGray8<'a>

§

impl<'a> !Sync for PixfmtGray8<'a>

§

impl<'a> Unpin for PixfmtGray8<'a>

§

impl<'a> !UnwindSafe for PixfmtGray8<'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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.