pub struct IndexedColorSpace {
pub base_space: BaseColorSpace,
pub hival: u8,
pub lookup_table: ColorLookupTable,
pub name: Option<String>,
}Expand description
Indexed color space representation
Fields§
§base_space: BaseColorSpaceBase color space (DeviceRGB, DeviceCMYK, DeviceGray, or ICCBased)
hival: u8Maximum valid index value (0 to hival, max 255)
lookup_table: ColorLookupTableColor lookup table
name: Option<String>Optional name for the indexed color space
Implementations§
Source§impl IndexedColorSpace
impl IndexedColorSpace
Sourcepub fn new(
base_space: BaseColorSpace,
lookup_table: ColorLookupTable,
) -> Result<Self>
pub fn new( base_space: BaseColorSpace, lookup_table: ColorLookupTable, ) -> Result<Self>
Create a new indexed color space
Sourcepub fn from_palette(colors: &[Color]) -> Result<Self>
pub fn from_palette(colors: &[Color]) -> Result<Self>
Create an indexed color space from a palette
Sourcepub fn web_safe_palette() -> Result<Self>
pub fn web_safe_palette() -> Result<Self>
Create a web-safe color palette (216 colors)
Sourcepub fn grayscale_palette(levels: u8) -> Result<Self>
pub fn grayscale_palette(levels: u8) -> Result<Self>
Create a grayscale palette
Sourcepub fn find_closest_index(&self, target: &Color) -> u8
pub fn find_closest_index(&self, target: &Color) -> u8
Find closest color index for a given color
Sourcepub fn to_pdf_array(&self) -> Result<Vec<Object>>
pub fn to_pdf_array(&self) -> Result<Vec<Object>>
Convert to PDF color space array
Sourcepub fn color_count(&self) -> usize
pub fn color_count(&self) -> usize
Get the number of colors
Trait Implementations§
Source§impl Clone for IndexedColorSpace
impl Clone for IndexedColorSpace
Source§fn clone(&self) -> IndexedColorSpace
fn clone(&self) -> IndexedColorSpace
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for IndexedColorSpace
impl RefUnwindSafe for IndexedColorSpace
impl Send for IndexedColorSpace
impl Sync for IndexedColorSpace
impl Unpin for IndexedColorSpace
impl UnwindSafe for IndexedColorSpace
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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