Skip to main content

PalettedRgba

Struct PalettedRgba 

Source
pub struct PalettedRgba<'p> {
    pub index: u8,
    /* private fields */
}
Expand description

Represents a paletted pixel, holding an index to a palette of Rgba colors represented as a &'p [Rgba], where 'p is the lifetime of the palette.

Fields§

§index: u8

Trait Implementations§

Source§

impl<'p> Clone for PalettedRgba<'p>

Source§

fn clone(&self) -> PalettedRgba<'p>

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<'p> Copy for PalettedRgba<'p>

Source§

impl Debug for PalettedRgba<'_>

Source§

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

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

impl Default for PalettedRgba<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'p> Eq for PalettedRgba<'p>

Source§

impl From<PalettedRgba<'_>> for Rgb

Source§

fn from(pixel: PalettedRgba<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<PalettedRgba<'_>> for Rgba

Source§

fn from(pixel: PalettedRgba<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<PalettedRgba<'_>> for L

Source§

fn from(pixel: PalettedRgba<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<PalettedRgba<'_>> for BitPixel

Source§

fn from(pixel: PalettedRgba<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<PalettedRgba<'_>> for Dynamic

Source§

fn from(pixel: PalettedRgba<'_>) -> Self

Converts to this type from the input type.
Source§

impl<'p> Hash for PalettedRgba<'p>

Source§

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

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<'p> Not for PalettedRgba<'p>

Source§

type Output = PalettedRgba<'p>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<'p> Paletted<'p> for PalettedRgba<'p>

Source§

fn from_palette(palette: &'p [Self::Color], index: Self::Subpixel) -> Self

Creates this pixel from the given palette and index. For unpaletted pixels, use Pixel::from_arbitrary_palette instead. Read more
Source§

fn palette(&self) -> &'p [Self::Color]

Returns the palette lookup as a slice.
Source§

fn palette_index(&self) -> u8

Returns the index in the palette this pixel is of.
Source§

fn color(&self) -> Self::Color

Resolves the color of the pixel. Because invalid palette values are supposed to be propagated prior to calling this, this will panic
Source§

unsafe fn color_unchecked(&self) -> Self::Color

Resolves the color of the pixel. Invalid palette values should be propagated prior to to calling this, but it isn’t guaranteed, for example if the palette pixel was manually initialized. Read more
Source§

impl<'p> PartialEq for PalettedRgba<'p>

Source§

fn eq(&self, other: &PalettedRgba<'p>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Pixel for PalettedRgba<'_>

Source§

const COLOR_TYPE: ColorType = ColorType::PaletteRgba

The color type of the pixel.
Source§

const BIT_DEPTH: u8 = 8

The bit depth of the pixel.
Source§

type Subpixel = u8

The type of a single component in the pixel.
Source§

type Color = Rgba

The resolved color type of the palette. This is Self for non-paletted pixels.
Source§

type Data = [u8; 1]

The iterator type this pixel uses.
Source§

fn map_subpixels<F, A>(self, f: F, a: A) -> Self
where F: Fn(Self::Subpixel) -> Self::Subpixel, A: Fn(Self::Subpixel) -> Self::Subpixel,

Maps the pixel’s components and returns a new pixel with the mapped components. Read more
Source§

fn from_raw_parts_paletted<P: Pixel>( _color_type: ColorType, _bit_depth: u8, _data: &[u8], _palette: Option<&[P]>, ) -> Result<Self>

Creates this pixel from the given color type, bit depth, data, and possibly a color palette. This may require a lossy xonversion. Read more
Source§

fn from_bytes(_bytes: &[u8]) -> Self

Creates this pixel from a raw bytes. This is used internally and is unchecked - it panics if the data is not of the correct length.
Source§

fn as_bytes(&self) -> Self::Data

Turns this pixel into bytes.
Source§

fn merge_with_alpha(self, other: Self, alpha: u8) -> Self

Merges this pixel with the given overlay pixel, where the alpha of the overlay pixel is known. This is used in anti-aliasing.
Source§

fn from_dynamic(_dynamic: Dynamic) -> Self

Creates this pixel from any dynamic pixel, dynamically at runtime. Different from the From/Into traits.
Source§

fn as_rgb(&self) -> Rgb

Returns this pixel as RGB despite its type. This can panic on some pixel types, you must be sure this pixel is able to be converted into RGB before using this. Read more
Source§

fn as_rgba(&self) -> Rgba

Returns this pixel as RGBA despite its type. This can panic on some pixel types, you must be sure this pixel is able to be converted into RGBA before using this. Read more
Source§

fn color_type(&self) -> ColorType

Resolves the color type of this pixel at runtime. This is used for dynamic color types. If you are certain the pixel is not dynamic, you can use the Self::COLOR_TYPE constant instead.
Source§

fn luminance(&self) -> u8
where Self: Into<L>,

The luminance of the pixel.
Source§

fn from_raw_parts( color_type: ColorType, bit_depth: u8, data: &[u8], ) -> Result<Self>

Creates this pixel from the given color type, bit depth, and data. This may require a lossy conversion. Read more
Source§

fn from_arbitrary_palette<P: Pixel>(palette: &[P], index: usize) -> Result<Self>

Creates this pixel from the given palette and index, but the conversion is done at runtime. Read more
Source§

fn merge(self, other: Self) -> Self

Merges this pixel with the given overlay pixel, taking into account alpha.
Source§

fn overlay(self, other: Self, mode: OverlayMode) -> Self

Overlays this pixel with the given overlay pixel, abiding by the given overlay mode.
Source§

fn overlay_with_alpha(self, other: Self, mode: OverlayMode, alpha: u8) -> Self

Overlays this pixel with the given overlay pixel, abiding by the given overlay mode with the given alpha. Read more
Source§

impl<'p> StructuralPartialEq for PalettedRgba<'p>

Auto Trait Implementations§

§

impl<'p> Freeze for PalettedRgba<'p>

§

impl<'p> RefUnwindSafe for PalettedRgba<'p>

§

impl<'p> Send for PalettedRgba<'p>

§

impl<'p> Sync for PalettedRgba<'p>

§

impl<'p> Unpin for PalettedRgba<'p>

§

impl<'p> UnsafeUnpin for PalettedRgba<'p>

§

impl<'p> UnwindSafe for PalettedRgba<'p>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P> IntoFill for P
where P: Pixel,

Source§

type Pixel = P

The pixel type of the fill.
Source§

type Fill = SolidFill<<P as IntoFill>::Pixel>

The fill type.
Source§

fn into_fill(self) -> <P as IntoFill>::Fill

Converts the fill into a fill type.
Source§

impl<P> MaybeSealed for P
where P: Sealed,

Source§

const SEALED: bool = const SEALED: bool = true;

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.