Skip to content

Commit 3776275

Browse files
committed
scripts/ctypes rename cpixel, cpixels -> c_float3, c_float_p
1 parent 4f61894 commit 3776275

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

scripts/test_ctypes.py

+34-34
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import ctypes
33
from sys import platform
44

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)
77

88
if platform == "win32":
99
LIBRARY = "colcon.dll"
@@ -17,31 +17,31 @@
1717
colcon.convert_space_3f32.argtypes = [
1818
ctypes.c_char_p,
1919
ctypes.c_char_p,
20-
cpixels,
20+
c_float_p,
2121
ctypes.c_uint,
2222
]
2323
colcon.convert_space_3f32.restype = ctypes.c_int32
2424

2525
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?
2727

2828
# 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]
3636

3737
# 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]
4545

4646
# extra
4747
colcon.srgb_eotf_f32.argtypes = [ctypes.c_float]
@@ -56,8 +56,8 @@
5656
colcon.pq_oetf_f32.restype = ctypes.c_float
5757
colcon.pqz_oetf_f32.argtypes = [ctypes.c_float]
5858
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]
6161

6262
# other dtypes
6363
colcon.srgb_to_lrgb_4f32.argtypes = [ctypes.c_float * 4]
@@ -86,60 +86,60 @@ def pixcmp(a, b):
8686

8787

8888
# up
89-
pix = cpixel(*SRGB)
89+
pix = c_float3(*SRGB)
9090
colcon.srgb_to_hsv_3f32(pix)
9191
pixcmp(list(pix), HSV)
9292

93-
pix = cpixel(*SRGB)
93+
pix = c_float3(*SRGB)
9494
colcon.srgb_to_lrgb_3f32(pix)
9595
pixcmp(list(pix), LRGB)
9696

97-
pix = cpixel(*LRGB)
97+
pix = c_float3(*LRGB)
9898
colcon.lrgb_to_xyz_3f32(pix)
9999
pixcmp(list(pix), XYZ)
100100

101-
pix = cpixel(*XYZ)
101+
pix = c_float3(*XYZ)
102102
colcon.xyz_to_cielab_3f32(pix)
103103
pixcmp(list(pix), LAB)
104104

105-
pix = cpixel(*XYZ)
105+
pix = c_float3(*XYZ)
106106
colcon.xyz_to_oklab_3f32(pix)
107107
pixcmp(list(pix), OKLAB)
108108

109-
pix = cpixel(*XYZ)
109+
pix = c_float3(*XYZ)
110110
colcon.xyz_to_jzazbz_3f32(pix)
111111
pixcmp(list(pix), JZAZBZ)
112112

113-
pix = cpixel(*LAB)
113+
pix = c_float3(*LAB)
114114
colcon.lab_to_lch_3f32(pix)
115115
pixcmp(list(pix), LCH)
116116

117117
# down
118-
pix = cpixel(*LCH)
118+
pix = c_float3(*LCH)
119119
colcon.lch_to_lab_3f32(pix)
120120
pixcmp(list(pix), LAB)
121121

122-
pix = cpixel(*LAB)
122+
pix = c_float3(*LAB)
123123
colcon.cielab_to_xyz_3f32(pix)
124124
pixcmp(list(pix), XYZ)
125125

126-
pix = cpixel(*JZAZBZ)
126+
pix = c_float3(*JZAZBZ)
127127
colcon.jzazbz_to_xyz_3f32(pix)
128128
pixcmp(list(pix), XYZ)
129129

130-
pix = cpixel(*OKLAB)
130+
pix = c_float3(*OKLAB)
131131
colcon.oklab_to_xyz_3f32(pix)
132132
pixcmp(list(pix), XYZ)
133133

134-
pix = cpixel(*XYZ)
134+
pix = c_float3(*XYZ)
135135
colcon.xyz_to_lrgb_3f32(pix)
136136
pixcmp(list(pix), LRGB)
137137

138-
pix = cpixel(*LRGB)
138+
pix = c_float3(*LRGB)
139139
colcon.lrgb_to_srgb_3f32(pix)
140140
pixcmp(list(pix), SRGB)
141141

142-
pix = cpixel(*SRGB)
142+
pix = c_float3(*SRGB)
143143
colcon.srgb_to_hsv_3f32(pix)
144144
pixcmp(list(pix), HSV)
145145

0 commit comments

Comments
 (0)