1
0
Fork 0
forked from wry/wry

color-management: use more consistent naming

This commit is contained in:
Julian Orth 2025-09-05 13:45:09 +02:00
parent 32db933242
commit 83e79b68e6
65 changed files with 439 additions and 510 deletions

View file

@ -273,26 +273,26 @@ impl Connector {
get!().connector_set_format(self, format);
}
/// Sets the color space and transfer function of the connector.
/// Sets the color space and EOTF of the connector.
///
/// By default, the default values are used which usually means sRGB color space with
/// sRGB transfer function.
/// gamma22 EOTF.
///
/// If the output supports it, HDR10 can be enabled by setting the color space to
/// BT.2020 and the transfer function to PQ.
/// BT.2020 and the EOTF to PQ.
///
/// Note that some displays might ignore incompatible settings.
pub fn set_colors(self, color_space: ColorSpace, transfer_function: TransferFunction) {
get!().connector_set_colors(self, color_space, transfer_function);
pub fn set_colors(self, color_space: ColorSpace, eotf: Eotf) {
get!().connector_set_colors(self, color_space, eotf);
}
/// Sets the brightness of the output.
///
/// By default or when `brightness` is `None`, the brightness depends on the
/// transfer function:
/// EOTF:
///
/// - [`TransferFunction::DEFAULT`]: The maximum brightness of the output.
/// - [`TransferFunction::PQ`]: 203 cd/m^2.
/// - [`Eotf::DEFAULT`]: The maximum brightness of the output.
/// - [`Eotf::PQ`]: 203 cd/m^2.
///
/// This should only be used with the PQ transfer function. If the default transfer
/// function is used, you should instead calibrate the hardware directly.
@ -718,13 +718,16 @@ impl ColorSpace {
pub const BT2020: Self = Self(1);
}
/// A transfer function.
/// An electro-optical transfer function (EOTF).
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub struct TransferFunction(pub u32);
pub struct Eotf(pub u32);
impl TransferFunction {
/// The default transfer function (usually sRGB).
#[deprecated = "use the Eotf type instead"]
pub type TransferFunction = Eotf;
impl Eotf {
/// The default EOTF (usually gamma22).
pub const DEFAULT: Self = Self(0);
/// The PQ transfer function.
/// The PQ EOTF.
pub const PQ: Self = Self(1);
}