Skip to content

Gdk.CicpParams

class — extends GObject.Object

Contains the parameters that define a colorstate with cicp parameters.

Cicp parameters are specified in the ITU-T H.273 specification.

See the documentation of individual properties for supported values.

The 'unspecified' value (2) is not treated in any special way, and must be replaced by a different value before creating a color state.

GdkCicpParams can be used as a builder object to construct a color state from Cicp data with CicpParams.build_color_state. The function will return an error if the given parameters are not supported.

You can obtain a GdkCicpParams object from a color state with ColorState.create_cicp_params. This can be used to create a variant of a color state, by changing just one of the cicp parameters, or just to obtain information about the color state.

Constructors

new

@classmethod
def new(cls) -> CicpParams

Creates a new GdkCicpParams object.

The initial values of the properties are the values for "undefined" and need to be set before a color state object can be built.

Methods

build_color_state

def build_color_state(self) -> ColorState

Creates a new GdkColorState object for the cicp parameters in self.

Note that this may fail if the cicp parameters in self are not supported by GTK. In that case, NULL is returned, and error is set with an error message that can be presented to the user.

get_color_primaries

def get_color_primaries(self) -> int

Returns the value of the color-primaries property of self.

get_matrix_coefficients

def get_matrix_coefficients(self) -> int

Gets the matrix-coefficients property of self.

get_range

def get_range(self) -> CicpRange

Gets the range property of self.

get_transfer_function

def get_transfer_function(self) -> int

Gets the transfer-function property of self.

set_color_primaries

def set_color_primaries(self, color_primaries: int) -> None

Sets the color-primaries property of self.

Parameters:

  • color_primaries — the new color primaries value

set_matrix_coefficients

def set_matrix_coefficients(self, matrix_coefficients: int) -> None

self a GdkCicpParams Sets the matrix-coefficients property of self.

Parameters:

  • matrix_coefficients — the new matrix-coefficients value

set_range

def set_range(self, range: CicpRange | int) -> None

Sets the range property of self

Parameters:

  • range — the range value

set_transfer_function

def set_transfer_function(self, transfer_function: int) -> None

Sets the transfer-function property of self.

Parameters:

  • transfer_function — the new transfer-function value

Properties

color_primaries

color_primaries: int  # read/write

The color primaries to use.

Supported values:

  • 1: BT.709 / sRGB
  • 2: unspecified
  • 5: PAL
  • 6,7: BT.601 / NTSC
  • 9: BT.2020
  • 12: Display P3

matrix_coefficients

matrix_coefficients: int  # read/write

The matrix coefficients (for YUV to RGB conversion).

Supported values:

  • 0: RGB
  • 1: BT.709
  • 2: unspecified
  • 5,6: BT.601
  • 9: BT.2020

range

range: CicpRange | int  # read/write

Whether the data is using the full range of values.

The range of the data.

transfer_function

transfer_function: int  # read/write

The transfer function to use.

Supported values:

  • 1,6,14,15: BT.709, BT.601, BT.2020
  • 2: unspecified
  • 4: gamma 2.2
  • 5: gamma 2.8
  • 8: linear
  • 13: sRGB
  • 16: BT.2100 PQ
  • 18: BT.2100 HLG