Struct pdfium_render::color::PdfColor
source · pub struct PdfColor { /* private fields */ }Expand description
A 32-bit RGB color value with an optional alpha channel.
A variety of non-transparent colors are available as const values on this struct.
Note that when used as a form field highlight color, a solid color with no opacity will overprint any user data in the field. Use the PdfColor::with_alpha() function to apply an alpha channel value to an existing PdfColor.
Implementations§
source§impl PdfColor
impl PdfColor
pub const WHITE: PdfColor = _
pub const BLACK: PdfColor = _
pub const SOLID_WHITE: PdfColor = _
pub const SOLID_RED: PdfColor = _
pub const SOLID_GREEN: PdfColor = _
pub const SOLID_BLUE: PdfColor = _
pub const SOLID_MAGENTA: PdfColor = _
pub const SOLID_CYAN: PdfColor = _
pub const SOLID_YELLOW: PdfColor = _
pub const SOLID_BLACK: PdfColor = _
pub const GREY_90: PdfColor = _
pub const GREY_80: PdfColor = _
pub const GREY_70: PdfColor = _
pub const GREY_60: PdfColor = _
pub const GREY_50: PdfColor = _
pub const GREY_40: PdfColor = _
pub const GREY_30: PdfColor = _
pub const GREY_20: PdfColor = _
pub const GREY_10: PdfColor = _
pub const LIME: PdfColor = _
pub const BLUE: PdfColor = _
pub const YELLOW: PdfColor = _
pub const CYAN: PdfColor = _
pub const MAGENTA: PdfColor = _
pub const SILVER: PdfColor = _
pub const OLIVE: PdfColor = _
pub const PURPLE: PdfColor = _
pub const TEAL: PdfColor = _
pub const NAVY: PdfColor = _
pub const MAROON: PdfColor = _
pub const DARK_RED: PdfColor = _
pub const BROWN: PdfColor = _
pub const FIREBRICK: PdfColor = _
pub const CRIMSON: PdfColor = _
pub const RED: PdfColor = _
pub const TOMATO: PdfColor = _
pub const CORAL: PdfColor = _
pub const INDIAN_RED: PdfColor = _
pub const LIGHT_CORAL: PdfColor = _
pub const DARK_SALMON: PdfColor = _
pub const SALMON: PdfColor = _
pub const LIGHT_SALMON: PdfColor = _
pub const ORANGE_RED: PdfColor = _
pub const DARK_ORANGE: PdfColor = _
pub const ORANGE: PdfColor = _
pub const GOLD: PdfColor = _
pub const DARK_GOLDEN_ROD: PdfColor = _
pub const GOLDEN_ROD: PdfColor = _
pub const PALE_GOLDEN_ROD: PdfColor = _
pub const DARK_KHAKI: PdfColor = _
pub const KHAKI: PdfColor = _
pub const YELLOW_GREEN: PdfColor = _
pub const DARK_OLIVE_GREEN: PdfColor = _
pub const OLIVE_DRAB: PdfColor = _
pub const LAWN_GREEN: PdfColor = _
pub const CHARTREUSE: PdfColor = _
pub const GREEN_YELLOW: PdfColor = _
pub const DARK_GREEN: PdfColor = _
pub const GREEN: PdfColor = _
pub const FOREST_GREEN: PdfColor = _
pub const LIME_GREEN: PdfColor = _
pub const LIGHT_GREEN: PdfColor = _
pub const PALE_GREEN: PdfColor = _
pub const DARK_SEA_GREEN: PdfColor = _
pub const MEDIUM_SPRING_GREEN: PdfColor = _
pub const SPRING_GREEN: PdfColor = _
pub const SEA_GREEN: PdfColor = _
pub const MEDIUM_AQUA_MARINE: PdfColor = _
pub const MEDIUM_SEA_GREEN: PdfColor = _
pub const LIGHT_SEA_GREEN: PdfColor = _
pub const DARK_SLATE_GRAY: PdfColor = _
pub const DARK_CYAN: PdfColor = _
pub const AQUA: PdfColor = _
pub const LIGHT_CYAN: PdfColor = _
pub const DARK_TURQUOISE: PdfColor = _
pub const TURQUOISE: PdfColor = _
pub const MEDIUM_TURQUOISE: PdfColor = _
pub const PALE_TURQUOISE: PdfColor = _
pub const AQUA_MARINE: PdfColor = _
pub const POWDER_BLUE: PdfColor = _
pub const CADET_BLUE: PdfColor = _
pub const STEEL_BLUE: PdfColor = _
pub const CORNFLOWER_BLUE: PdfColor = _
pub const DEEP_SKY_BLUE: PdfColor = _
pub const DODGER_BLUE: PdfColor = _
pub const LIGHT_BLUE: PdfColor = _
pub const SKY_BLUE: PdfColor = _
pub const LIGHT_SKY_BLUE: PdfColor = _
pub const MIDNIGHT_BLUE: PdfColor = _
pub const DARK_BLUE: PdfColor = _
pub const MEDIUM_BLUE: PdfColor = _
pub const ROYAL_BLUE: PdfColor = _
pub const BLUE_VIOLET: PdfColor = _
pub const INDIGO: PdfColor = _
pub const DARK_SLATE_BLUE: PdfColor = _
pub const SLATE_BLUE: PdfColor = _
pub const MEDIUM_SLATE_BLUE: PdfColor = _
pub const MEDIUM_PURPLE: PdfColor = _
pub const DARK_MAGENTA: PdfColor = _
pub const DARK_VIOLET: PdfColor = _
pub const DARK_ORCHID: PdfColor = _
pub const MEDIUM_ORCHID: PdfColor = _
pub const THISTLE: PdfColor = _
pub const PLUM: PdfColor = _
pub const VIOLET: PdfColor = _
pub const ORCHID: PdfColor = _
pub const MEDIUM_VIOLET_RED: PdfColor = _
pub const PALE_VIOLET_RED: PdfColor = _
pub const DEEP_PINK: PdfColor = _
pub const HOT_PINK: PdfColor = _
pub const LIGHT_PINK: PdfColor = _
pub const PINK: PdfColor = _
pub const ANTIQUE_WHITE: PdfColor = _
pub const BEIGE: PdfColor = _
pub const BISQUE: PdfColor = _
pub const BLANCHED_ALMOND: PdfColor = _
pub const WHEAT: PdfColor = _
pub const CORN_SILK: PdfColor = _
pub const LEMON_CHIFFON: PdfColor = _
pub const LIGHT_GOLDEN_ROD_YELLOW: PdfColor = _
pub const LIGHT_YELLOW: PdfColor = _
pub const SADDLE_BROWN: PdfColor = _
pub const SIENNA: PdfColor = _
pub const CHOCOLATE: PdfColor = _
pub const PERU: PdfColor = _
pub const SANDY_BROWN: PdfColor = _
pub const BURLY_WOOD: PdfColor = _
pub const TAN: PdfColor = _
pub const ROSY_BROWN: PdfColor = _
pub const MOCCASIN: PdfColor = _
pub const NAVAJO_WHITE: PdfColor = _
pub const PEACH_PUFF: PdfColor = _
pub const MISTY_ROSE: PdfColor = _
pub const LAVENDER_BLUSH: PdfColor = _
pub const LINEN: PdfColor = _
pub const OLD_LACE: PdfColor = _
pub const PAPAYA_WHIP: PdfColor = _
pub const SEA_SHELL: PdfColor = _
pub const MINT_CREAM: PdfColor = _
pub const SLATE_GRAY: PdfColor = _
pub const LIGHT_SLATE_GRAY: PdfColor = _
pub const LIGHT_STEEL_BLUE: PdfColor = _
pub const LAVENDER: PdfColor = _
pub const FLORAL_WHITE: PdfColor = _
pub const ALICE_BLUE: PdfColor = _
pub const GHOST_WHITE: PdfColor = _
pub const HONEYDEW: PdfColor = _
pub const IVORY: PdfColor = _
pub const AZURE: PdfColor = _
pub const SNOW: PdfColor = _
pub const DIM_GREY: PdfColor = _
pub const GREY: PdfColor = _
pub const DARK_GREY: PdfColor = _
pub const LIGHT_GREY: PdfColor = _
pub const GAINSBORO: PdfColor = _
pub const WHITE_SMOKE: PdfColor = _
sourcepub const fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self
pub const fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self
Constructs a new PdfColor object from the given arguments.
sourcepub fn from_hex(hex: &str) -> Result<Self, PdfiumError>
pub fn from_hex(hex: &str) -> Result<Self, PdfiumError>
Returns the result of importing the given hexadecimal color specification,
as in HTML. For example, #800080 represents a shade of purple with 100% opacity,
and #40800080 is the same shade of purple with 25% opacity. The leading hash
symbol is required.
sourcepub const fn mix(a: &PdfColor, b: &PdfColor) -> Self
pub const fn mix(a: &PdfColor, b: &PdfColor) -> Self
Returns the result of averaging the RGB and alpha values of the two given PdfColor objects.
sourcepub const fn with_alpha(&self, alpha: u8) -> Self
pub const fn with_alpha(&self, alpha: u8) -> Self
Constructs a new PdfColor by copying the red, green, and blue color components of this color and applying the given alpha value.
sourcepub fn alpha(&self) -> u8
pub fn alpha(&self) -> u8
Returns the alpha (opacity) component of this color, with 0 = completely transparent and 255 = completely opaque (solid).
sourcepub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
Returns the hexadecimal representation of this color, as in HTML, without
a leading hash symbol. Excludes the alpha channel value. For example,
PdfColor::PURPLE.to_hex() will return “800080”.
sourcepub fn to_hex_with_alpha(&self) -> String
pub fn to_hex_with_alpha(&self) -> String
Returns the hexadecimal representation of this color, as in HTML, without
a leading hash symbol. Includes the alpha channel value. For example,
PdfColor::PURPLE.to_hex_with_alpha() will return “FF800080”.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PdfColor
impl RefUnwindSafe for PdfColor
impl Send for PdfColor
impl Sync for PdfColor
impl Unpin for PdfColor
impl UnwindSafe for PdfColor
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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>
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>
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