Skip to main content

MatrixTransform

Struct MatrixTransform 

Source
pub struct MatrixTransform { /* private fields */ }
Expand description

A 4x4 matrix transform plus RGBA offset.

Matrix transforms are commonly used for channel scaling, saturation, luminance views, and fitted range remapping.

Implementations§

Source§

impl MatrixTransform

Source

pub fn fit_into( m: &mut [f64; 16], o: &mut [f64; 4], old_min: &[f64; 4], old_max: &[f64; 4], new_min: &[f64; 4], new_max: &[f64; 4], ) -> Result<()>

Write OCIO’s fitted matrix and offset into caller-owned arrays. On error, the output arrays may have been partially modified by OCIO.

Source

pub fn sat_into( m: &mut [f64; 16], o: &mut [f64; 4], sat: f64, luma: &[f64; 3], ) -> Result<()>

Write OCIO’s saturation matrix and offset without creating a transform.

Source

pub fn scale_into( m: &mut [f64; 16], o: &mut [f64; 4], scale: &[f64; 4], ) -> Result<()>

Write OCIO’s channel-scale matrix and offset without creating a transform.

Source

pub fn view_into( m: &mut [f64; 16], o: &mut [f64; 4], channels: &mut [i32; 4], luma: &[f64; 3], ) -> Result<()>

Write OCIO’s view matrix and offset, preserving native channel-mask semantics.

Source

pub fn create() -> Result<Self>

Create a new identity matrix transform.

Source

pub fn try_matrix(&self) -> Result<[f64; 16]>

Return the current 4x4 matrix in row-major order.

Source

pub fn matrix(&self) -> [f64; 16]

Return the current 4x4 matrix in row-major order.

Source

pub fn set_matrix(&self, m44: &[f64; 16]) -> Result<()>

Replace the current 4x4 matrix in row-major order.

Source

pub fn try_offset(&self) -> Result<[f64; 4]>

Return the current RGBA offset vector.

Source

pub fn offset(&self) -> [f64; 4]

Return the current RGBA offset vector.

Source

pub fn set_offset(&self, offset4: &[f64; 4]) -> Result<()>

Replace the current RGBA offset vector.

Source

pub fn direction(&self) -> TransformDirection

Return the transform direction used when this op is evaluated.

Source

pub fn set_direction(&self, direction: TransformDirection)

Set the transform direction used when this op is evaluated.

Source

pub fn try_set_direction(&self, direction: TransformDirection) -> Result<()>

Set the transform direction and surface any OCIO validation error.

Source

pub fn create_editable_copy(&self) -> Result<Self>

Create an editable copy that is independent from the original transform.

Source

pub fn file_input_bit_depth(&self) -> BitDepth

Return the bit depth declared for file-based input serialization.

Source

pub fn set_file_input_bit_depth(&self, bit_depth: BitDepth)

Set the bit depth declared for file-based input serialization.

Source

pub fn try_set_file_input_bit_depth(&self, bit_depth: BitDepth) -> Result<()>

Set the serialized input bit depth and surface any OCIO validation error.

Source

pub fn file_output_bit_depth(&self) -> BitDepth

Return the bit depth declared for file-based output serialization.

Source

pub fn set_file_output_bit_depth(&self, bit_depth: BitDepth)

Set the bit depth declared for file-based output serialization.

Source

pub fn try_set_file_output_bit_depth(&self, bit_depth: BitDepth) -> Result<()>

Set the serialized output bit depth and surface any OCIO validation error.

Source

pub fn format_metadata(&self) -> Option<FormatMetadata>

Return format metadata attached to the transform, when available.

Source

pub fn format_metadata_v1(&self) -> Option<FormatMetadata>

👎Deprecated since 0.2.0:

compat alias; prefer format_metadata()

Source

pub fn format_metadata_v2(&self) -> Option<FormatMetadata>

👎Deprecated since 0.2.0:

compat alias; prefer format_metadata()

Source

pub fn equals(&self, other: &Self) -> bool

Return whether this transform is equivalent to other.

Source§

impl MatrixTransform

Source

pub fn fit( old_min: &[f64; 4], old_max: &[f64; 4], new_min: &[f64; 4], new_max: &[f64; 4], ) -> Result<Self>

Create a matrix transform that remaps the inclusive range old_min..old_max into new_min..new_max.

Source

pub fn identity() -> Result<Self>

Create an identity matrix transform.

Source

pub fn sat(sat: f64, luma: &[f64; 3]) -> Result<Self>

Create a saturation matrix using the provided luma coefficients.

Source

pub fn scale(scale: &[f64; 4]) -> Result<Self>

Create a per-channel scale matrix.

Source

pub fn view(channels: &mut [i32; 4], luma: &[f64; 3]) -> Result<Self>

Create a matrix that remaps channels according to a canonical OCIO view mask.

Trait Implementations§

Source§

impl Drop for MatrixTransform

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl TransformHandle for MatrixTransform

Source§

fn as_ptr(&self) -> *mut c_void

Source§

fn diagnostic_text(&self) -> Result<String>

Return OCIO’s diagnostic representation, which may include file paths. This text is not a stable interchange format.
Source§

fn try_type_tag(&self) -> Result<i32>

Return the version-independent tag corresponding to crate::TransformType.
Source§

fn try_set_direction(&mut self, direction: TransformDirection) -> Result<()>

Change the native evaluation direction without modifying the stored parameters.
Source§

fn try_validate(&self) -> Result<()>

Validate the native transform without copying it or building a processor.
Source§

fn try_create_editable_copy(&self) -> Result<Transform>

Create a native editable copy, preserving the concrete transform type. A copied group shares its children with the original. For an independent built-in group graph, use GroupTransform::create_deep_copy.
Source§

fn try_direction(&self) -> Result<TransformDirection>

Query the native direction with validation, for any supported transform.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.