Coverage for models/rgb/datasets/apple_rgb.py: 0%

1"""

2 Apple RGB Colourspace

3=====================

4

5 Define the *Apple RGB* colourspace:

6

7- :attr:`colour.models.RGB_COLOURSPACE_APPLE_RGB`.

8

9 References

10----------

11- :cite:`Susstrunk1999a` : Susstrunk, S., Buckley, R., & Swen, S. (1999).

12 Standard RGB Color Spaces.

13"""

14

15 from __future__ import annotations

16

17 import typing

18 from functools import partial

19

20 import numpy as np

21

22 from colour.colorimetry import CCS_ILLUMINANTS

23

24 if typing.TYPE_CHECKING:

25 from colour.hints import NDArrayFloat

26

27 from colour.models.rgb import RGB_Colourspace, gamma_function, normalised_primary_matrix

28

29 __author__ = "Colour Developers"

30 __copyright__ = "Copyright 2013 Colour Developers"

31 __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"

32 __maintainer__ = "Colour Developers"

33 __email__ = "colour-developers@colour-science.org"

34 __status__ = "Production"

35

36 __all__ = [

37 "PRIMARIES_APPLE_RGB",

38 "WHITEPOINT_NAME_APPLE_RGB",

39 "CCS_WHITEPOINT_APPLE_RGB",

40 "MATRIX_APPLE_RGB_TO_XYZ",

41 "MATRIX_XYZ_TO_APPLE_RGB",

42 "RGB_COLOURSPACE_APPLE_RGB",

43]

44

45 PRIMARIES_APPLE_RGB: NDArrayFloat = np.array(

46 [

47 [0.6250, 0.3400],

48 [0.2800, 0.5950],

49 [0.1550, 0.0700],

50 ]

51)

52"""*Apple RGB* colourspace primaries."""

53

54 WHITEPOINT_NAME_APPLE_RGB: str = "D65"

55"""*Apple RGB* colourspace whitepoint name."""

56

57 CCS_WHITEPOINT_APPLE_RGB: NDArrayFloat = CCS_ILLUMINANTS[

58 "CIE 1931 2 Degree Standard Observer"

59][WHITEPOINT_NAME_APPLE_RGB]

60"""*Apple RGB* colourspace whitepoint chromaticity coordinates."""

61

62 MATRIX_APPLE_RGB_TO_XYZ: NDArrayFloat = normalised_primary_matrix(

63 PRIMARIES_APPLE_RGB, CCS_WHITEPOINT_APPLE_RGB

64)

65"""*Apple RGB* colourspace to *CIE XYZ* tristimulus values matrix."""

66

67 MATRIX_XYZ_TO_APPLE_RGB: NDArrayFloat = np.linalg.inv(MATRIX_APPLE_RGB_TO_XYZ)

68"""*CIE XYZ* tristimulus values to *Apple RGB* colourspace matrix."""

69

70 RGB_COLOURSPACE_APPLE_RGB: RGB_Colourspace = RGB_Colourspace(

71 "Apple RGB",

72 PRIMARIES_APPLE_RGB,

73 CCS_WHITEPOINT_APPLE_RGB,

74 WHITEPOINT_NAME_APPLE_RGB,

75 MATRIX_APPLE_RGB_TO_XYZ,

76 MATRIX_XYZ_TO_APPLE_RGB,

77 partial(gamma_function, exponent=1 / 1.8),

78 partial(gamma_function, exponent=1.8),

79)

80 RGB_COLOURSPACE_APPLE_RGB.__doc__ = """

81*Apple RGB* colourspace.

82

83 References

84----------

85:cite:`Susstrunk1999a`

86"""