pub struct IccProfile {
pub name: String,
pub data: Vec<u8>,
pub components: u8,
pub color_space: IccColorSpace,
pub range: Option<Vec<f64>>,
pub metadata: HashMap<String, String>,
}Expand description
ICC color profile data
Fields§
§name: StringProfile name for referencing
data: Vec<u8>Raw ICC profile data
components: u8Number of color components
color_space: IccColorSpaceColor space type (RGB, CMYK, Lab, etc.)
range: Option<Vec<f64>>Range array for color components
metadata: HashMap<String, String>Additional metadata
Implementations§
Source§impl IccProfile
impl IccProfile
Sourcepub fn new(name: String, data: Vec<u8>, color_space: IccColorSpace) -> Self
pub fn new(name: String, data: Vec<u8>, color_space: IccColorSpace) -> Self
Create a new ICC profile
Sourcepub fn from_standard(profile: StandardIccProfile) -> Self
pub fn from_standard(profile: StandardIccProfile) -> Self
Create ICC profile from standard profile
Sourcepub fn with_range(self, range: Vec<f64>) -> Self
pub fn with_range(self, range: Vec<f64>) -> Self
Set custom range for color components
Sourcepub fn with_metadata(self, key: String, value: String) -> Self
pub fn with_metadata(self, key: String, value: String) -> Self
Add metadata to the profile
Sourcepub fn to_pdf_color_space_array(&self) -> Result<Vec<Object>>
pub fn to_pdf_color_space_array(&self) -> Result<Vec<Object>>
Generate ICC-based color space array for PDF
Trait Implementations§
Source§impl Clone for IccProfile
impl Clone for IccProfile
Source§fn clone(&self) -> IccProfile
fn clone(&self) -> IccProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IccProfile
impl Debug for IccProfile
Source§impl From<&IccProfile> for PageColorSpace
impl From<&IccProfile> for PageColorSpace
Source§fn from(profile: &IccProfile) -> Self
fn from(profile: &IccProfile) -> Self
Bridge an IccProfile into a stream-backed ICC colour space
(PageColorSpace::IccStream), carrying the profile bytes so the
writer emits a conformant /ICCBased stream (ISO 32000-1 §8.6.5.5).
/Alternate is derived from the profile’s semantic
IccColorSpace, not just its component
count. Lab profiles fall back to DeviceRGB — the closest device space
(DeviceColorSpace has no Lab variant; DeviceRGB is spec-valid as an
alternate per §8.6.5.5). Generic(n) maps by component count, defaulting
to DeviceRGB for component counts with no exact device space (2, 5, …);
such alternates are a best-effort fallback only.