Struct qt_gui::QColorSpace

source ·
#[repr(C)]
pub struct QColorSpace { /* private fields */ }
Expand description

Color values can be interpreted in different ways, and based on the interpretation can live in different spaces. We call this color spaces.

C++ class: QColorSpace.

C++ documentation:

Color values can be interpreted in different ways, and based on the interpretation can live in different spaces. We call this color spaces.

QColorSpace provides access to creating several predefined color spaces and can generate QColorTransforms for converting colors from one color space to another.

QColorSpace can also represent color spaces defined by ICC profiles or embedded in images, that do not otherwise fit the predefined color spaces.

A color space can generally speaking be conceived as a combination of set of primary colors and a transfer function. The primaries defines the axes of the color space, and the transfer function how values are mapped on the axes. The primaries are defined by three primary colors that represent exactly how red, green, and blue look in this particular color space, and a white color that represents where and how bright pure white is. The range of colors expressable by the primary colors is called the gamut, and a color space that can represent a wider range of colors is also known as a wide-gamut color space.

The transfer function or gamma curve determines how each component in the color space is encoded. These are used because human perception does not operate linearly, and the transfer functions try to ensure that colors will seem evenly spaced to human eyes.

Implementations§

source§

impl QColorSpace

source

pub unsafe fn copy_from( &self, color_space: impl CastInto<Ref<QColorSpace>> ) -> Ref<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: QColorSpace& QColorSpace::operator=(const QColorSpace& colorSpace).

source

