|
2 | 2 | import ctypes
|
3 | 3 | from sys import platform
|
4 | 4 |
|
5 |
| -cpixel = ctypes.c_float * 3 |
6 |
| -cpixels = ctypes.POINTER(ctypes.c_float) |
| 5 | +c_float3 = ctypes.c_float * 3 |
| 6 | +c_float_p = ctypes.POINTER(ctypes.c_float) |
7 | 7 |
|
8 | 8 | if platform == "win32":
|
9 | 9 | LIBRARY = "colcon.dll"
|
|
17 | 17 | colcon.convert_space_3f32.argtypes = [
|
18 | 18 | ctypes.c_char_p,
|
19 | 19 | ctypes.c_char_p,
|
20 |
| - cpixels, |
| 20 | + c_float_p, |
21 | 21 | ctypes.c_uint,
|
22 | 22 | ]
|
23 | 23 | colcon.convert_space_3f32.restype = ctypes.c_int32
|
24 | 24 |
|
25 | 25 | colcon.str2space_3f32.argtypes = [ctypes.c_char_p, ctypes.c_char_p]
|
26 |
| -colcon.str2space_3f32.restype = cpixels # No way to have a known size? |
| 26 | +colcon.str2space_3f32.restype = c_float_p # No way to have a known size? |
27 | 27 |
|
28 | 28 | # up
|
29 |
| -colcon.srgb_to_hsv_3f32.argtypes = [cpixel] |
30 |
| -colcon.srgb_to_lrgb_3f32.argtypes = [cpixel] |
31 |
| -colcon.lrgb_to_xyz_3f32.argtypes = [cpixel] |
32 |
| -colcon.xyz_to_cielab_3f32.argtypes = [cpixel] |
33 |
| -colcon.xyz_to_oklab_3f32.argtypes = [cpixel] |
34 |
| -colcon.xyz_to_jzazbz_3f32.argtypes = [cpixel] |
35 |
| -colcon.lab_to_lch_3f32.argtypes = [cpixel] |
| 29 | +colcon.srgb_to_hsv_3f32.argtypes = [c_float3] |
| 30 | +colcon.srgb_to_lrgb_3f32.argtypes = [c_float3] |
| 31 | +colcon.lrgb_to_xyz_3f32.argtypes = [c_float3] |
| 32 | +colcon.xyz_to_cielab_3f32.argtypes = [c_float3] |
| 33 | +colcon.xyz_to_oklab_3f32.argtypes = [c_float3] |
| 34 | +colcon.xyz_to_jzazbz_3f32.argtypes = [c_float3] |
| 35 | +colcon.lab_to_lch_3f32.argtypes = [c_float3] |
36 | 36 |
|
37 | 37 | # down
|
38 |
| -colcon.lch_to_lab_3f32.argtypes = [cpixel] |
39 |
| -colcon.jzazbz_to_xyz_3f32.argtypes = [cpixel] |
40 |
| -colcon.oklab_to_xyz_3f32.argtypes = [cpixel] |
41 |
| -colcon.cielab_to_xyz_3f32.argtypes = [cpixel] |
42 |
| -colcon.xyz_to_lrgb_3f32.argtypes = [cpixel] |
43 |
| -colcon.lrgb_to_srgb_3f32.argtypes = [cpixel] |
44 |
| -colcon.srgb_to_hsv_3f32.argtypes = [cpixel] |
| 38 | +colcon.lch_to_lab_3f32.argtypes = [c_float3] |
| 39 | +colcon.jzazbz_to_xyz_3f32.argtypes = [c_float3] |
| 40 | +colcon.oklab_to_xyz_3f32.argtypes = [c_float3] |
| 41 | +colcon.cielab_to_xyz_3f32.argtypes = [c_float3] |
| 42 | +colcon.xyz_to_lrgb_3f32.argtypes = [c_float3] |
| 43 | +colcon.lrgb_to_srgb_3f32.argtypes = [c_float3] |
| 44 | +colcon.srgb_to_hsv_3f32.argtypes = [c_float3] |
45 | 45 |
|
46 | 46 | # extra
|
47 | 47 | colcon.srgb_eotf_f32.argtypes = [ctypes.c_float]
|
|
56 | 56 | colcon.pq_oetf_f32.restype = ctypes.c_float
|
57 | 57 | colcon.pqz_oetf_f32.argtypes = [ctypes.c_float]
|
58 | 58 | colcon.pqz_oetf_f32.restype = ctypes.c_float
|
59 |
| -colcon.hk_high2023_3f32.argtypes = [cpixel] |
60 |
| -colcon.hk_high2023_comp_3f32.argtypes = [cpixel] |
| 59 | +colcon.hk_high2023_3f32.argtypes = [c_float3] |
| 60 | +colcon.hk_high2023_comp_3f32.argtypes = [c_float3] |
61 | 61 |
|
62 | 62 | # other dtypes
|
63 | 63 | colcon.srgb_to_lrgb_4f32.argtypes = [ctypes.c_float * 4]
|
@@ -86,60 +86,60 @@ def pixcmp(a, b):
|
86 | 86 |
|
87 | 87 |
|
88 | 88 | # up
|
89 |
| -pix = cpixel(*SRGB) |
| 89 | +pix = c_float3(*SRGB) |
90 | 90 | colcon.srgb_to_hsv_3f32(pix)
|
91 | 91 | pixcmp(list(pix), HSV)
|
92 | 92 |
|
93 |
| -pix = cpixel(*SRGB) |
| 93 | +pix = c_float3(*SRGB) |
94 | 94 | colcon.srgb_to_lrgb_3f32(pix)
|
95 | 95 | pixcmp(list(pix), LRGB)
|
96 | 96 |
|
97 |
| -pix = cpixel(*LRGB) |
| 97 | +pix = c_float3(*LRGB) |
98 | 98 | colcon.lrgb_to_xyz_3f32(pix)
|
99 | 99 | pixcmp(list(pix), XYZ)
|
100 | 100 |
|
101 |
| -pix = cpixel(*XYZ) |
| 101 | +pix = c_float3(*XYZ) |
102 | 102 | colcon.xyz_to_cielab_3f32(pix)
|
103 | 103 | pixcmp(list(pix), LAB)
|
104 | 104 |
|
105 |
| -pix = cpixel(*XYZ) |
| 105 | +pix = c_float3(*XYZ) |
106 | 106 | colcon.xyz_to_oklab_3f32(pix)
|
107 | 107 | pixcmp(list(pix), OKLAB)
|
108 | 108 |
|
109 |
| -pix = cpixel(*XYZ) |
| 109 | +pix = c_float3(*XYZ) |
110 | 110 | colcon.xyz_to_jzazbz_3f32(pix)
|
111 | 111 | pixcmp(list(pix), JZAZBZ)
|
112 | 112 |
|
113 |
| -pix = cpixel(*LAB) |
| 113 | +pix = c_float3(*LAB) |
114 | 114 | colcon.lab_to_lch_3f32(pix)
|
115 | 115 | pixcmp(list(pix), LCH)
|
116 | 116 |
|
117 | 117 | # down
|
118 |
| -pix = cpixel(*LCH) |
| 118 | +pix = c_float3(*LCH) |
119 | 119 | colcon.lch_to_lab_3f32(pix)
|
120 | 120 | pixcmp(list(pix), LAB)
|
121 | 121 |
|
122 |
| -pix = cpixel(*LAB) |
| 122 | +pix = c_float3(*LAB) |
123 | 123 | colcon.cielab_to_xyz_3f32(pix)
|
124 | 124 | pixcmp(list(pix), XYZ)
|
125 | 125 |
|
126 |
| -pix = cpixel(*JZAZBZ) |
| 126 | +pix = c_float3(*JZAZBZ) |
127 | 127 | colcon.jzazbz_to_xyz_3f32(pix)
|
128 | 128 | pixcmp(list(pix), XYZ)
|
129 | 129 |
|
130 |
| -pix = cpixel(*OKLAB) |
| 130 | +pix = c_float3(*OKLAB) |
131 | 131 | colcon.oklab_to_xyz_3f32(pix)
|
132 | 132 | pixcmp(list(pix), XYZ)
|
133 | 133 |
|
134 |
| -pix = cpixel(*XYZ) |
| 134 | +pix = c_float3(*XYZ) |
135 | 135 | colcon.xyz_to_lrgb_3f32(pix)
|
136 | 136 | pixcmp(list(pix), LRGB)
|
137 | 137 |
|
138 |
| -pix = cpixel(*LRGB) |
| 138 | +pix = c_float3(*LRGB) |
139 | 139 | colcon.lrgb_to_srgb_3f32(pix)
|
140 | 140 | pixcmp(list(pix), SRGB)
|
141 | 141 |
|
142 |
| -pix = cpixel(*SRGB) |
| 142 | +pix = c_float3(*SRGB) |
143 | 143 | colcon.srgb_to_hsv_3f32(pix)
|
144 | 144 | pixcmp(list(pix), HSV)
|
145 | 145 |
|
|
0 commit comments