Skip to main content

PlaneMask

Struct PlaneMask 

Source
pub struct PlaneMask { /* private fields */ }
Expand description

Bitmask selecting which planes to process in a multi-plane operation.

Supports up to 8 planes. Operations that only affect certain channels (e.g., luma sharpening) use this to skip untouched planes.

§Examples

use zenpixels::PlaneMask;

let mask = PlaneMask::LUMA.union(PlaneMask::ALPHA);
assert!(mask.includes(0));  // luma
assert!(!mask.includes(1)); // chroma Cb
assert!(mask.includes(3));  // alpha
assert_eq!(mask.count(), 2);

Implementations§

Source§

impl PlaneMask

Source

pub const ALL: PlaneMask

All planes (bits 0–7).

Source

pub const NONE: PlaneMask

No planes.

Source

pub const LUMA: PlaneMask

Plane 0 only (luma / lightness / red / gray).

Source

pub const CHROMA: PlaneMask

Planes 1 and 2 (chroma Cb + Cr, or Oklab a + b).

Source

pub const ALPHA: PlaneMask

Plane 3 (alpha).

Source

pub const fn single(idx: usize) -> PlaneMask

Mask for a single plane by index (0–7).

Source

pub const fn includes(&self, idx: usize) -> bool

Whether the plane at idx is included in this mask.

Source

pub const fn union(self, other: PlaneMask) -> PlaneMask

Union of two masks.

Source

pub const fn intersection(self, other: PlaneMask) -> PlaneMask

Intersection of two masks.

Source

pub const fn count(&self) -> u32

Number of planes selected.

Source

pub const fn is_empty(&self) -> bool

Whether no planes are selected.

Source

pub const fn bits(&self) -> u8

The raw bitmask value.

Source

pub const fn from_bits(bits: u8) -> PlaneMask

Construct from a raw bitmask value.

Trait Implementations§

Source§

impl Clone for PlaneMask

Source§

fn clone(&self) -> PlaneMask

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 Copy for PlaneMask

Source§

impl Debug for PlaneMask

Source§

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

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

impl Display for PlaneMask

Source§

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

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

impl Eq for PlaneMask

Source§

impl Hash for PlaneMask

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PlaneMask

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PlaneMask

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.