Skip to main content

MaskRaster

Struct MaskRaster 

Source
pub struct MaskRaster {
    pub data: Vec<u8>,
    pub width: u32,
    pub height: u32,
    pub origin_x: i32,
    pub origin_y: i32,
    pub scale_x: f32,
    pub scale_y: f32,
}
Expand description

A pre-rasterized soft mask, cached on the display-list SoftMasked element so the renderer can build it once at gs-time CTM and sample it per content pixel without re-rasterizing for every band.

The renderer holds the mask raster in its own device-space pixel coordinate system (anchored at (origin_x, origin_y)) rather than the SoftMasked.params.bbox viewport, because the mask form’s internal cm operators may translate the actual paint elements outside the form’s /BBox after the gs-time CTM is applied. Sampling per content pixel by device coordinates decouples the mask and content coordinate systems entirely.

Fields§

§data: Vec<u8>

Single-channel mask values (luminosity or alpha), row-major.

§width: u32

Width of the raster in pixels.

§height: u32

Height of the raster in pixels.

§origin_x: i32

Top-left corner of the raster in device-space pixels at scale.

§origin_y: i32

Top-left corner of the raster in device-space pixels at scale.

§scale_x: f32

Horizontal scale at which the raster was built. The CLI egui viewer and the WASM viewport both re-render the same captured display list at varying zoom scales, so the cache must invalidate when this changes.

§scale_y: f32

Vertical scale at which the raster was built.

Trait Implementations§

Source§

impl Clone for MaskRaster

Source§

fn clone(&self) -> MaskRaster

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MaskRaster

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.