pub struct ColorPolicy { /* private fields */ }Expand description
Document-level color management policy.
Captures the output intent, fallback profile, default rendering intent, and a registry of named embedded profiles. This is a format-agnostic representation — serialization to PDF/X, ODF, or EPUB is handled by the consuming crate.
§Examples
use appthere_color::{ColorPolicy, OutputIntent, IccProfile, RenderingIntent};
let policy = ColorPolicy::builder()
.output_intent(OutputIntent::new(
"sRGB".to_string(),
IccProfile::new_srgb(),
))
.default_intent(RenderingIntent::RelativeColorimetric)
.build();Implementations§
Source§impl ColorPolicy
impl ColorPolicy
Sourcepub fn builder() -> ColorPolicyBuilder
pub fn builder() -> ColorPolicyBuilder
Creates a new ColorPolicyBuilder.
§Examples
use appthere_color::ColorPolicy;
let builder = ColorPolicy::builder();Sourcepub fn output_intent(&self) -> Option<&OutputIntent>
pub fn output_intent(&self) -> Option<&OutputIntent>
Returns the output intent, if set.
§Examples
use appthere_color::ColorPolicy;
let policy = ColorPolicy::builder().build();
assert!(policy.output_intent().is_none());Sourcepub fn fallback_profile(&self) -> Option<&IccProfile>
pub fn fallback_profile(&self) -> Option<&IccProfile>
Returns the fallback profile, if set.
§Examples
use appthere_color::ColorPolicy;
let policy = ColorPolicy::builder().build();
assert!(policy.fallback_profile().is_none());Sourcepub fn default_intent(&self) -> RenderingIntent
pub fn default_intent(&self) -> RenderingIntent
Returns the default rendering intent for this policy.
§Examples
use appthere_color::{ColorPolicy, RenderingIntent};
let policy = ColorPolicy::builder().build();
assert_eq!(policy.default_intent(), RenderingIntent::Perceptual);Sourcepub fn get_profile(&self, name: &str) -> Option<&IccProfile>
pub fn get_profile(&self, name: &str) -> Option<&IccProfile>
Looks up a named embedded profile in the registry.
§Examples
use appthere_color::{ColorPolicy, IccProfile};
let policy = ColorPolicy::builder()
.embed_profile("sRGB".to_string(), IccProfile::new_srgb())
.build();
assert!(policy.get_profile("sRGB").is_some());
assert!(policy.get_profile("AdobeRGB").is_none());Trait Implementations§
Source§impl Clone for ColorPolicy
impl Clone for ColorPolicy
Source§fn clone(&self) -> ColorPolicy
fn clone(&self) -> ColorPolicy
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 ColorPolicy
impl RefUnwindSafe for ColorPolicy
impl Send for ColorPolicy
impl Sync for ColorPolicy
impl Unpin for ColorPolicy
impl UnsafeUnpin for ColorPolicy
impl UnwindSafe for ColorPolicy
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