pub struct SpotColor {
pub color_name: String,
pub knockout: bool,
pub spotcolor_name: String,
pub screen_frequency: NonNegativeF64,
pub screen_angle_deg: f64,
/* private fields */
}Expand description
A named spot color with its own CMYK/RGB representation and screen parameters.
Fields§
§color_name: StringThe display name of this color.
knockout: boolWhether this color knocks out colors beneath it.
spotcolor_name: StringThe internal spot-color name used in printing.
screen_frequency: NonNegativeF64Screen ruling frequency (lines per inch).
screen_angle_deg: f64Screen ruling angle in degrees.
Implementations§
Source§impl SpotColor
impl SpotColor
Sourcepub fn new(
color_name: impl Into<String>,
spotcolor_name: impl Into<String>,
cmyk: Cmyk,
) -> Self
pub fn new( color_name: impl Into<String>, spotcolor_name: impl Into<String>, cmyk: Cmyk, ) -> Self
Create a new spot color with the given name and CMYK values.
The RGB mode defaults to FromCmyk and screen parameters to 150.0 frequency and 0.0 angle.
Sourcepub fn get_cmyk(&self) -> Result<Cmyk, Error>
pub fn get_cmyk(&self) -> Result<Cmyk, Error>
Get the effective CMYK value of this spot color.
§Errors
Returns Error::ColorError if the color modes do not define a valid
CMYK value.
Sourcepub fn get_rgb(&self) -> Result<Rgb, Error>
pub fn get_rgb(&self) -> Result<Rgb, Error>
Get the effective RGB value of this spot color.
§Errors
Returns Error::ColorError if the color modes do not define a valid
RGB value.
Sourcepub fn set_cmyk_mode(&mut self, new: CmykMode) -> Result<(), Error>
pub fn set_cmyk_mode(&mut self, new: CmykMode) -> Result<(), Error>
Set the CMYK derivation mode. Fails if a circular dependency would be created.
§Errors
Returns Error::ColorError if new is not valid for a spot color or
would create a circular dependency with the RGB mode.
Sourcepub fn get_cmyk_mode(&self) -> CmykMode
pub fn get_cmyk_mode(&self) -> CmykMode
Get the current CMYK derivation mode.
Sourcepub fn set_rgb_mode(&mut self, new: RgbMode) -> Result<(), Error>
pub fn set_rgb_mode(&mut self, new: RgbMode) -> Result<(), Error>
Set the RGB derivation mode. Fails if a circular dependency would be created.
§Errors
Returns Error::ColorError if new is not valid for a spot color or
would create a circular dependency with the CMYK mode.
Sourcepub fn get_rgb_mode(&self) -> RgbMode
pub fn get_rgb_mode(&self) -> RgbMode
Get the current RGB derivation mode.
Sourcepub fn is_knockout(&self) -> bool
pub fn is_knockout(&self) -> bool
Returns true if this color knocks out colors beneath it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpotColor
impl RefUnwindSafe for SpotColor
impl Send for SpotColor
impl Sync for SpotColor
impl Unpin for SpotColor
impl UnsafeUnpin for SpotColor
impl UnwindSafe for SpotColor
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§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