GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_mix_pixels.gen.h
1// SPDX-License-Identifier: GPL-2.1-or-later
2/*
3 * gp_mix_pixels.gen.h
4 *
5 * GENERATED on 2024 06 04 21:38:33 from gp_mix_pixels.gen.h.t
6 *
7 * DO NOT MODIFY THIS FILE DIRECTLY!
8 */
9#ifndef GP_MIX_PIXELS_GEN_H
10#define GP_MIX_PIXELS_GEN_H
11
12/*
13 * Macros to mix two pixels accordingly to percentage.
14 *
15 * Copyright (C) 2011-2014 Cyril Hrubis <metan@ucw.cz>
16 */
17
18#include <core/gp_pixmap.h>
19#include <core/gp_pixel.h>
22
23
24/*
25 * Mixes two RGB101010 pixels.
26 *
27 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
28 */
29#define GP_MIX_PIXELS_LINEAR_RGB101010(pix1, pix2, perc) ({ \
30 gp_pixel R; \
31\
32 R = GP_PIXEL_GET_R_RGB101010(pix1) * (perc); \
33 R += GP_PIXEL_GET_R_RGB101010(pix2) * (255 - (perc)); \
34 R = (R + 128) / 255; \
35\
36 gp_pixel G; \
37\
38 G = GP_PIXEL_GET_G_RGB101010(pix1) * (perc); \
39 G += GP_PIXEL_GET_G_RGB101010(pix2) * (255 - (perc)); \
40 G = (G + 128) / 255; \
41\
42 gp_pixel B; \
43\
44 B = GP_PIXEL_GET_B_RGB101010(pix1) * (perc); \
45 B += GP_PIXEL_GET_B_RGB101010(pix2) * (255 - (perc)); \
46 B = (B + 128) / 255; \
47\
48\
49 GP_PIXEL_CREATE_RGB101010(R, G, B); \
50})
51
52#define GP_MIX_PIXELS_RGB101010(pix1, pix2, perc) \
53 GP_MIX_PIXELS_LINEAR_RGB101010(pix1, pix2, perc)
54
55/*
56 * Mixes two xRGB8888 pixels.
57 *
58 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
59 */
60#define GP_MIX_PIXELS_LINEAR_xRGB8888(pix1, pix2, perc) ({ \
61 gp_pixel R; \
62\
63 R = GP_PIXEL_GET_R_xRGB8888(pix1) * (perc); \
64 R += GP_PIXEL_GET_R_xRGB8888(pix2) * (255 - (perc)); \
65 R = (R + 128) / 255; \
66\
67 gp_pixel G; \
68\
69 G = GP_PIXEL_GET_G_xRGB8888(pix1) * (perc); \
70 G += GP_PIXEL_GET_G_xRGB8888(pix2) * (255 - (perc)); \
71 G = (G + 128) / 255; \
72\
73 gp_pixel B; \
74\
75 B = GP_PIXEL_GET_B_xRGB8888(pix1) * (perc); \
76 B += GP_PIXEL_GET_B_xRGB8888(pix2) * (255 - (perc)); \
77 B = (B + 128) / 255; \
78\
79\
80 GP_PIXEL_CREATE_xRGB8888(R, G, B); \
81})
82
83#define GP_MIX_PIXELS_xRGB8888(pix1, pix2, perc) \
84 GP_MIX_PIXELS_LINEAR_xRGB8888(pix1, pix2, perc)
85
86/*
87 * Mixes two RGBA8888 pixels.
88 *
89 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
90 */
91#define GP_MIX_PIXELS_LINEAR_RGBA8888(pix1, pix2, perc) ({ \
92 gp_pixel R; \
93\
94 R = GP_PIXEL_GET_R_RGBA8888(pix1) * (perc); \
95 R += GP_PIXEL_GET_R_RGBA8888(pix2) * (255 - (perc)); \
96 R = (R + 128) / 255; \
97\
98 gp_pixel G; \
99\
100 G = GP_PIXEL_GET_G_RGBA8888(pix1) * (perc); \
101 G += GP_PIXEL_GET_G_RGBA8888(pix2) * (255 - (perc)); \
102 G = (G + 128) / 255; \
103\
104 gp_pixel B; \
105\
106 B = GP_PIXEL_GET_B_RGBA8888(pix1) * (perc); \
107 B += GP_PIXEL_GET_B_RGBA8888(pix2) * (255 - (perc)); \
108 B = (B + 128) / 255; \
109\
110 gp_pixel A; \
111\
112 A = GP_PIXEL_GET_A_RGBA8888(pix1) * (perc); \
113 A += GP_PIXEL_GET_A_RGBA8888(pix2) * (255 - (perc)); \
114 A = (A + 128) / 255; \
115\
116\
117 GP_PIXEL_CREATE_RGBA8888(R, G, B, A); \
118})
119
120#define GP_MIX_PIXELS_RGBA8888(pix1, pix2, perc) \
121 GP_MIX_PIXELS_LINEAR_RGBA8888(pix1, pix2, perc)
122
123/*
124 * Mixes two RGB888 pixels.
125 *
126 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
127 */
128#define GP_MIX_PIXELS_LINEAR_RGB888(pix1, pix2, perc) ({ \
129 gp_pixel R; \
130\
131 R = GP_PIXEL_GET_R_RGB888(pix1) * (perc); \
132 R += GP_PIXEL_GET_R_RGB888(pix2) * (255 - (perc)); \
133 R = (R + 128) / 255; \
134\
135 gp_pixel G; \
136\
137 G = GP_PIXEL_GET_G_RGB888(pix1) * (perc); \
138 G += GP_PIXEL_GET_G_RGB888(pix2) * (255 - (perc)); \
139 G = (G + 128) / 255; \
140\
141 gp_pixel B; \
142\
143 B = GP_PIXEL_GET_B_RGB888(pix1) * (perc); \
144 B += GP_PIXEL_GET_B_RGB888(pix2) * (255 - (perc)); \
145 B = (B + 128) / 255; \
146\
147\
148 GP_PIXEL_CREATE_RGB888(R, G, B); \
149})
150
151#define GP_MIX_PIXELS_RGB888(pix1, pix2, perc) \
152 GP_MIX_PIXELS_LINEAR_RGB888(pix1, pix2, perc)
153
154/*
155 * Mixes two BGR888 pixels.
156 *
157 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
158 */
159#define GP_MIX_PIXELS_LINEAR_BGR888(pix1, pix2, perc) ({ \
160 gp_pixel B; \
161\
162 B = GP_PIXEL_GET_B_BGR888(pix1) * (perc); \
163 B += GP_PIXEL_GET_B_BGR888(pix2) * (255 - (perc)); \
164 B = (B + 128) / 255; \
165\
166 gp_pixel G; \
167\
168 G = GP_PIXEL_GET_G_BGR888(pix1) * (perc); \
169 G += GP_PIXEL_GET_G_BGR888(pix2) * (255 - (perc)); \
170 G = (G + 128) / 255; \
171\
172 gp_pixel R; \
173\
174 R = GP_PIXEL_GET_R_BGR888(pix1) * (perc); \
175 R += GP_PIXEL_GET_R_BGR888(pix2) * (255 - (perc)); \
176 R = (R + 128) / 255; \
177\
178\
179 GP_PIXEL_CREATE_BGR888(B, G, R); \
180})
181
182#define GP_MIX_PIXELS_BGR888(pix1, pix2, perc) \
183 GP_MIX_PIXELS_LINEAR_BGR888(pix1, pix2, perc)
184
185/*
186 * Mixes two RGB555 pixels.
187 *
188 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
189 */
190#define GP_MIX_PIXELS_LINEAR_RGB555(pix1, pix2, perc) ({ \
191 gp_pixel R; \
192\
193 R = GP_PIXEL_GET_R_RGB555(pix1) * (perc); \
194 R += GP_PIXEL_GET_R_RGB555(pix2) * (255 - (perc)); \
195 R = (R + 128) / 255; \
196\
197 gp_pixel G; \
198\
199 G = GP_PIXEL_GET_G_RGB555(pix1) * (perc); \
200 G += GP_PIXEL_GET_G_RGB555(pix2) * (255 - (perc)); \
201 G = (G + 128) / 255; \
202\
203 gp_pixel B; \
204\
205 B = GP_PIXEL_GET_B_RGB555(pix1) * (perc); \
206 B += GP_PIXEL_GET_B_RGB555(pix2) * (255 - (perc)); \
207 B = (B + 128) / 255; \
208\
209\
210 GP_PIXEL_CREATE_RGB555(R, G, B); \
211})
212
213#define GP_MIX_PIXELS_RGB555(pix1, pix2, perc) \
214 GP_MIX_PIXELS_LINEAR_RGB555(pix1, pix2, perc)
215
216/*
217 * Mixes two RGB565 pixels.
218 *
219 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
220 */
221#define GP_MIX_PIXELS_LINEAR_RGB565(pix1, pix2, perc) ({ \
222 gp_pixel R; \
223\
224 R = GP_PIXEL_GET_R_RGB565(pix1) * (perc); \
225 R += GP_PIXEL_GET_R_RGB565(pix2) * (255 - (perc)); \
226 R = (R + 128) / 255; \
227\
228 gp_pixel G; \
229\
230 G = GP_PIXEL_GET_G_RGB565(pix1) * (perc); \
231 G += GP_PIXEL_GET_G_RGB565(pix2) * (255 - (perc)); \
232 G = (G + 128) / 255; \
233\
234 gp_pixel B; \
235\
236 B = GP_PIXEL_GET_B_RGB565(pix1) * (perc); \
237 B += GP_PIXEL_GET_B_RGB565(pix2) * (255 - (perc)); \
238 B = (B + 128) / 255; \
239\
240\
241 GP_PIXEL_CREATE_RGB565(R, G, B); \
242})
243
244#define GP_MIX_PIXELS_RGB565(pix1, pix2, perc) \
245 GP_MIX_PIXELS_LINEAR_RGB565(pix1, pix2, perc)
246
247/*
248 * Mixes two RGB666 pixels.
249 *
250 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
251 */
252#define GP_MIX_PIXELS_LINEAR_RGB666(pix1, pix2, perc) ({ \
253 gp_pixel R; \
254\
255 R = GP_PIXEL_GET_R_RGB666(pix1) * (perc); \
256 R += GP_PIXEL_GET_R_RGB666(pix2) * (255 - (perc)); \
257 R = (R + 128) / 255; \
258\
259 gp_pixel G; \
260\
261 G = GP_PIXEL_GET_G_RGB666(pix1) * (perc); \
262 G += GP_PIXEL_GET_G_RGB666(pix2) * (255 - (perc)); \
263 G = (G + 128) / 255; \
264\
265 gp_pixel B; \
266\
267 B = GP_PIXEL_GET_B_RGB666(pix1) * (perc); \
268 B += GP_PIXEL_GET_B_RGB666(pix2) * (255 - (perc)); \
269 B = (B + 128) / 255; \
270\
271\
272 GP_PIXEL_CREATE_RGB666(R, G, B); \
273})
274
275#define GP_MIX_PIXELS_RGB666(pix1, pix2, perc) \
276 GP_MIX_PIXELS_LINEAR_RGB666(pix1, pix2, perc)
277
278/*
279 * Mixes two RGB332 pixels.
280 *
281 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
282 */
283#define GP_MIX_PIXELS_LINEAR_RGB332(pix1, pix2, perc) ({ \
284 gp_pixel R; \
285\
286 R = GP_PIXEL_GET_R_RGB332(pix1) * (perc); \
287 R += GP_PIXEL_GET_R_RGB332(pix2) * (255 - (perc)); \
288 R = (R + 128) / 255; \
289\
290 gp_pixel G; \
291\
292 G = GP_PIXEL_GET_G_RGB332(pix1) * (perc); \
293 G += GP_PIXEL_GET_G_RGB332(pix2) * (255 - (perc)); \
294 G = (G + 128) / 255; \
295\
296 gp_pixel B; \
297\
298 B = GP_PIXEL_GET_B_RGB332(pix1) * (perc); \
299 B += GP_PIXEL_GET_B_RGB332(pix2) * (255 - (perc)); \
300 B = (B + 128) / 255; \
301\
302\
303 GP_PIXEL_CREATE_RGB332(R, G, B); \
304})
305
306#define GP_MIX_PIXELS_RGB332(pix1, pix2, perc) \
307 GP_MIX_PIXELS_LINEAR_RGB332(pix1, pix2, perc)
308
309/*
310 * Mixes two CMYK8888 pixels.
311 *
312 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
313 */
314#define GP_MIX_PIXELS_LINEAR_CMYK8888(pix1, pix2, perc) ({ \
315 gp_pixel K; \
316\
317 K = GP_PIXEL_GET_K_CMYK8888(pix1) * (perc); \
318 K += GP_PIXEL_GET_K_CMYK8888(pix2) * (255 - (perc)); \
319 K = (K + 128) / 255; \
320\
321 gp_pixel Y; \
322\
323 Y = GP_PIXEL_GET_Y_CMYK8888(pix1) * (perc); \
324 Y += GP_PIXEL_GET_Y_CMYK8888(pix2) * (255 - (perc)); \
325 Y = (Y + 128) / 255; \
326\
327 gp_pixel M; \
328\
329 M = GP_PIXEL_GET_M_CMYK8888(pix1) * (perc); \
330 M += GP_PIXEL_GET_M_CMYK8888(pix2) * (255 - (perc)); \
331 M = (M + 128) / 255; \
332\
333 gp_pixel C; \
334\
335 C = GP_PIXEL_GET_C_CMYK8888(pix1) * (perc); \
336 C += GP_PIXEL_GET_C_CMYK8888(pix2) * (255 - (perc)); \
337 C = (C + 128) / 255; \
338\
339\
340 GP_PIXEL_CREATE_CMYK8888(K, Y, M, C); \
341})
342
343#define GP_MIX_PIXELS_CMYK8888(pix1, pix2, perc) \
344 GP_MIX_PIXELS_LINEAR_CMYK8888(pix1, pix2, perc)
345
346/*
347 * Mixes two P2 pixels.
348 *
349 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
350 */
351#define GP_MIX_PIXELS_LINEAR_P2(pix1, pix2, perc) ({ \
352 gp_pixel P; \
353\
354 P = GP_PIXEL_GET_P_P2(pix1) * (perc); \
355 P += GP_PIXEL_GET_P_P2(pix2) * (255 - (perc)); \
356 P = (P + 128) / 255; \
357\
358\
359 GP_PIXEL_CREATE_P2(P); \
360})
361
362#define GP_MIX_PIXELS_P2(pix1, pix2, perc) \
363 GP_MIX_PIXELS_LINEAR_P2(pix1, pix2, perc)
364
365/*
366 * Mixes two P4 pixels.
367 *
368 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
369 */
370#define GP_MIX_PIXELS_LINEAR_P4(pix1, pix2, perc) ({ \
371 gp_pixel P; \
372\
373 P = GP_PIXEL_GET_P_P4(pix1) * (perc); \
374 P += GP_PIXEL_GET_P_P4(pix2) * (255 - (perc)); \
375 P = (P + 128) / 255; \
376\
377\
378 GP_PIXEL_CREATE_P4(P); \
379})
380
381#define GP_MIX_PIXELS_P4(pix1, pix2, perc) \
382 GP_MIX_PIXELS_LINEAR_P4(pix1, pix2, perc)
383
384/*
385 * Mixes two P8 pixels.
386 *
387 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
388 */
389#define GP_MIX_PIXELS_LINEAR_P8(pix1, pix2, perc) ({ \
390 gp_pixel P; \
391\
392 P = GP_PIXEL_GET_P_P8(pix1) * (perc); \
393 P += GP_PIXEL_GET_P_P8(pix2) * (255 - (perc)); \
394 P = (P + 128) / 255; \
395\
396\
397 GP_PIXEL_CREATE_P8(P); \
398})
399
400#define GP_MIX_PIXELS_P8(pix1, pix2, perc) \
401 GP_MIX_PIXELS_LINEAR_P8(pix1, pix2, perc)
402
403/*
404 * Mixes two G1_DB pixels.
405 *
406 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
407 */
408#define GP_MIX_PIXELS_LINEAR_G1_DB(pix1, pix2, perc) ({ \
409 gp_pixel V; \
410\
411 V = GP_PIXEL_GET_V_G1_DB(pix1) * (perc); \
412 V += GP_PIXEL_GET_V_G1_DB(pix2) * (255 - (perc)); \
413 V = (V + 128) / 255; \
414\
415\
416 GP_PIXEL_CREATE_G1_DB(V); \
417})
418
419#define GP_MIX_PIXELS_G1_DB(pix1, pix2, perc) \
420 GP_MIX_PIXELS_LINEAR_G1_DB(pix1, pix2, perc)
421
422/*
423 * Mixes two G2_DB pixels.
424 *
425 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
426 */
427#define GP_MIX_PIXELS_LINEAR_G2_DB(pix1, pix2, perc) ({ \
428 gp_pixel V; \
429\
430 V = GP_PIXEL_GET_V_G2_DB(pix1) * (perc); \
431 V += GP_PIXEL_GET_V_G2_DB(pix2) * (255 - (perc)); \
432 V = (V + 128) / 255; \
433\
434\
435 GP_PIXEL_CREATE_G2_DB(V); \
436})
437
438#define GP_MIX_PIXELS_G2_DB(pix1, pix2, perc) \
439 GP_MIX_PIXELS_LINEAR_G2_DB(pix1, pix2, perc)
440
441/*
442 * Mixes two G4_DB pixels.
443 *
444 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
445 */
446#define GP_MIX_PIXELS_LINEAR_G4_DB(pix1, pix2, perc) ({ \
447 gp_pixel V; \
448\
449 V = GP_PIXEL_GET_V_G4_DB(pix1) * (perc); \
450 V += GP_PIXEL_GET_V_G4_DB(pix2) * (255 - (perc)); \
451 V = (V + 128) / 255; \
452\
453\
454 GP_PIXEL_CREATE_G4_DB(V); \
455})
456
457#define GP_MIX_PIXELS_G4_DB(pix1, pix2, perc) \
458 GP_MIX_PIXELS_LINEAR_G4_DB(pix1, pix2, perc)
459
460/*
461 * Mixes two G1_UB pixels.
462 *
463 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
464 */
465#define GP_MIX_PIXELS_LINEAR_G1_UB(pix1, pix2, perc) ({ \
466 gp_pixel V; \
467\
468 V = GP_PIXEL_GET_V_G1_UB(pix1) * (perc); \
469 V += GP_PIXEL_GET_V_G1_UB(pix2) * (255 - (perc)); \
470 V = (V + 128) / 255; \
471\
472\
473 GP_PIXEL_CREATE_G1_UB(V); \
474})
475
476#define GP_MIX_PIXELS_G1_UB(pix1, pix2, perc) \
477 GP_MIX_PIXELS_LINEAR_G1_UB(pix1, pix2, perc)
478
479/*
480 * Mixes two G2_UB pixels.
481 *
482 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
483 */
484#define GP_MIX_PIXELS_LINEAR_G2_UB(pix1, pix2, perc) ({ \
485 gp_pixel V; \
486\
487 V = GP_PIXEL_GET_V_G2_UB(pix1) * (perc); \
488 V += GP_PIXEL_GET_V_G2_UB(pix2) * (255 - (perc)); \
489 V = (V + 128) / 255; \
490\
491\
492 GP_PIXEL_CREATE_G2_UB(V); \
493})
494
495#define GP_MIX_PIXELS_G2_UB(pix1, pix2, perc) \
496 GP_MIX_PIXELS_LINEAR_G2_UB(pix1, pix2, perc)
497
498/*
499 * Mixes two G4_UB pixels.
500 *
501 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
502 */
503#define GP_MIX_PIXELS_LINEAR_G4_UB(pix1, pix2, perc) ({ \
504 gp_pixel V; \
505\
506 V = GP_PIXEL_GET_V_G4_UB(pix1) * (perc); \
507 V += GP_PIXEL_GET_V_G4_UB(pix2) * (255 - (perc)); \
508 V = (V + 128) / 255; \
509\
510\
511 GP_PIXEL_CREATE_G4_UB(V); \
512})
513
514#define GP_MIX_PIXELS_G4_UB(pix1, pix2, perc) \
515 GP_MIX_PIXELS_LINEAR_G4_UB(pix1, pix2, perc)
516
517/*
518 * Mixes two G8 pixels.
519 *
520 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
521 */
522#define GP_MIX_PIXELS_LINEAR_G8(pix1, pix2, perc) ({ \
523 gp_pixel V; \
524\
525 V = GP_PIXEL_GET_V_G8(pix1) * (perc); \
526 V += GP_PIXEL_GET_V_G8(pix2) * (255 - (perc)); \
527 V = (V + 128) / 255; \
528\
529\
530 GP_PIXEL_CREATE_G8(V); \
531})
532
533#define GP_MIX_PIXELS_G8(pix1, pix2, perc) \
534 GP_MIX_PIXELS_LINEAR_G8(pix1, pix2, perc)
535
536/*
537 * Mixes two GA88 pixels.
538 *
539 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
540 */
541#define GP_MIX_PIXELS_LINEAR_GA88(pix1, pix2, perc) ({ \
542 gp_pixel V; \
543\
544 V = GP_PIXEL_GET_V_GA88(pix1) * (perc); \
545 V += GP_PIXEL_GET_V_GA88(pix2) * (255 - (perc)); \
546 V = (V + 128) / 255; \
547\
548 gp_pixel A; \
549\
550 A = GP_PIXEL_GET_A_GA88(pix1) * (perc); \
551 A += GP_PIXEL_GET_A_GA88(pix2) * (255 - (perc)); \
552 A = (A + 128) / 255; \
553\
554\
555 GP_PIXEL_CREATE_GA88(V, A); \
556})
557
558#define GP_MIX_PIXELS_GA88(pix1, pix2, perc) \
559 GP_MIX_PIXELS_LINEAR_GA88(pix1, pix2, perc)
560
561/*
562 * Mixes two G16 pixels.
563 *
564 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
565 */
566#define GP_MIX_PIXELS_LINEAR_G16(pix1, pix2, perc) ({ \
567 gp_pixel V; \
568\
569 V = GP_PIXEL_GET_V_G16(pix1) * (perc); \
570 V += GP_PIXEL_GET_V_G16(pix2) * (255 - (perc)); \
571 V = (V + 128) / 255; \
572\
573\
574 GP_PIXEL_CREATE_G16(V); \
575})
576
577#define GP_MIX_PIXELS_G16(pix1, pix2, perc) \
578 GP_MIX_PIXELS_LINEAR_G16(pix1, pix2, perc)
579
580static inline gp_pixel gp_mix_pixels(gp_pixel pix1, gp_pixel pix2,
581 uint8_t perc, gp_pixel_type pixel_type)
582{
583 switch (pixel_type) {
584 case GP_PIXEL_RGB101010:
585 return GP_MIX_PIXELS_LINEAR_RGB101010(pix1, pix2, perc);
586 case GP_PIXEL_xRGB8888:
587 return GP_MIX_PIXELS_LINEAR_xRGB8888(pix1, pix2, perc);
588 case GP_PIXEL_RGBA8888:
589 return GP_MIX_PIXELS_LINEAR_RGBA8888(pix1, pix2, perc);
590 case GP_PIXEL_RGB888:
591 return GP_MIX_PIXELS_LINEAR_RGB888(pix1, pix2, perc);
592 case GP_PIXEL_BGR888:
593 return GP_MIX_PIXELS_LINEAR_BGR888(pix1, pix2, perc);
594 case GP_PIXEL_RGB555:
595 return GP_MIX_PIXELS_LINEAR_RGB555(pix1, pix2, perc);
596 case GP_PIXEL_RGB565:
597 return GP_MIX_PIXELS_LINEAR_RGB565(pix1, pix2, perc);
598 case GP_PIXEL_RGB666:
599 return GP_MIX_PIXELS_LINEAR_RGB666(pix1, pix2, perc);
600 case GP_PIXEL_RGB332:
601 return GP_MIX_PIXELS_LINEAR_RGB332(pix1, pix2, perc);
602 case GP_PIXEL_CMYK8888:
603 return GP_MIX_PIXELS_LINEAR_CMYK8888(pix1, pix2, perc);
604 case GP_PIXEL_P2:
605 return GP_MIX_PIXELS_LINEAR_P2(pix1, pix2, perc);
606 case GP_PIXEL_P4:
607 return GP_MIX_PIXELS_LINEAR_P4(pix1, pix2, perc);
608 case GP_PIXEL_P8:
609 return GP_MIX_PIXELS_LINEAR_P8(pix1, pix2, perc);
610 case GP_PIXEL_G1_DB:
611 return GP_MIX_PIXELS_LINEAR_G1_DB(pix1, pix2, perc);
612 case GP_PIXEL_G2_DB:
613 return GP_MIX_PIXELS_LINEAR_G2_DB(pix1, pix2, perc);
614 case GP_PIXEL_G4_DB:
615 return GP_MIX_PIXELS_LINEAR_G4_DB(pix1, pix2, perc);
616 case GP_PIXEL_G1_UB:
617 return GP_MIX_PIXELS_LINEAR_G1_UB(pix1, pix2, perc);
618 case GP_PIXEL_G2_UB:
619 return GP_MIX_PIXELS_LINEAR_G2_UB(pix1, pix2, perc);
620 case GP_PIXEL_G4_UB:
621 return GP_MIX_PIXELS_LINEAR_G4_UB(pix1, pix2, perc);
622 case GP_PIXEL_G8:
623 return GP_MIX_PIXELS_LINEAR_G8(pix1, pix2, perc);
624 case GP_PIXEL_GA88:
625 return GP_MIX_PIXELS_LINEAR_GA88(pix1, pix2, perc);
626 case GP_PIXEL_G16:
627 return GP_MIX_PIXELS_LINEAR_G16(pix1, pix2, perc);
628 default:
629 GP_ABORT("Unknown pixeltype");
630 }
631}
632
633
634static inline void gp_mix_pixel_raw_RGB101010(gp_pixmap *pixmap,
635 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
636{
637 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
638 pix = GP_MIX_PIXELS_RGB101010(pixel, pix, perc);
639 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
640}
641
642static inline void gp_mix_pixel_raw_xRGB8888(gp_pixmap *pixmap,
643 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
644{
645 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
646 pix = GP_MIX_PIXELS_xRGB8888(pixel, pix, perc);
647 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
648}
649
650static inline void gp_mix_pixel_raw_RGBA8888(gp_pixmap *pixmap,
651 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
652{
653 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
654 pix = GP_MIX_PIXELS_RGBA8888(pixel, pix, perc);
655 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
656}
657
658static inline void gp_mix_pixel_raw_RGB888(gp_pixmap *pixmap,
659 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
660{
661 gp_pixel pix = gp_getpixel_raw_24BPP(pixmap, x, y);
662 pix = GP_MIX_PIXELS_RGB888(pixel, pix, perc);
663 gp_putpixel_raw_24BPP(pixmap, x, y, pix);
664}
665
666static inline void gp_mix_pixel_raw_BGR888(gp_pixmap *pixmap,
667 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
668{
669 gp_pixel pix = gp_getpixel_raw_24BPP(pixmap, x, y);
670 pix = GP_MIX_PIXELS_BGR888(pixel, pix, perc);
671 gp_putpixel_raw_24BPP(pixmap, x, y, pix);
672}
673
674static inline void gp_mix_pixel_raw_RGB555(gp_pixmap *pixmap,
675 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
676{
677 gp_pixel pix = gp_getpixel_raw_16BPP(pixmap, x, y);
678 pix = GP_MIX_PIXELS_RGB555(pixel, pix, perc);
679 gp_putpixel_raw_16BPP(pixmap, x, y, pix);
680}
681
682static inline void gp_mix_pixel_raw_RGB565(gp_pixmap *pixmap,
683 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
684{
685 gp_pixel pix = gp_getpixel_raw_16BPP(pixmap, x, y);
686 pix = GP_MIX_PIXELS_RGB565(pixel, pix, perc);
687 gp_putpixel_raw_16BPP(pixmap, x, y, pix);
688}
689
690static inline void gp_mix_pixel_raw_RGB666(gp_pixmap *pixmap,
691 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
692{
693 gp_pixel pix = gp_getpixel_raw_18BPP_DB(pixmap, x, y);
694 pix = GP_MIX_PIXELS_RGB666(pixel, pix, perc);
695 gp_putpixel_raw_18BPP_DB(pixmap, x, y, pix);
696}
697
698static inline void gp_mix_pixel_raw_RGB332(gp_pixmap *pixmap,
699 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
700{
701 gp_pixel pix = gp_getpixel_raw_8BPP(pixmap, x, y);
702 pix = GP_MIX_PIXELS_RGB332(pixel, pix, perc);
703 gp_putpixel_raw_8BPP(pixmap, x, y, pix);
704}
705
706static inline void gp_mix_pixel_raw_CMYK8888(gp_pixmap *pixmap,
707 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
708{
709 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
710 pix = GP_MIX_PIXELS_CMYK8888(pixel, pix, perc);
711 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
712}
713
714static inline void gp_mix_pixel_raw_P2(gp_pixmap *pixmap,
715 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
716{
717 gp_pixel pix = gp_getpixel_raw_2BPP_UB(pixmap, x, y);
718 pix = GP_MIX_PIXELS_P2(pixel, pix, perc);
719 gp_putpixel_raw_2BPP_UB(pixmap, x, y, pix);
720}
721
722static inline void gp_mix_pixel_raw_P4(gp_pixmap *pixmap,
723 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
724{
725 gp_pixel pix = gp_getpixel_raw_4BPP_UB(pixmap, x, y);
726 pix = GP_MIX_PIXELS_P4(pixel, pix, perc);
727 gp_putpixel_raw_4BPP_UB(pixmap, x, y, pix);
728}
729
730static inline void gp_mix_pixel_raw_P8(gp_pixmap *pixmap,
731 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
732{
733 gp_pixel pix = gp_getpixel_raw_8BPP(pixmap, x, y);
734 pix = GP_MIX_PIXELS_P8(pixel, pix, perc);
735 gp_putpixel_raw_8BPP(pixmap, x, y, pix);
736}
737
738static inline void gp_mix_pixel_raw_G1_DB(gp_pixmap *pixmap,
739 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
740{
741 gp_pixel pix = gp_getpixel_raw_1BPP_DB(pixmap, x, y);
742 pix = GP_MIX_PIXELS_G1_DB(pixel, pix, perc);
743 gp_putpixel_raw_1BPP_DB(pixmap, x, y, pix);
744}
745
746static inline void gp_mix_pixel_raw_G2_DB(gp_pixmap *pixmap,
747 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
748{
749 gp_pixel pix = gp_getpixel_raw_2BPP_DB(pixmap, x, y);
750 pix = GP_MIX_PIXELS_G2_DB(pixel, pix, perc);
751 gp_putpixel_raw_2BPP_DB(pixmap, x, y, pix);
752}
753
754static inline void gp_mix_pixel_raw_G4_DB(gp_pixmap *pixmap,
755 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
756{
757 gp_pixel pix = gp_getpixel_raw_4BPP_DB(pixmap, x, y);
758 pix = GP_MIX_PIXELS_G4_DB(pixel, pix, perc);
759 gp_putpixel_raw_4BPP_DB(pixmap, x, y, pix);
760}
761
762static inline void gp_mix_pixel_raw_G1_UB(gp_pixmap *pixmap,
763 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
764{
765 gp_pixel pix = gp_getpixel_raw_1BPP_UB(pixmap, x, y);
766 pix = GP_MIX_PIXELS_G1_UB(pixel, pix, perc);
767 gp_putpixel_raw_1BPP_UB(pixmap, x, y, pix);
768}
769
770static inline void gp_mix_pixel_raw_G2_UB(gp_pixmap *pixmap,
771 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
772{
773 gp_pixel pix = gp_getpixel_raw_2BPP_UB(pixmap, x, y);
774 pix = GP_MIX_PIXELS_G2_UB(pixel, pix, perc);
775 gp_putpixel_raw_2BPP_UB(pixmap, x, y, pix);
776}
777
778static inline void gp_mix_pixel_raw_G4_UB(gp_pixmap *pixmap,
779 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
780{
781 gp_pixel pix = gp_getpixel_raw_4BPP_UB(pixmap, x, y);
782 pix = GP_MIX_PIXELS_G4_UB(pixel, pix, perc);
783 gp_putpixel_raw_4BPP_UB(pixmap, x, y, pix);
784}
785
786static inline void gp_mix_pixel_raw_G8(gp_pixmap *pixmap,
787 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
788{
789 gp_pixel pix = gp_getpixel_raw_8BPP(pixmap, x, y);
790 pix = GP_MIX_PIXELS_G8(pixel, pix, perc);
791 gp_putpixel_raw_8BPP(pixmap, x, y, pix);
792}
793
794static inline void gp_mix_pixel_raw_GA88(gp_pixmap *pixmap,
795 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
796{
797 gp_pixel pix = gp_getpixel_raw_16BPP(pixmap, x, y);
798 pix = GP_MIX_PIXELS_GA88(pixel, pix, perc);
799 gp_putpixel_raw_16BPP(pixmap, x, y, pix);
800}
801
802static inline void gp_mix_pixel_raw_G16(gp_pixmap *pixmap,
803 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
804{
805 gp_pixel pix = gp_getpixel_raw_16BPP(pixmap, x, y);
806 pix = GP_MIX_PIXELS_G16(pixel, pix, perc);
807 gp_putpixel_raw_16BPP(pixmap, x, y, pix);
808}
809
810
811static inline void gp_mix_pixel_raw_clipped_RGB101010(gp_pixmap *pixmap,
812 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
813{
814 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
815 return;
816
817 gp_mix_pixel_raw_RGB101010(pixmap, x, y, pixel, perc);
818}
819
820static inline void gp_mix_pixel_raw_clipped_xRGB8888(gp_pixmap *pixmap,
821 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
822{
823 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
824 return;
825
826 gp_mix_pixel_raw_xRGB8888(pixmap, x, y, pixel, perc);
827}
828
829static inline void gp_mix_pixel_raw_clipped_RGBA8888(gp_pixmap *pixmap,
830 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
831{
832 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
833 return;
834
835 gp_mix_pixel_raw_RGBA8888(pixmap, x, y, pixel, perc);
836}
837
838static inline void gp_mix_pixel_raw_clipped_RGB888(gp_pixmap *pixmap,
839 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
840{
841 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
842 return;
843
844 gp_mix_pixel_raw_RGB888(pixmap, x, y, pixel, perc);
845}
846
847static inline void gp_mix_pixel_raw_clipped_BGR888(gp_pixmap *pixmap,
848 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
849{
850 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
851 return;
852
853 gp_mix_pixel_raw_BGR888(pixmap, x, y, pixel, perc);
854}
855
856static inline void gp_mix_pixel_raw_clipped_RGB555(gp_pixmap *pixmap,
857 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
858{
859 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
860 return;
861
862 gp_mix_pixel_raw_RGB555(pixmap, x, y, pixel, perc);
863}
864
865static inline void gp_mix_pixel_raw_clipped_RGB565(gp_pixmap *pixmap,
866 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
867{
868 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
869 return;
870
871 gp_mix_pixel_raw_RGB565(pixmap, x, y, pixel, perc);
872}
873
874static inline void gp_mix_pixel_raw_clipped_RGB666(gp_pixmap *pixmap,
875 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
876{
877 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
878 return;
879
880 gp_mix_pixel_raw_RGB666(pixmap, x, y, pixel, perc);
881}
882
883static inline void gp_mix_pixel_raw_clipped_RGB332(gp_pixmap *pixmap,
884 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
885{
886 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
887 return;
888
889 gp_mix_pixel_raw_RGB332(pixmap, x, y, pixel, perc);
890}
891
892static inline void gp_mix_pixel_raw_clipped_CMYK8888(gp_pixmap *pixmap,
893 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
894{
895 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
896 return;
897
898 gp_mix_pixel_raw_CMYK8888(pixmap, x, y, pixel, perc);
899}
900
901static inline void gp_mix_pixel_raw_clipped_P2(gp_pixmap *pixmap,
902 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
903{
904 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
905 return;
906
907 gp_mix_pixel_raw_P2(pixmap, x, y, pixel, perc);
908}
909
910static inline void gp_mix_pixel_raw_clipped_P4(gp_pixmap *pixmap,
911 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
912{
913 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
914 return;
915
916 gp_mix_pixel_raw_P4(pixmap, x, y, pixel, perc);
917}
918
919static inline void gp_mix_pixel_raw_clipped_P8(gp_pixmap *pixmap,
920 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
921{
922 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
923 return;
924
925 gp_mix_pixel_raw_P8(pixmap, x, y, pixel, perc);
926}
927
928static inline void gp_mix_pixel_raw_clipped_G1_DB(gp_pixmap *pixmap,
929 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
930{
931 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
932 return;
933
934 gp_mix_pixel_raw_G1_DB(pixmap, x, y, pixel, perc);
935}
936
937static inline void gp_mix_pixel_raw_clipped_G2_DB(gp_pixmap *pixmap,
938 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
939{
940 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
941 return;
942
943 gp_mix_pixel_raw_G2_DB(pixmap, x, y, pixel, perc);
944}
945
946static inline void gp_mix_pixel_raw_clipped_G4_DB(gp_pixmap *pixmap,
947 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
948{
949 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
950 return;
951
952 gp_mix_pixel_raw_G4_DB(pixmap, x, y, pixel, perc);
953}
954
955static inline void gp_mix_pixel_raw_clipped_G1_UB(gp_pixmap *pixmap,
956 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
957{
958 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
959 return;
960
961 gp_mix_pixel_raw_G1_UB(pixmap, x, y, pixel, perc);
962}
963
964static inline void gp_mix_pixel_raw_clipped_G2_UB(gp_pixmap *pixmap,
965 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
966{
967 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
968 return;
969
970 gp_mix_pixel_raw_G2_UB(pixmap, x, y, pixel, perc);
971}
972
973static inline void gp_mix_pixel_raw_clipped_G4_UB(gp_pixmap *pixmap,
974 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
975{
976 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
977 return;
978
979 gp_mix_pixel_raw_G4_UB(pixmap, x, y, pixel, perc);
980}
981
982static inline void gp_mix_pixel_raw_clipped_G8(gp_pixmap *pixmap,
983 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
984{
985 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
986 return;
987
988 gp_mix_pixel_raw_G8(pixmap, x, y, pixel, perc);
989}
990
991static inline void gp_mix_pixel_raw_clipped_GA88(gp_pixmap *pixmap,
992 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
993{
994 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
995 return;
996
997 gp_mix_pixel_raw_GA88(pixmap, x, y, pixel, perc);
998}
999
1000static inline void gp_mix_pixel_raw_clipped_G16(gp_pixmap *pixmap,
1001 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1002{
1003 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1004 return;
1005
1006 gp_mix_pixel_raw_G16(pixmap, x, y, pixel, perc);
1007}
1008
1009
1010static inline void gp_mix_pixel_raw(gp_pixmap *pixmap, gp_coord x, gp_coord y,
1011 gp_pixel pixel, uint8_t perc)
1012{
1013 switch (pixmap->pixel_type) {
1014 case GP_PIXEL_RGB101010:
1015 gp_mix_pixel_raw_RGB101010(pixmap, x, y, pixel, perc);
1016 break;
1017 case GP_PIXEL_xRGB8888:
1018 gp_mix_pixel_raw_xRGB8888(pixmap, x, y, pixel, perc);
1019 break;
1020 case GP_PIXEL_RGBA8888:
1021 gp_mix_pixel_raw_RGBA8888(pixmap, x, y, pixel, perc);
1022 break;
1023 case GP_PIXEL_RGB888:
1024 gp_mix_pixel_raw_RGB888(pixmap, x, y, pixel, perc);
1025 break;
1026 case GP_PIXEL_BGR888:
1027 gp_mix_pixel_raw_BGR888(pixmap, x, y, pixel, perc);
1028 break;
1029 case GP_PIXEL_RGB555:
1030 gp_mix_pixel_raw_RGB555(pixmap, x, y, pixel, perc);
1031 break;
1032 case GP_PIXEL_RGB565:
1033 gp_mix_pixel_raw_RGB565(pixmap, x, y, pixel, perc);
1034 break;
1035 case GP_PIXEL_RGB666:
1036 gp_mix_pixel_raw_RGB666(pixmap, x, y, pixel, perc);
1037 break;
1038 case GP_PIXEL_RGB332:
1039 gp_mix_pixel_raw_RGB332(pixmap, x, y, pixel, perc);
1040 break;
1041 case GP_PIXEL_CMYK8888:
1042 gp_mix_pixel_raw_CMYK8888(pixmap, x, y, pixel, perc);
1043 break;
1044 case GP_PIXEL_P2:
1045 gp_mix_pixel_raw_P2(pixmap, x, y, pixel, perc);
1046 break;
1047 case GP_PIXEL_P4:
1048 gp_mix_pixel_raw_P4(pixmap, x, y, pixel, perc);
1049 break;
1050 case GP_PIXEL_P8:
1051 gp_mix_pixel_raw_P8(pixmap, x, y, pixel, perc);
1052 break;
1053 case GP_PIXEL_G1_DB:
1054 gp_mix_pixel_raw_G1_DB(pixmap, x, y, pixel, perc);
1055 break;
1056 case GP_PIXEL_G2_DB:
1057 gp_mix_pixel_raw_G2_DB(pixmap, x, y, pixel, perc);
1058 break;
1059 case GP_PIXEL_G4_DB:
1060 gp_mix_pixel_raw_G4_DB(pixmap, x, y, pixel, perc);
1061 break;
1062 case GP_PIXEL_G1_UB:
1063 gp_mix_pixel_raw_G1_UB(pixmap, x, y, pixel, perc);
1064 break;
1065 case GP_PIXEL_G2_UB:
1066 gp_mix_pixel_raw_G2_UB(pixmap, x, y, pixel, perc);
1067 break;
1068 case GP_PIXEL_G4_UB:
1069 gp_mix_pixel_raw_G4_UB(pixmap, x, y, pixel, perc);
1070 break;
1071 case GP_PIXEL_G8:
1072 gp_mix_pixel_raw_G8(pixmap, x, y, pixel, perc);
1073 break;
1074 case GP_PIXEL_GA88:
1075 gp_mix_pixel_raw_GA88(pixmap, x, y, pixel, perc);
1076 break;
1077 case GP_PIXEL_G16:
1078 gp_mix_pixel_raw_G16(pixmap, x, y, pixel, perc);
1079 break;
1080 default:
1081 GP_ABORT("Unknown pixeltype");
1082 }
1083}
1084
1085static inline void gp_mix_pixel_raw_clipped(gp_pixmap *pixmap,
1086 gp_coord x, gp_coord y,
1087 gp_pixel pixel, uint8_t perc)
1088{
1089 switch (pixmap->pixel_type) {
1090 case GP_PIXEL_RGB101010:
1091 gp_mix_pixel_raw_clipped_RGB101010(pixmap, x, y, pixel, perc);
1092 break;
1093 case GP_PIXEL_xRGB8888:
1094 gp_mix_pixel_raw_clipped_xRGB8888(pixmap, x, y, pixel, perc);
1095 break;
1096 case GP_PIXEL_RGBA8888:
1097 gp_mix_pixel_raw_clipped_RGBA8888(pixmap, x, y, pixel, perc);
1098 break;
1099 case GP_PIXEL_RGB888:
1100 gp_mix_pixel_raw_clipped_RGB888(pixmap, x, y, pixel, perc);
1101 break;
1102 case GP_PIXEL_BGR888:
1103 gp_mix_pixel_raw_clipped_BGR888(pixmap, x, y, pixel, perc);
1104 break;
1105 case GP_PIXEL_RGB555:
1106 gp_mix_pixel_raw_clipped_RGB555(pixmap, x, y, pixel, perc);
1107 break;
1108 case GP_PIXEL_RGB565:
1109 gp_mix_pixel_raw_clipped_RGB565(pixmap, x, y, pixel, perc);
1110 break;
1111 case GP_PIXEL_RGB666:
1112 gp_mix_pixel_raw_clipped_RGB666(pixmap, x, y, pixel, perc);
1113 break;
1114 case GP_PIXEL_RGB332:
1115 gp_mix_pixel_raw_clipped_RGB332(pixmap, x, y, pixel, perc);
1116 break;
1117 case GP_PIXEL_CMYK8888:
1118 gp_mix_pixel_raw_clipped_CMYK8888(pixmap, x, y, pixel, perc);
1119 break;
1120 case GP_PIXEL_P2:
1121 gp_mix_pixel_raw_clipped_P2(pixmap, x, y, pixel, perc);
1122 break;
1123 case GP_PIXEL_P4:
1124 gp_mix_pixel_raw_clipped_P4(pixmap, x, y, pixel, perc);
1125 break;
1126 case GP_PIXEL_P8:
1127 gp_mix_pixel_raw_clipped_P8(pixmap, x, y, pixel, perc);
1128 break;
1129 case GP_PIXEL_G1_DB:
1130 gp_mix_pixel_raw_clipped_G1_DB(pixmap, x, y, pixel, perc);
1131 break;
1132 case GP_PIXEL_G2_DB:
1133 gp_mix_pixel_raw_clipped_G2_DB(pixmap, x, y, pixel, perc);
1134 break;
1135 case GP_PIXEL_G4_DB:
1136 gp_mix_pixel_raw_clipped_G4_DB(pixmap, x, y, pixel, perc);
1137 break;
1138 case GP_PIXEL_G1_UB:
1139 gp_mix_pixel_raw_clipped_G1_UB(pixmap, x, y, pixel, perc);
1140 break;
1141 case GP_PIXEL_G2_UB:
1142 gp_mix_pixel_raw_clipped_G2_UB(pixmap, x, y, pixel, perc);
1143 break;
1144 case GP_PIXEL_G4_UB:
1145 gp_mix_pixel_raw_clipped_G4_UB(pixmap, x, y, pixel, perc);
1146 break;
1147 case GP_PIXEL_G8:
1148 gp_mix_pixel_raw_clipped_G8(pixmap, x, y, pixel, perc);
1149 break;
1150 case GP_PIXEL_GA88:
1151 gp_mix_pixel_raw_clipped_GA88(pixmap, x, y, pixel, perc);
1152 break;
1153 case GP_PIXEL_G16:
1154 gp_mix_pixel_raw_clipped_G16(pixmap, x, y, pixel, perc);
1155 break;
1156 default:
1157 GP_ABORT("Unknown pixeltype");
1158 }
1159}
1160#endif /* GP_MIX_PIXELS_GEN_H */
uint32_t gp_pixel
Pixel integer value.
Definition gp_types.h:33
int gp_coord
Integer type for coordinates i.e. x, y, ...
Definition gp_types.h:19
Gamma and sRGB corrections.
static void gp_putpixel_raw_18BPP_DB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 18BPP_DB
static gp_pixel gp_getpixel_raw_24BPP(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 24BPP
static void gp_putpixel_raw_1BPP_DB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 1BPP_DB
static void gp_putpixel_raw_1BPP_UB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 1BPP_UB
static gp_pixel gp_getpixel_raw_1BPP_DB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 1BPP_DB
static void gp_putpixel_raw_16BPP(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 16BPP
static void gp_putpixel_raw_24BPP(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 24BPP
static gp_pixel gp_getpixel_raw_1BPP_UB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 1BPP_UB
static void gp_putpixel_raw_4BPP_DB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 4BPP_DB
static void gp_putpixel_raw_32BPP(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 32BPP
static gp_pixel gp_getpixel_raw_2BPP_UB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 2BPP_UB
static gp_pixel gp_getpixel_raw_18BPP_DB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 18BPP_DB
static void gp_putpixel_raw_4BPP_UB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 4BPP_UB
static gp_pixel gp_getpixel_raw_8BPP(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 8BPP
static gp_pixel gp_getpixel_raw_4BPP_DB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 4BPP_DB
static void gp_putpixel_raw_2BPP_DB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 2BPP_DB
static gp_pixel gp_getpixel_raw_32BPP(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 32BPP
static void gp_putpixel_raw_8BPP(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 8BPP
static void gp_putpixel_raw_2BPP_UB(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 2BPP_UB
static gp_pixel gp_getpixel_raw_4BPP_UB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 4BPP_UB
static gp_pixel gp_getpixel_raw_2BPP_DB(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 2BPP_DB
static gp_pixel gp_getpixel_raw_16BPP(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 16BPP
Pixel manipulations.
gp_pixel_type
List of all pixel types.
A pixel description.
A pixel buffer.
#define GP_PIXEL_IS_CLIPPED(pixmap, x, y)
Returns true when pixel is clipped out of pixmap.
Definition gp_pixmap.h:127
A pixmap buffer.
Definition gp_pixmap.h:33
enum gp_pixel_type pixel_type
A pixel format.
Definition gp_pixmap.h:63