pub unsafe fn from_icc_profile( icc_profile: impl CastInto<Ref<QByteArray>> ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Creates a QColorSpace from ICC profile iccProfile.

Calls C++ function: static QColorSpace QColorSpace::fromIccProfile(const QByteArray& iccProfile).

C++ documentation:

Creates a QColorSpace from ICC profile iccProfile.

Note: Not all ICC profiles are supported. QColorSpace only supports RGB-XYZ ICC profiles that are three-component matrix-based.

If the ICC profile is not supported an invalid QColorSpace is returned where you can still read the original ICC profile using iccProfile().

See also iccProfile().

source

pub unsafe fn gamma(&self) -> c_float

Available on cpp_lib_version="5.14.0" only.

Returns the gamma value of color spaces with TransferFunction::Gamma, an approximate gamma value for other predefined color spaces, or 0.0 if no approximate gamma is known.

Calls C++ function: float QColorSpace::gamma() const.

C++ documentation:

Returns the gamma value of color spaces with TransferFunction::Gamma, an approximate gamma value for other predefined color spaces, or 0.0 if no approximate gamma is known.

See also transferFunction().

source

pub unsafe fn icc_profile(&self) -> CppBox<QByteArray>

Available on cpp_lib_version="5.14.0" only.

Returns an ICC profile representing the color space.

Calls C++ function: QByteArray QColorSpace::iccProfile() const.

C++ documentation:

Returns an ICC profile representing the color space.

If the color space was generated from an ICC profile, that profile is returned, otherwise one is generated.

Note: Even invalid color spaces may return the ICC profile if they were generated from one, to allow applications to implement wider support themselves.

See also fromIccProfile().

source

pub unsafe fn is_valid(&self) -> bool

Available on cpp_lib_version="5.14.0" only.

Returns true if the color space is valid.

Calls C++ function: bool QColorSpace::isValid() const.

C++ documentation:

Returns true if the color space is valid.

source

pub unsafe fn new() -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Creates a new colorspace object that represents an undefined and invalid colorspace.

Calls C++ function: [constructor] void QColorSpace::QColorSpace().

C++ documentation:

Creates a new colorspace object that represents an undefined and invalid colorspace.

source

pub unsafe fn from_named_color_space( named_color_space: NamedColorSpace ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Creates a new colorspace object that represents a namedColorSpace.

Calls C++ function: [constructor] void QColorSpace::QColorSpace(QColorSpace::NamedColorSpace namedColorSpace).

C++ documentation:

Creates a new colorspace object that represents a namedColorSpace.

source

pub unsafe fn from_primaries_transfer_function_float( primaries: Primaries, fun: TransferFunction, gamma: c_float ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Creates a custom color space with the primaries primaries, using the transfer function fun and optionally gamma.

Calls C++ function: [constructor] void QColorSpace::QColorSpace(QColorSpace::Primaries primaries, QColorSpace::TransferFunction fun, float gamma = …).

C++ documentation:

Creates a custom color space with the primaries primaries, using the transfer function fun and optionally gamma.

source

pub unsafe fn from_primaries_float( primaries: Primaries, gamma: c_float ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Creates a custom color space with the primaries primaries, using a gamma transfer function of gamma.

Calls C++ function: [constructor] void QColorSpace::QColorSpace(QColorSpace::Primaries primaries, float gamma).

C++ documentation:

Creates a custom color space with the primaries primaries, using a gamma transfer function of gamma.

source

pub unsafe fn from_4_q_point_f_transfer_function_float( white_point: impl CastInto<Ref<QPointF>>, red_point: impl CastInto<Ref<QPointF>>, green_point: impl CastInto<Ref<QPointF>>, blue_point: impl CastInto<Ref<QPointF>>, fun: TransferFunction, gamma: c_float ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Creates a custom colorspace with a primaries based on the chromaticities of the primary colors whitePoint, redPoint, greenPoint and bluePoint, and using the transfer function fun and optionally gamma.

Calls C++ function: [constructor] void QColorSpace::QColorSpace(const QPointF& whitePoint, const QPointF& redPoint, const QPointF& greenPoint, const QPointF& bluePoint, QColorSpace::TransferFunction fun, float gamma = …).

C++ documentation:

Creates a custom colorspace with a primaries based on the chromaticities of the primary colors whitePoint, redPoint, greenPoint and bluePoint, and using the transfer function fun and optionally gamma.

source

pub unsafe fn from_primaries_transfer_function( primaries: Primaries, fun: TransferFunction ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Creates a custom color space with the primaries primaries, using the transfer function fun and optionally gamma.

Calls C++ function: [constructor] void QColorSpace::QColorSpace(QColorSpace::Primaries primaries, QColorSpace::TransferFunction fun).

C++ documentation:

Creates a custom color space with the primaries primaries, using the transfer function fun and optionally gamma.

source

pub unsafe fn from_4_q_point_f_transfer_function( white_point: impl CastInto<Ref<QPointF>>, red_point: impl CastInto<Ref<QPointF>>, green_point: impl CastInto<Ref<QPointF>>, blue_point: impl CastInto<Ref<QPointF>>, fun: TransferFunction ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Creates a custom colorspace with a primaries based on the chromaticities of the primary colors whitePoint, redPoint, greenPoint and bluePoint, and using the transfer function fun and optionally gamma.

Calls C++ function: [constructor] void QColorSpace::QColorSpace(const QPointF& whitePoint, const QPointF& redPoint, const QPointF& greenPoint, const QPointF& bluePoint, QColorSpace::TransferFunction fun).

C++ documentation:

Creates a custom colorspace with a primaries based on the chromaticities of the primary colors whitePoint, redPoint, greenPoint and bluePoint, and using the transfer function fun and optionally gamma.

source

pub unsafe fn new_copy( color_space: impl CastInto<Ref<QColorSpace>> ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Calls C++ function: [constructor] void QColorSpace::QColorSpace(const QColorSpace& colorSpace).

source

pub unsafe fn primaries(&self) -> Primaries

Available on cpp_lib_version="5.14.0" only.

Returns the predefined primaries of the color space or primaries::Custom if it doesn't match any of them.

Calls C++ function: QColorSpace::Primaries QColorSpace::primaries() const.

C++ documentation:

Returns the predefined primaries of the color space or primaries::Custom if it doesn’t match any of them.

See also setPrimaries().

source

pub unsafe fn set_primaries_1a(&self, primaries_id: Primaries)

Available on cpp_lib_version="5.14.0" only.

Sets the primaries to those of the primariesId set.

Calls C++ function: void QColorSpace::setPrimaries(QColorSpace::Primaries primariesId).

C++ documentation:

Sets the primaries to those of the primariesId set.

See also primaries().

source

pub unsafe fn set_primaries_4a( &self, white_point: impl CastInto<Ref<QPointF>>, red_point: impl CastInto<Ref<QPointF>>, green_point: impl CastInto<Ref<QPointF>>, blue_point: impl CastInto<Ref<QPointF>> )

Available on cpp_lib_version="5.14.0" only.

Set primaries to the chromaticities of whitePoint, redPoint, greenPoint and bluePoint.

Calls C++ function: void QColorSpace::setPrimaries(const QPointF& whitePoint, const QPointF& redPoint, const QPointF& greenPoint, const QPointF& bluePoint).

C++ documentation:

Set primaries to the chromaticities of whitePoint, redPoint, greenPoint and bluePoint.

See also primaries().

source

pub unsafe fn set_transfer_function_2a( &self, transfer_function: TransferFunction, gamma: c_float )

Available on cpp_lib_version="5.14.0" only.

Sets the transfer function to transferFunction and gamma.

Calls C++ function: void QColorSpace::setTransferFunction(QColorSpace::TransferFunction transferFunction, float gamma = …).

C++ documentation:

Sets the transfer function to transferFunction and gamma.

See also transferFunction(), gamma(), and withTransferFunction().

source

pub unsafe fn set_transfer_function_1a( &self, transfer_function: TransferFunction )

Available on cpp_lib_version="5.14.0" only.

Sets the transfer function to transferFunction and gamma.

Calls C++ function: void QColorSpace::setTransferFunction(QColorSpace::TransferFunction transferFunction).

C++ documentation:

Sets the transfer function to transferFunction and gamma.

See also transferFunction(), gamma(), and withTransferFunction().

source

pub unsafe fn static_meta_object() -> Ref<QMetaObject>

Available on cpp_lib_version="5.14.0" only.

Returns a reference to the staticMetaObject field.

source

pub unsafe fn swap(&self, color_space: impl CastInto<Ref<QColorSpace>>)

Available on cpp_lib_version="5.14.0" only.

Swaps color space other with this color space. This operation is very fast and never fails.

Calls C++ function: void QColorSpace::swap(QColorSpace& colorSpace).

C++ documentation:

Swaps color space other with this color space. This operation is very fast and never fails.

source

pub unsafe fn transfer_function(&self) -> TransferFunction

Available on cpp_lib_version="5.14.0" only.

Returns the predefined transfer function of the color space or TransferFunction::Custom if it doesn't match any of them.

Calls C++ function: QColorSpace::TransferFunction QColorSpace::transferFunction() const.

C++ documentation:

Returns the predefined transfer function of the color space or TransferFunction::Custom if it doesn’t match any of them.

See also gamma(), setTransferFunction(), and withTransferFunction().

source

pub unsafe fn transformation_to_color_space( &self, colorspace: impl CastInto<Ref<QColorSpace>> ) -> CppBox<QColorTransform>

Available on cpp_lib_version="5.14.0" only.

Generates and returns a color space transformation from this color space to colorspace.

Calls C++ function: QColorTransform QColorSpace::transformationToColorSpace(const QColorSpace& colorspace) const.

C++ documentation:

Generates and returns a color space transformation from this color space to colorspace.

source

pub unsafe fn with_transfer_function_2a( &self, transfer_function: TransferFunction, gamma: c_float ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Returns a copy of this color space, except using the transfer function transferFunction and gamma.

Calls C++ function: QColorSpace QColorSpace::withTransferFunction(QColorSpace::TransferFunction transferFunction, float gamma = …) const.

C++ documentation:

Returns a copy of this color space, except using the transfer function transferFunction and gamma.

See also transferFunction(), gamma(), and setTransferFunction().

source

pub unsafe fn with_transfer_function_1a( &self, transfer_function: TransferFunction ) -> CppBox<QColorSpace>

Available on cpp_lib_version="5.14.0" only.

Returns a copy of this color space, except using the transfer function transferFunction and gamma.

Calls C++ function: QColorSpace QColorSpace::withTransferFunction(QColorSpace::TransferFunction transferFunction) const.

C++ documentation:

Returns a copy of this color space, except using the transfer function transferFunction and gamma.

See also transferFunction(), gamma(), and setTransferFunction().

Trait Implementations§

source§

impl CppDeletable for QColorSpace

Available on cpp_lib_version="5.14.0" only.
source§

unsafe fn delete(&self)

Calls C++ function: [destructor] void QColorSpace::~QColorSpace().

source§

impl PartialEq<Ref<QColorSpace>> for QColorSpace

Available on cpp_lib_version="5.14.0" only.
source§

fn eq(&self, color_space2: &Ref<QColorSpace>) -> bool

Returns true if v1 is equal to v2; otherwise returns false. This operator uses an exact floating-point comparison.

Calls C++ function: bool operator==(const QColorSpace& colorSpace1, const QColorSpace& colorSpace2).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(const QVector2D &v1, const QVector2D &v2):

Returns true if v1 is equal to v2; otherwise returns false. This operator uses an exact floating-point comparison.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. 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> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. 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.