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
.
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
impl QColorSpace
sourcepub unsafe fn copy_from(
&self,
color_space: impl CastInto<Ref<QColorSpace>>
) -> Ref<QColorSpace>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn copy_from( &self, color_space: impl CastInto<Ref<QColorSpace>> ) -> Ref<QColorSpace>
cpp_lib_version="5.14.0"
only.Calls C++ function: QColorSpace& QColorSpace::operator=(const QColorSpace& colorSpace)
.
sourcepub unsafe fn from_icc_profile(
icc_profile: impl CastInto<Ref<QByteArray>>
) -> CppBox<QColorSpace>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn from_icc_profile( icc_profile: impl CastInto<Ref<QByteArray>> ) -> CppBox<QColorSpace>
cpp_lib_version="5.14.0"
only.Creates a QColorSpace from ICC profile iccProfile.
Calls C++ function: static QColorSpace QColorSpace::fromIccProfile(const QByteArray& iccProfile)
.
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().
sourcepub unsafe fn gamma(&self) -> c_float
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn gamma(&self) -> c_float
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
.
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().
sourcepub unsafe fn icc_profile(&self) -> CppBox<QByteArray>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn icc_profile(&self) -> CppBox<QByteArray>
cpp_lib_version="5.14.0"
only.Returns an ICC profile representing the color space.
Calls C++ function: QByteArray QColorSpace::iccProfile() const
.
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().
sourcepub unsafe fn is_valid(&self) -> bool
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn is_valid(&self) -> bool
cpp_lib_version="5.14.0"
only.Returns true
if the color space is valid.
Calls C++ function: bool QColorSpace::isValid() const
.
Returns true
if the color space is valid.
sourcepub unsafe fn new() -> CppBox<QColorSpace>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn new() -> CppBox<QColorSpace>
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()
.
Creates a new colorspace object that represents an undefined and invalid colorspace.
sourcepub unsafe fn from_named_color_space(
named_color_space: NamedColorSpace
) -> CppBox<QColorSpace>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn from_named_color_space( named_color_space: NamedColorSpace ) -> CppBox<QColorSpace>
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)
.
Creates a new colorspace object that represents a namedColorSpace.
sourcepub 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.
pub unsafe fn from_primaries_transfer_function_float( primaries: Primaries, fun: TransferFunction, gamma: c_float ) -> CppBox<QColorSpace>
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 = …)
.
Creates a custom color space with the primaries primaries, using the transfer function fun and optionally gamma.
sourcepub unsafe fn from_primaries_float(
primaries: Primaries,
gamma: c_float
) -> CppBox<QColorSpace>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn from_primaries_float( primaries: Primaries, gamma: c_float ) -> CppBox<QColorSpace>
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)
.
Creates a custom color space with the primaries primaries, using a gamma transfer function of gamma.
sourcepub 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.
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>
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 = …)
.
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.
sourcepub unsafe fn from_primaries_transfer_function(
primaries: Primaries,
fun: TransferFunction
) -> CppBox<QColorSpace>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn from_primaries_transfer_function( primaries: Primaries, fun: TransferFunction ) -> CppBox<QColorSpace>
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)
.
Creates a custom color space with the primaries primaries, using the transfer function fun and optionally gamma.
sourcepub 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.
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>
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)
.
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.
sourcepub unsafe fn new_copy(
color_space: impl CastInto<Ref<QColorSpace>>
) -> CppBox<QColorSpace>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn new_copy( color_space: impl CastInto<Ref<QColorSpace>> ) -> CppBox<QColorSpace>
cpp_lib_version="5.14.0"
only.Calls C++ function: [constructor] void QColorSpace::QColorSpace(const QColorSpace& colorSpace)
.
sourcepub unsafe fn primaries(&self) -> Primaries
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn primaries(&self) -> Primaries
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
.
Returns the predefined primaries of the color space or primaries::Custom
if it doesn’t match any of them.
See also setPrimaries().
sourcepub unsafe fn set_primaries_1a(&self, primaries_id: Primaries)
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn set_primaries_1a(&self, primaries_id: Primaries)
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)
.
Sets the primaries to those of the primariesId set.
See also primaries().
sourcepub 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.
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>> )
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)
.
Set primaries to the chromaticities of whitePoint, redPoint, greenPoint and bluePoint.
See also primaries().
sourcepub unsafe fn set_transfer_function_2a(
&self,
transfer_function: TransferFunction,
gamma: c_float
)
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn set_transfer_function_2a( &self, transfer_function: TransferFunction, gamma: c_float )
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 = …)
.
Sets the transfer function to transferFunction and gamma.
See also transferFunction(), gamma(), and withTransferFunction().
sourcepub unsafe fn set_transfer_function_1a(
&self,
transfer_function: TransferFunction
)
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn set_transfer_function_1a( &self, transfer_function: TransferFunction )
cpp_lib_version="5.14.0"
only.Sets the transfer function to transferFunction and gamma.
Calls C++ function: void QColorSpace::setTransferFunction(QColorSpace::TransferFunction transferFunction)
.
Sets the transfer function to transferFunction and gamma.
See also transferFunction(), gamma(), and withTransferFunction().
sourcepub unsafe fn static_meta_object() -> Ref<QMetaObject>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn static_meta_object() -> Ref<QMetaObject>
cpp_lib_version="5.14.0"
only.Returns a reference to the staticMetaObject
field.
sourcepub unsafe fn swap(&self, color_space: impl CastInto<Ref<QColorSpace>>)
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn swap(&self, color_space: impl CastInto<Ref<QColorSpace>>)
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)
.
Swaps color space other with this color space. This operation is very fast and never fails.
sourcepub unsafe fn transfer_function(&self) -> TransferFunction
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn transfer_function(&self) -> TransferFunction
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
.
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().
sourcepub unsafe fn transformation_to_color_space(
&self,
colorspace: impl CastInto<Ref<QColorSpace>>
) -> CppBox<QColorTransform>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn transformation_to_color_space( &self, colorspace: impl CastInto<Ref<QColorSpace>> ) -> CppBox<QColorTransform>
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
.
Generates and returns a color space transformation from this color space to colorspace.
sourcepub unsafe fn with_transfer_function_2a(
&self,
transfer_function: TransferFunction,
gamma: c_float
) -> CppBox<QColorSpace>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn with_transfer_function_2a( &self, transfer_function: TransferFunction, gamma: c_float ) -> CppBox<QColorSpace>
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
.
Returns a copy of this color space, except using the transfer function transferFunction and gamma.
See also transferFunction(), gamma(), and setTransferFunction().
sourcepub unsafe fn with_transfer_function_1a(
&self,
transfer_function: TransferFunction
) -> CppBox<QColorSpace>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn with_transfer_function_1a( &self, transfer_function: TransferFunction ) -> CppBox<QColorSpace>
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
.
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.
impl CppDeletable for QColorSpace
cpp_lib_version="5.14.0"
only.source§impl PartialEq<Ref<QColorSpace>> for QColorSpace
Available on cpp_lib_version="5.14.0"
only.
impl PartialEq<Ref<QColorSpace>> for QColorSpace
cpp_lib_version="5.14.0"
only.source§fn eq(&self, color_space2: &Ref<QColorSpace>) -> bool
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.