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
impl ThreadContext
pub fn new() -> Self
pub fn user_data(&self) -> *mut c_void
pub unsafe fn install_plugin(&mut self, plugin: *mut c_void) -> bool
pub fn unregister_plugins(&mut self)
pub fn supported_intents(&self) -> HashMap<Intent, &'static CStr>
sourcepub fn adaptation_state(&self) -> f64
pub fn adaptation_state(&self) -> f64
Adaptation state for absolute colorimetric intent, on all but cmsCreateExtendedTransform
.
sourcepub fn set_adaptation_state(&mut self, value: f64)
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.
sourcepub fn set_alarm_codes(&mut self, codes: [u16; 16])
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.
sourcepub fn alarm_codes(&self) -> [u16; 16]
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.
sourcepub fn set_error_logging_function(&mut self, handler: LogErrorHandlerFunction)
pub fn set_error_logging_function(&mut self, handler: LogErrorHandlerFunction)
Sets a function to be called if there is an error.