Debian Codegraph @

DisplayCAL/mscms_types.py

raw
1 """Classes for the various enums used in the Windows Color System API.
2
3 There are also some helper functions to convert between enum values and their
4 string representations.
5 """
6
7 from enum import IntEnum, IntFlag, auto
8
9
10 class dwDeviceClass(IntEnum): # noqa: N801
11 """Available device classes to be used in the dwDeviceClass field."""
12
13 CLASS_SCANNER = int.from_bytes(b"scnr", byteorder="big")
14 CLASS_MONITOR = int.from_bytes(b"mntr", byteorder="big")
15 CLASS_PRINTER = int.from_bytes(b"prtr", byteorder="big")
16
17
18 class dwFieldsUsed(IntFlag): # noqa: N801
19 """Available fields to be used in the ENUMTYPEW structure."""
20
21 ET_DEVICENAME = 0x00000001
22 ET_MEDIATYPE = 0x00000002
23 ET_DITHERMODE = 0x00000004
24 ET_RESOLUTION = 0x00000008
25 ET_CMMTYPE = 0x00000010
26 ET_CLASS = 0x00000020
27 ET_DATACOLORSPACE = 0x00000040
28 ET_CONNECTIONSPACE = 0x00000080
29 ET_SIGNATURE = 0x00000100
30 ET_PLATFORM = 0x00000200
31 ET_PROFILEFLAGS = 0x00000400
32 ET_MANUFACTURER = 0x00000800
33 ET_MODEL = 0x00001000
34 ET_ATTRIBUTES = 0x00002000
35 ET_RENDERINGINTENT = 0x00004000
36 ET_CREATOR = 0x00008000
37 ET_DEVICECLASS = 0x00010000
38
39
40 class WCS_PROF_SCOPE(IntEnum): # noqa: N801
41 """Available profile scopes to be used in the WCS API."""
42
43 SYSTEM_WIDE = 0
44 CURRENT_USER = 1
45
46
47 class COLORPROFILETYPE(IntEnum):
48 """Available color profile types to be used in the COLORPROFILETYPE field."""
49
50 CPT_ICC = 0
51 CPT_DMP = auto()
52 CPT_CAMP = auto()
53 CPT_GMMP = auto()
54
55
56 class COLORPROFILESUBTYPE(IntEnum):
57 """Available color profile subtypes to be used in the COLORPROFILESUBTYPE field."""
58
59 # intent
60 CPST_PERCEPTUAL = 0
61 CPST_RELATIVE_COLORIMETRIC = auto()
62 CPST_SATURATION = auto()
63 CPST_ABSOLUTE_COLORIMETRIC = auto()
64 # working space
65 CPST_NONE = auto() # makes the API deduct profile subtype from the profile itself
66 CPST_RGB_WORKING_SPACE = auto()
67 CPST_CUSTOM_WORKING_SPACE = auto()
68 CPST_STANDARD_DISPLAY_COLOR_MODE = auto()
69 CPST_EXTENDED_DISPLAY_COLOR_MODE = auto()