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: u8Trait Implementations§
Source§impl<'p> Clone for PalettedRgba<'p>
impl<'p> Clone for PalettedRgba<'p>
Source§fn clone(&self) -> PalettedRgba<'p>
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'p> Copy for PalettedRgba<'p>
Source§impl Debug for PalettedRgba<'_>
impl Debug for PalettedRgba<'_>
Source§impl Default for PalettedRgba<'_>
impl Default for PalettedRgba<'_>
impl<'p> Eq for PalettedRgba<'p>
Source§impl From<PalettedRgba<'_>> for Rgb
impl From<PalettedRgba<'_>> for Rgb
Source§fn from(pixel: PalettedRgba<'_>) -> Self
fn from(pixel: PalettedRgba<'_>) -> Self
Converts to this type from the input type.
Source§impl From<PalettedRgba<'_>> for Rgba
impl From<PalettedRgba<'_>> for Rgba
Source§fn from(pixel: PalettedRgba<'_>) -> Self
fn from(pixel: PalettedRgba<'_>) -> Self
Converts to this type from the input type.
Source§impl From<PalettedRgba<'_>> for L
impl From<PalettedRgba<'_>> for L
Source§fn from(pixel: PalettedRgba<'_>) -> Self
fn from(pixel: PalettedRgba<'_>) -> Self
Converts to this type from the input type.
Source§impl From<PalettedRgba<'_>> for BitPixel
impl From<PalettedRgba<'_>> for BitPixel
Source§fn from(pixel: PalettedRgba<'_>) -> Self
fn from(pixel: PalettedRgba<'_>) -> Self
Converts to this type from the input type.
Source§impl From<PalettedRgba<'_>> for Dynamic
impl From<PalettedRgba<'_>> for Dynamic
Source§fn from(pixel: PalettedRgba<'_>) -> Self
fn from(pixel: PalettedRgba<'_>) -> Self
Converts to this type from the input type.
Source§impl<'p> Hash for PalettedRgba<'p>
impl<'p> Hash for PalettedRgba<'p>
Source§impl<'p> Not for PalettedRgba<'p>
impl<'p> Not for PalettedRgba<'p>
Source§impl<'p> Paletted<'p> for PalettedRgba<'p>
impl<'p> Paletted<'p> for PalettedRgba<'p>
Source§fn from_palette(palette: &'p [Self::Color], index: Self::Subpixel) -> Self
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 moreSource§fn palette_index(&self) -> u8
fn palette_index(&self) -> u8
Returns the index in the palette this pixel is of.
Source§fn color(&self) -> Self::Color
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
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>
impl<'p> PartialEq for PalettedRgba<'p>
Source§fn eq(&self, other: &PalettedRgba<'p>) -> bool
fn eq(&self, other: &PalettedRgba<'p>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Pixel for PalettedRgba<'_>
impl Pixel for PalettedRgba<'_>
Source§const COLOR_TYPE: ColorType = ColorType::PaletteRgba
const COLOR_TYPE: ColorType = ColorType::PaletteRgba
The color type of the pixel.
Source§type Color = Rgba
type Color = Rgba
The resolved color type of the palette. This is
Self for non-paletted pixels.Source§fn map_subpixels<F, A>(self, f: F, a: A) -> Self
fn map_subpixels<F, A>(self, f: F, a: A) -> Self
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>
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
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 merge_with_alpha(self, other: Self, alpha: u8) -> Self
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
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
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
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
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 from_raw_parts(
color_type: ColorType,
bit_depth: u8,
data: &[u8],
) -> Result<Self>
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>
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
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
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
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
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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