Skip to main content

PipeState

Struct PipeState 

Source
pub struct PipeState<'bmp> {
    pub blend_mode: BlendMode,
    pub a_input: u8,
    pub overprint_mask: u32,
    pub overprint_additive: bool,
    pub transfer: TransferSet<'bmp>,
    pub soft_mask: Option<&'bmp [u8]>,
    pub alpha0: Option<&'bmp [u8]>,
    pub knockout: bool,
    pub knockout_opacity: u8,
    pub non_isolated_group: bool,
}
Expand description

Immutable parameters for one paint operation, built once per fill/stroke/glyph call.

'bmp borrows slices out of the destination bitmap’s alpha plane and the current graphics state’s transfer tables.

Fields§

§blend_mode: BlendMode

Compositing blend mode.

§a_input: u8

Source opacity, pre-scaled: state.fill_alpha * 255.0 rounded to u8. For stroke operations the caller passes stroke_alpha * 255.0.

§overprint_mask: u32

Overprint mask: bit k set means channel k is painted. 0xFFFF_FFFF means all channels are painted (the default).

§overprint_additive: bool

If true, overprinted channels are additively blended (ink accumulation) rather than replaced. Corresponds to state.overprint_additive.

§transfer: TransferSet<'bmp>

Transfer function tables for the current pixel mode, borrowed from GraphicsState. Applied to the composited result before writing.

§soft_mask: Option<&'bmp [u8]>

Soft mask alpha plane for the current transparency group, if any. One byte per bitmap pixel; shares the bitmap’s row stride. When Some, a_input is multiplied by the soft mask value per pixel.

§alpha0: Option<&'bmp [u8]>

Group alpha0 plane (non-isolated transparency group). One byte per bitmap pixel; None for isolated groups and normal painting.

§knockout: bool

true if this is a knockout group: later objects replace earlier objects within the group rather than compositing on top of them.

§knockout_opacity: u8

For knockout compositing: the accumulated group opacity threshold.

§non_isolated_group: bool

true if we are inside a non-isolated group.

Implementations§

Source§

impl PipeState<'_>

Source

pub const fn no_transparency(&self, uses_shape: bool) -> bool

Returns true when the simple (no-transparency) fast path is applicable.

Matches C++ pipe->noTransparency: a_input == 255 && no soft_mask && no shape && !in_non_isolated_group && !in_knockout_group

Overprint must be excluded: the simple path overwrites dst_pixels before reading the original destination, making channel-selective restore impossible.

Source

pub fn use_aa_path(&self) -> bool

Returns true when the AA (shape-only) fast path is applicable.

Matches C++ pipeRunAA* selection condition: no pattern, not noTransparency, no soft_mask, usesShape, no alpha0, BlendMode::Normal, not non_isolated_group.

Trait Implementations§

Source§

impl<'bmp> Clone for PipeState<'bmp>

Source§

fn clone(&self) -> PipeState<'bmp>

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<'bmp> Debug for PipeState<'bmp>

Source§

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

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

impl<'bmp> Copy for PipeState<'bmp>

Auto Trait Implementations§

§

impl<'bmp> Freeze for PipeState<'bmp>

§

impl<'bmp> RefUnwindSafe for PipeState<'bmp>

§

impl<'bmp> Send for PipeState<'bmp>

§

impl<'bmp> Sync for PipeState<'bmp>

§

impl<'bmp> Unpin for PipeState<'bmp>

§

impl<'bmp> UnsafeUnpin for PipeState<'bmp>

§

impl<'bmp> UnwindSafe for PipeState<'bmp>

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