Skip to content

Commit 787d899

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4a71709 commit 787d899

5 files changed

Lines changed: 187 additions & 167 deletions

File tree

src/libImaging/Arrow.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ export_imaging_schema(Imaging im, struct ArrowSchema *schema) {
199199
}
200200

201201
if (im->bands == 1) {
202-
retval = export_named_type(schema,
203-
im->modedata->arrow_band_format,
204-
im->modedata->band_names[0]);
202+
retval = export_named_type(
203+
schema, im->modedata->arrow_band_format, im->modedata->band_names[0]
204+
);
205205
if (retval != 0) {
206206
return retval;
207207
}

src/libImaging/Imaging.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ typedef struct {
7979

8080
struct ImagingMemoryInstance {
8181
/* Format */
82-
ModeID mode; /* Image mode (IMAGING_MODE_*) */
82+
ModeID mode; /* Image mode (IMAGING_MODE_*) */
8383
const ModeData *modedata; /* mode data struct */
84-
int type; /* Data type (IMAGING_TYPE_*) */
85-
int depth; /* Depth (ignored in this version) */
86-
int bands; /* Number of bands (1, 2, 3, or 4) */
87-
int xsize; /* Image dimension. */
84+
int type; /* Data type (IMAGING_TYPE_*) */
85+
int depth; /* Depth (ignored in this version) */
86+
int bands; /* Number of bands (1, 2, 3, or 4) */
87+
int xsize; /* Image dimension. */
8888
int ysize;
8989

9090
/* Colour palette (for "P" images only) */
@@ -106,7 +106,7 @@ struct ImagingMemoryInstance {
106106
void (*destroy)(Imaging im);
107107

108108
/* arrow */
109-
int refcount; /* Number of arrow arrays that have been allocated */
109+
int refcount; /* Number of arrow arrays that have been allocated */
110110

111111
int read_only; /* flag for read-only. set for arrow borrowed arrays */
112112
PyObject *arrow_array_capsule; /* upstream arrow array source */

src/libImaging/Mode.c

Lines changed: 168 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -9,154 +9,175 @@
99
const ModeData MODES[] = {
1010
[IMAGING_MODE_UNKNOWN] = {""},
1111

12-
[IMAGING_MODE_1] = {
13-
.name = "1",
14-
.arrow_band_format = "C",
15-
.bands = 1,
16-
.pixelsize = 1,
17-
.band_names = {"1"},
18-
},
19-
[IMAGING_MODE_CMYK] = {
20-
.name = "CMYK",
21-
.bands = 4,
22-
.pixelsize = 4,
23-
.arrow_band_format = "C",
24-
.band_names = {"C", "M", "Y", "K"},
25-
},
26-
[IMAGING_MODE_F] = {
27-
.name = "F",
28-
.bands = 1,
29-
.pixelsize = 4,
30-
.arrow_band_format = "f",
31-
.band_names = {"F"},
32-
},
33-
[IMAGING_MODE_HSV] = {
34-
.name = "HSV",
35-
.bands = 3,
36-
.pixelsize = 4,
37-
.arrow_band_format = "C",
38-
.band_names = {"H", "S", "V", "X"},
39-
},
40-
[IMAGING_MODE_I] = {
41-
.name = "I",
42-
.bands = 1,
43-
.pixelsize = 4,
44-
.arrow_band_format = "i",
45-
.band_names = {"I"},
46-
},
47-
[IMAGING_MODE_L] = {
48-
.name = "L",
49-
.bands = 1,
50-
.pixelsize = 1,
51-
.arrow_band_format = "C",
52-
.band_names = {"L"},
53-
},
54-
[IMAGING_MODE_LA] = {
55-
.name = "LA",
56-
.bands = 2,
57-
.pixelsize = 4,
58-
.arrow_band_format = "C",
59-
.band_names = {"L", "X", "X", "A"},
60-
},
61-
[IMAGING_MODE_LAB] = {
62-
.name = "LAB",
63-
.bands = 3,
64-
.pixelsize = 4,
65-
.arrow_band_format = "C",
66-
.band_names = {"L", "a", "b", "X"},
67-
},
68-
[IMAGING_MODE_La] = {
69-
.name = "La",
70-
.bands = 2,
71-
.pixelsize = 4,
72-
.arrow_band_format = "C",
73-
.band_names = {"L", "X", "X", "a"},
74-
},
75-
[IMAGING_MODE_P] = {
76-
.name = "P",
77-
.bands = 1,
78-
.pixelsize = 1,
79-
.arrow_band_format = "C",
80-
.band_names = {"P"},
81-
},
82-
[IMAGING_MODE_PA] = {
83-
.name = "PA",
84-
.bands = 2,
85-
.pixelsize = 4,
86-
.arrow_band_format = "C",
87-
.band_names = {"P", "X", "X", "A"},
88-
},
89-
[IMAGING_MODE_RGB] = {
90-
.name = "RGB",
91-
.bands = 3,
92-
.pixelsize = 4,
93-
.arrow_band_format = "C",
94-
.band_names = {"R", "G", "B", "X"},
95-
},
96-
[IMAGING_MODE_RGBA] = {
97-
.name = "RGBA",
98-
.bands = 4,
99-
.pixelsize = 4,
100-
.arrow_band_format = "C",
101-
.band_names = {"R", "G", "B", "A"},
102-
},
103-
[IMAGING_MODE_RGBX] = {
104-
.name = "RGBX",
105-
.bands = 4,
106-
.pixelsize = 4,
107-
.arrow_band_format = "C",
108-
.band_names = {"R", "G", "B", "X"},
109-
},
110-
[IMAGING_MODE_RGBa] = {
111-
.name = "RGBa",
112-
.bands = 4,
113-
.pixelsize = 4,
114-
.arrow_band_format = "C",
115-
.band_names = {"R", "G", "B", "a"},
116-
},
117-
[IMAGING_MODE_YCbCr] = {
118-
.name = "YCbCr",
119-
.bands = 3,
120-
.pixelsize = 4,
121-
.arrow_band_format = "C",
122-
.band_names = {"Y", "Cb", "Cr", "X"},
123-
},
12+
[IMAGING_MODE_1] =
13+
{
14+
.name = "1",
15+
.arrow_band_format = "C",
16+
.bands = 1,
17+
.pixelsize = 1,
18+
.band_names = {"1"},
19+
},
20+
[IMAGING_MODE_CMYK] =
21+
{
22+
.name = "CMYK",
23+
.bands = 4,
24+
.pixelsize = 4,
25+
.arrow_band_format = "C",
26+
.band_names = {"C", "M", "Y", "K"},
27+
},
28+
[IMAGING_MODE_F] =
29+
{
30+
.name = "F",
31+
.bands = 1,
32+
.pixelsize = 4,
33+
.arrow_band_format = "f",
34+
.band_names = {"F"},
35+
},
36+
[IMAGING_MODE_HSV] =
37+
{
38+
.name = "HSV",
39+
.bands = 3,
40+
.pixelsize = 4,
41+
.arrow_band_format = "C",
42+
.band_names = {"H", "S", "V", "X"},
43+
},
44+
[IMAGING_MODE_I] =
45+
{
46+
.name = "I",
47+
.bands = 1,
48+
.pixelsize = 4,
49+
.arrow_band_format = "i",
50+
.band_names = {"I"},
51+
},
52+
[IMAGING_MODE_L] =
53+
{
54+
.name = "L",
55+
.bands = 1,
56+
.pixelsize = 1,
57+
.arrow_band_format = "C",
58+
.band_names = {"L"},
59+
},
60+
[IMAGING_MODE_LA] =
61+
{
62+
.name = "LA",
63+
.bands = 2,
64+
.pixelsize = 4,
65+
.arrow_band_format = "C",
66+
.band_names = {"L", "X", "X", "A"},
67+
},
68+
[IMAGING_MODE_LAB] =
69+
{
70+
.name = "LAB",
71+
.bands = 3,
72+
.pixelsize = 4,
73+
.arrow_band_format = "C",
74+
.band_names = {"L", "a", "b", "X"},
75+
},
76+
[IMAGING_MODE_La] =
77+
{
78+
.name = "La",
79+
.bands = 2,
80+
.pixelsize = 4,
81+
.arrow_band_format = "C",
82+
.band_names = {"L", "X", "X", "a"},
83+
},
84+
[IMAGING_MODE_P] =
85+
{
86+
.name = "P",
87+
.bands = 1,
88+
.pixelsize = 1,
89+
.arrow_band_format = "C",
90+
.band_names = {"P"},
91+
},
92+
[IMAGING_MODE_PA] =
93+
{
94+
.name = "PA",
95+
.bands = 2,
96+
.pixelsize = 4,
97+
.arrow_band_format = "C",
98+
.band_names = {"P", "X", "X", "A"},
99+
},
100+
[IMAGING_MODE_RGB] =
101+
{
102+
.name = "RGB",
103+
.bands = 3,
104+
.pixelsize = 4,
105+
.arrow_band_format = "C",
106+
.band_names = {"R", "G", "B", "X"},
107+
},
108+
[IMAGING_MODE_RGBA] =
109+
{
110+
.name = "RGBA",
111+
.bands = 4,
112+
.pixelsize = 4,
113+
.arrow_band_format = "C",
114+
.band_names = {"R", "G", "B", "A"},
115+
},
116+
[IMAGING_MODE_RGBX] =
117+
{
118+
.name = "RGBX",
119+
.bands = 4,
120+
.pixelsize = 4,
121+
.arrow_band_format = "C",
122+
.band_names = {"R", "G", "B", "X"},
123+
},
124+
[IMAGING_MODE_RGBa] =
125+
{
126+
.name = "RGBa",
127+
.bands = 4,
128+
.pixelsize = 4,
129+
.arrow_band_format = "C",
130+
.band_names = {"R", "G", "B", "a"},
131+
},
132+
[IMAGING_MODE_YCbCr] =
133+
{
134+
.name = "YCbCr",
135+
.bands = 3,
136+
.pixelsize = 4,
137+
.arrow_band_format = "C",
138+
.band_names = {"Y", "Cb", "Cr", "X"},
139+
},
124140

125-
[IMAGING_MODE_I_16] = {
126-
.name = "I;16",
127-
.bands = 1,
128-
.pixelsize = 2,
129-
.arrow_band_format = "s",
130-
.band_names = {"I"},
131-
},
132-
[IMAGING_MODE_I_16L] = {
133-
.name = "I;16L",
134-
.bands = 1,
135-
.pixelsize = 2,
136-
.arrow_band_format = "s",
137-
.band_names = {"I"},
138-
},
139-
[IMAGING_MODE_I_16B] = {
140-
.name = "I;16B",
141-
.bands = 1,
142-
.pixelsize = 2,
143-
.arrow_band_format = "s",
144-
.band_names = {"I"},
145-
},
146-
[IMAGING_MODE_I_16N] = {
147-
.name = "I;16N",
148-
.bands = 1,
149-
.pixelsize = 2,
150-
.arrow_band_format = "s",
151-
.band_names = {"I"},
152-
},
153-
[IMAGING_MODE_I_32L] = {
154-
.name = "I;32L",
155-
.bands = 1,
156-
.pixelsize = 4,
157-
.arrow_band_format = "i",
158-
.band_names = {"I"},
159-
},
141+
[IMAGING_MODE_I_16] =
142+
{
143+
.name = "I;16",
144+
.bands = 1,
145+
.pixelsize = 2,
146+
.arrow_band_format = "s",
147+
.band_names = {"I"},
148+
},
149+
[IMAGING_MODE_I_16L] =
150+
{
151+
.name = "I;16L",
152+
.bands = 1,
153+
.pixelsize = 2,
154+
.arrow_band_format = "s",
155+
.band_names = {"I"},
156+
},
157+
[IMAGING_MODE_I_16B] =
158+
{
159+
.name = "I;16B",
160+
.bands = 1,
161+
.pixelsize = 2,
162+
.arrow_band_format = "s",
163+
.band_names = {"I"},
164+
},
165+
[IMAGING_MODE_I_16N] =
166+
{
167+
.name = "I;16N",
168+
.bands = 1,
169+
.pixelsize = 2,
170+
.arrow_band_format = "s",
171+
.band_names = {"I"},
172+
},
173+
[IMAGING_MODE_I_32L] =
174+
{
175+
.name = "I;32L",
176+
.bands = 1,
177+
.pixelsize = 4,
178+
.arrow_band_format = "i",
179+
.band_names = {"I"},
180+
},
160181
[IMAGING_MODE_I_32B] = {
161182
.name = "I;32B",
162183
.bands = 1,

src/libImaging/Mode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef struct {
3434
const char *const arrow_band_format;
3535
const int bands;
3636
const int pixelsize;
37-
const char *band_names[4]; /* names of bands */
37+
const char *band_names[4]; /* names of bands */
3838
} ModeData;
3939

4040
const ModeID

0 commit comments

Comments
 (0)