pub struct Transform { /* private fields */ }Expand description
A colour transform from one profile’s device space to another’s.
Build once (it precomputes lookup tables) and apply to any number of buffers from any thread. Buffers are interleaved; colour channels come first in each pixel and any further channels (alpha, spot) are copied or left alone.
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn new(
src: &Profile,
dst: &Profile,
intent: Intent,
bpc: bool,
) -> Result<Transform, CmsError>
pub fn new( src: &Profile, dst: &Profile, intent: Intent, bpc: bool, ) -> Result<Transform, CmsError>
Transform from src to dst with intent, optionally with black point compensation.
pub fn with_options( src: &Profile, dst: &Profile, opts: TransformOptions, ) -> Result<Transform, CmsError>
Sourcepub fn proof(
src: &Profile,
proof: &Profile,
dst: &Profile,
intent: Intent,
bpc: bool,
simulate_paper: bool,
) -> Result<Transform, CmsError>
pub fn proof( src: &Profile, proof: &Profile, dst: &Profile, intent: Intent, bpc: bool, simulate_paper: bool, ) -> Result<Transform, CmsError>
Soft-proof transform src → proof → dst (Photoshop View › Proof Setup): intent/bpc
apply to the document → proof step; the proof → display step is relative colorimetric
with BPC, or absolute colorimetric without BPC when simulate_paper is set (paper
colour and black ink simulated).
Sourcepub fn from_pipeline(pipeline: Pipeline, opts: TransformOptions) -> Transform
pub fn from_pipeline(pipeline: Pipeline, opts: TransformOptions) -> Transform
Builds a transform from an arbitrary pipeline over normalised values.
pub fn inputs(&self) -> usize
pub fn outputs(&self) -> usize
pub fn options(&self) -> TransformOptions
Sourcepub fn eval(&self, input: &[f32], out: &mut [f32])
pub fn eval(&self, input: &[f32], out: &mut [f32])
Exact evaluation of one colour (inputs → outputs normalised values).
Sourcepub fn eval_fast(&self, input: &[f32], out: &mut [f32])
pub fn eval_fast(&self, input: &[f32], out: &mut [f32])
Lookup-table evaluation of one colour (what integer buffers use).
Sourcepub fn convert_f32(
&self,
src: &[f32],
src_stride: usize,
dst: &mut [f32],
dst_stride: usize,
copy_extra: bool,
)
pub fn convert_f32( &self, src: &[f32], src_stride: usize, dst: &mut [f32], dst_stride: usize, copy_extra: bool, )
Converts float pixels. src/dst hold whole pixels of src_stride/dst_stride
values; colour channels come first. Trailing channels are copied when copy_extra.
Sourcepub fn apply(&self, buf: &mut [f32], stride: usize)
pub fn apply(&self, buf: &mut [f32], stride: usize)
In-place float conversion; stride ≥ max(inputs, outputs).
Sourcepub fn convert_u8(
&self,
src: &[u8],
src_stride: usize,
dst: &mut [u8],
dst_stride: usize,
copy_extra: bool,
)
pub fn convert_u8( &self, src: &[u8], src_stride: usize, dst: &mut [u8], dst_stride: usize, copy_extra: bool, )
Converts 8-bit pixels (see Transform::convert_f32 for the layout).
Sourcepub fn convert_u16(
&self,
src: &[u16],
src_stride: usize,
dst: &mut [u16],
dst_stride: usize,
copy_extra: bool,
)
pub fn convert_u16( &self, src: &[u16], src_stride: usize, dst: &mut [u16], dst_stride: usize, copy_extra: bool, )
Converts 16-bit pixels (see Transform::convert_f32 for the layout).
Sourcepub fn convert_bytes_many(
&self,
sample: SampleKind,
jobs: Vec<(&[u8], &mut [u8])>,
src_stride: usize,
dst_stride: usize,
copy_extra: bool,
)
pub fn convert_bytes_many( &self, sample: SampleKind, jobs: Vec<(&[u8], &mut [u8])>, src_stride: usize, dst_stride: usize, copy_extra: bool, )
Converts many independent buffers of native-endian samples in one parallel pass (e.g.
all tiles of a surface): far cheaper than one parallel call per small buffer. Each job
is (src bytes, dst bytes) holding whole pixels of src_stride/dst_stride samples.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Transform
impl Freeze for Transform
impl Move for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
impl UnwindSafe for Transform
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> 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