Struct lcms2::ThreadContext

source ·
pub struct ThreadContext { /* private fields */ }
Expand description

Per-thread context for multi-threaded operation.

There are situations where several instances of Little CMS engine have to coexist but on different conditions. For example, when the library is used as a DLL or a shared object, diverse applications may want to use different plug-ins. Another example is when multiple threads are being used in same task and the user wants to pass thread-dependent information to the memory allocators or the logging system. The context is a pointer to an internal structure that keeps track of all plug-ins and static data needed by the THR corresponding function.

A context-aware app could allocate a new context by calling new() or duplicate a yet-existing one by using clone(). Each context can hold different plug-ins, defined by the Plugin parameter. The context can also hold loggers.

Users may associate private data across a void pointer when creating the context, and can retrieve this pointer later.

When you see an error “expected reference, found struct lcms2::GlobalContext”, it means you’ve mixed global and thread-context objects. They don’t work together. For example, if you create a Transform with a context (calling new_*_context()), then it will only support Profile with a context as well.

Implementations§

source§

impl ThreadContext

source

pub fn new() -> Self

source

pub fn user_data(&self) -> *mut c_void

source

pub unsafe fn install_plugin(&mut self, plugin: *mut c_void) -> bool

source

pub fn unregister_plugins(&mut self)

source

pub fn supported_intents(&self) -> HashMap<Intent, &'static CStr>

source

pub fn adaptation_state(&self) -> f64

Adaptation state for absolute colorimetric intent, on all but cmsCreateExtendedTransform.

source

pub fn set_adaptation_state(&mut self, value: f64)

Sets adaptation state for absolute colorimetric intent in the given context. Adaptation state applies on all but cmsCreateExtendedTransformTHR(). Little CMS can handle incomplete adaptation states.

Degree on adaptation 0=Not adapted, 1=Complete adaptation, in-between=Partial adaptation.

source

pub fn set_alarm_codes(&mut self, codes: [u16; 16])

Sets the codes used to mark out-out-gamut on Proofing transforms for a given context. Values are meant to be encoded in 16 bits.

AlarmCodes: Array [16] of codes. ALL 16 VALUES MUST BE SPECIFIED, set to zero unused channels.

source

pub fn alarm_codes(&self) -> [u16; 16]

Gets the current codes used to mark out-out-gamut on Proofing transforms for the given context. Values are meant to be encoded in 16 bits.

source

pub fn set_error_logging_function(&mut self, handler: LogErrorHandlerFunction)

Sets a function to be called if there is an error.

Trait Implementations§

source§

impl AsRef<ThreadContext> for ThreadContext

source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for ThreadContext

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ThreadContext

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ThreadContext

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Drop for ThreadContext

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl RefUnwindSafe for ThreadContext

source§

impl Send for ThreadContext

source§

impl UnwindSafe for ThreadContext

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.