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 2025 11 30 21:24:31 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_BE pixels.
218 *
219 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
220 */
221#define GP_MIX_PIXELS_LINEAR_RGB565_BE(pix1, pix2, perc) ({ \
222 gp_pixel R; \
223\
224 R = GP_PIXEL_GET_R_RGB565_BE(pix1) * (perc); \
225 R += GP_PIXEL_GET_R_RGB565_BE(pix2) * (255 - (perc)); \
226 R = (R + 128) / 255; \
227\
228 gp_pixel G; \
229\
230 G = GP_PIXEL_GET_G_RGB565_BE(pix1) * (perc); \
231 G += GP_PIXEL_GET_G_RGB565_BE(pix2) * (255 - (perc)); \
232 G = (G + 128) / 255; \
233\
234 gp_pixel B; \
235\
236 B = GP_PIXEL_GET_B_RGB565_BE(pix1) * (perc); \
237 B += GP_PIXEL_GET_B_RGB565_BE(pix2) * (255 - (perc)); \
238 B = (B + 128) / 255; \
239\
240\
241 GP_PIXEL_CREATE_RGB565_BE(R, G, B); \
242})
243
244#define GP_MIX_PIXELS_RGB565_BE(pix1, pix2, perc) \
245 GP_MIX_PIXELS_LINEAR_RGB565_BE(pix1, pix2, perc)
246
247/*
248 * Mixes two RGB565_LE pixels.
249 *
250 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
251 */
252#define GP_MIX_PIXELS_LINEAR_RGB565_LE(pix1, pix2, perc) ({ \
253 gp_pixel R; \
254\
255 R = GP_PIXEL_GET_R_RGB565_LE(pix1) * (perc); \
256 R += GP_PIXEL_GET_R_RGB565_LE(pix2) * (255 - (perc)); \
257 R = (R + 128) / 255; \
258\
259 gp_pixel G; \
260\
261 G = GP_PIXEL_GET_G_RGB565_LE(pix1) * (perc); \
262 G += GP_PIXEL_GET_G_RGB565_LE(pix2) * (255 - (perc)); \
263 G = (G + 128) / 255; \
264\
265 gp_pixel B; \
266\
267 B = GP_PIXEL_GET_B_RGB565_LE(pix1) * (perc); \
268 B += GP_PIXEL_GET_B_RGB565_LE(pix2) * (255 - (perc)); \
269 B = (B + 128) / 255; \
270\
271\
272 GP_PIXEL_CREATE_RGB565_LE(R, G, B); \
273})
274
275#define GP_MIX_PIXELS_RGB565_LE(pix1, pix2, perc) \
276 GP_MIX_PIXELS_LINEAR_RGB565_LE(pix1, pix2, perc)
277
278/*
279 * Mixes two RGB666 pixels.
280 *
281 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
282 */
283#define GP_MIX_PIXELS_LINEAR_RGB666(pix1, pix2, perc) ({ \
284 gp_pixel R; \
285\
286 R = GP_PIXEL_GET_R_RGB666(pix1) * (perc); \
287 R += GP_PIXEL_GET_R_RGB666(pix2) * (255 - (perc)); \
288 R = (R + 128) / 255; \
289\
290 gp_pixel G; \
291\
292 G = GP_PIXEL_GET_G_RGB666(pix1) * (perc); \
293 G += GP_PIXEL_GET_G_RGB666(pix2) * (255 - (perc)); \
294 G = (G + 128) / 255; \
295\
296 gp_pixel B; \
297\
298 B = GP_PIXEL_GET_B_RGB666(pix1) * (perc); \
299 B += GP_PIXEL_GET_B_RGB666(pix2) * (255 - (perc)); \
300 B = (B + 128) / 255; \
301\
302\
303 GP_PIXEL_CREATE_RGB666(R, G, B); \
304})
305
306#define GP_MIX_PIXELS_RGB666(pix1, pix2, perc) \
307 GP_MIX_PIXELS_LINEAR_RGB666(pix1, pix2, perc)
308
309/*
310 * Mixes two RGB332 pixels.
311 *
312 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
313 */
314#define GP_MIX_PIXELS_LINEAR_RGB332(pix1, pix2, perc) ({ \
315 gp_pixel R; \
316\
317 R = GP_PIXEL_GET_R_RGB332(pix1) * (perc); \
318 R += GP_PIXEL_GET_R_RGB332(pix2) * (255 - (perc)); \
319 R = (R + 128) / 255; \
320\
321 gp_pixel G; \
322\
323 G = GP_PIXEL_GET_G_RGB332(pix1) * (perc); \
324 G += GP_PIXEL_GET_G_RGB332(pix2) * (255 - (perc)); \
325 G = (G + 128) / 255; \
326\
327 gp_pixel B; \
328\
329 B = GP_PIXEL_GET_B_RGB332(pix1) * (perc); \
330 B += GP_PIXEL_GET_B_RGB332(pix2) * (255 - (perc)); \
331 B = (B + 128) / 255; \
332\
333\
334 GP_PIXEL_CREATE_RGB332(R, G, B); \
335})
336
337#define GP_MIX_PIXELS_RGB332(pix1, pix2, perc) \
338 GP_MIX_PIXELS_LINEAR_RGB332(pix1, pix2, perc)
339
340/*
341 * Mixes two CMYK8888 pixels.
342 *
343 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
344 */
345#define GP_MIX_PIXELS_LINEAR_CMYK8888(pix1, pix2, perc) ({ \
346 gp_pixel K; \
347\
348 K = GP_PIXEL_GET_K_CMYK8888(pix1) * (perc); \
349 K += GP_PIXEL_GET_K_CMYK8888(pix2) * (255 - (perc)); \
350 K = (K + 128) / 255; \
351\
352 gp_pixel Y; \
353\
354 Y = GP_PIXEL_GET_Y_CMYK8888(pix1) * (perc); \
355 Y += GP_PIXEL_GET_Y_CMYK8888(pix2) * (255 - (perc)); \
356 Y = (Y + 128) / 255; \
357\
358 gp_pixel M; \
359\
360 M = GP_PIXEL_GET_M_CMYK8888(pix1) * (perc); \
361 M += GP_PIXEL_GET_M_CMYK8888(pix2) * (255 - (perc)); \
362 M = (M + 128) / 255; \
363\
364 gp_pixel C; \
365\
366 C = GP_PIXEL_GET_C_CMYK8888(pix1) * (perc); \
367 C += GP_PIXEL_GET_C_CMYK8888(pix2) * (255 - (perc)); \
368 C = (C + 128) / 255; \
369\
370\
371 GP_PIXEL_CREATE_CMYK8888(K, Y, M, C); \
372})
373
374#define GP_MIX_PIXELS_CMYK8888(pix1, pix2, perc) \
375 GP_MIX_PIXELS_LINEAR_CMYK8888(pix1, pix2, perc)
376
377/*
378 * Mixes two P2 pixels.
379 *
380 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
381 */
382#define GP_MIX_PIXELS_LINEAR_P2(pix1, pix2, perc) ({ \
383 gp_pixel P; \
384\
385 P = GP_PIXEL_GET_P_P2(pix1) * (perc); \
386 P += GP_PIXEL_GET_P_P2(pix2) * (255 - (perc)); \
387 P = (P + 128) / 255; \
388\
389\
390 GP_PIXEL_CREATE_P2(P); \
391})
392
393#define GP_MIX_PIXELS_P2(pix1, pix2, perc) \
394 GP_MIX_PIXELS_LINEAR_P2(pix1, pix2, perc)
395
396/*
397 * Mixes two P4 pixels.
398 *
399 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
400 */
401#define GP_MIX_PIXELS_LINEAR_P4(pix1, pix2, perc) ({ \
402 gp_pixel P; \
403\
404 P = GP_PIXEL_GET_P_P4(pix1) * (perc); \
405 P += GP_PIXEL_GET_P_P4(pix2) * (255 - (perc)); \
406 P = (P + 128) / 255; \
407\
408\
409 GP_PIXEL_CREATE_P4(P); \
410})
411
412#define GP_MIX_PIXELS_P4(pix1, pix2, perc) \
413 GP_MIX_PIXELS_LINEAR_P4(pix1, pix2, perc)
414
415/*
416 * Mixes two P8 pixels.
417 *
418 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
419 */
420#define GP_MIX_PIXELS_LINEAR_P8(pix1, pix2, perc) ({ \
421 gp_pixel P; \
422\
423 P = GP_PIXEL_GET_P_P8(pix1) * (perc); \
424 P += GP_PIXEL_GET_P_P8(pix2) * (255 - (perc)); \
425 P = (P + 128) / 255; \
426\
427\
428 GP_PIXEL_CREATE_P8(P); \
429})
430
431#define GP_MIX_PIXELS_P8(pix1, pix2, perc) \
432 GP_MIX_PIXELS_LINEAR_P8(pix1, pix2, perc)
433
434/*
435 * Mixes two G1_DB pixels.
436 *
437 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
438 */
439#define GP_MIX_PIXELS_LINEAR_G1_DB(pix1, pix2, perc) ({ \
440 gp_pixel V; \
441\
442 V = GP_PIXEL_GET_V_G1_DB(pix1) * (perc); \
443 V += GP_PIXEL_GET_V_G1_DB(pix2) * (255 - (perc)); \
444 V = (V + 128) / 255; \
445\
446\
447 GP_PIXEL_CREATE_G1_DB(V); \
448})
449
450#define GP_MIX_PIXELS_G1_DB(pix1, pix2, perc) \
451 GP_MIX_PIXELS_LINEAR_G1_DB(pix1, pix2, perc)
452
453/*
454 * Mixes two G2_DB pixels.
455 *
456 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
457 */
458#define GP_MIX_PIXELS_LINEAR_G2_DB(pix1, pix2, perc) ({ \
459 gp_pixel V; \
460\
461 V = GP_PIXEL_GET_V_G2_DB(pix1) * (perc); \
462 V += GP_PIXEL_GET_V_G2_DB(pix2) * (255 - (perc)); \
463 V = (V + 128) / 255; \
464\
465\
466 GP_PIXEL_CREATE_G2_DB(V); \
467})
468
469#define GP_MIX_PIXELS_G2_DB(pix1, pix2, perc) \
470 GP_MIX_PIXELS_LINEAR_G2_DB(pix1, pix2, perc)
471
472/*
473 * Mixes two G4_DB pixels.
474 *
475 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
476 */
477#define GP_MIX_PIXELS_LINEAR_G4_DB(pix1, pix2, perc) ({ \
478 gp_pixel V; \
479\
480 V = GP_PIXEL_GET_V_G4_DB(pix1) * (perc); \
481 V += GP_PIXEL_GET_V_G4_DB(pix2) * (255 - (perc)); \
482 V = (V + 128) / 255; \
483\
484\
485 GP_PIXEL_CREATE_G4_DB(V); \
486})
487
488#define GP_MIX_PIXELS_G4_DB(pix1, pix2, perc) \
489 GP_MIX_PIXELS_LINEAR_G4_DB(pix1, pix2, perc)
490
491/*
492 * Mixes two G1_UB pixels.
493 *
494 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
495 */
496#define GP_MIX_PIXELS_LINEAR_G1_UB(pix1, pix2, perc) ({ \
497 gp_pixel V; \
498\
499 V = GP_PIXEL_GET_V_G1_UB(pix1) * (perc); \
500 V += GP_PIXEL_GET_V_G1_UB(pix2) * (255 - (perc)); \
501 V = (V + 128) / 255; \
502\
503\
504 GP_PIXEL_CREATE_G1_UB(V); \
505})
506
507#define GP_MIX_PIXELS_G1_UB(pix1, pix2, perc) \
508 GP_MIX_PIXELS_LINEAR_G1_UB(pix1, pix2, perc)
509
510/*
511 * Mixes two G2_UB pixels.
512 *
513 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
514 */
515#define GP_MIX_PIXELS_LINEAR_G2_UB(pix1, pix2, perc) ({ \
516 gp_pixel V; \
517\
518 V = GP_PIXEL_GET_V_G2_UB(pix1) * (perc); \
519 V += GP_PIXEL_GET_V_G2_UB(pix2) * (255 - (perc)); \
520 V = (V + 128) / 255; \
521\
522\
523 GP_PIXEL_CREATE_G2_UB(V); \
524})
525
526#define GP_MIX_PIXELS_G2_UB(pix1, pix2, perc) \
527 GP_MIX_PIXELS_LINEAR_G2_UB(pix1, pix2, perc)
528
529/*
530 * Mixes two G4_UB pixels.
531 *
532 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
533 */
534#define GP_MIX_PIXELS_LINEAR_G4_UB(pix1, pix2, perc) ({ \
535 gp_pixel V; \
536\
537 V = GP_PIXEL_GET_V_G4_UB(pix1) * (perc); \
538 V += GP_PIXEL_GET_V_G4_UB(pix2) * (255 - (perc)); \
539 V = (V + 128) / 255; \
540\
541\
542 GP_PIXEL_CREATE_G4_UB(V); \
543})
544
545#define GP_MIX_PIXELS_G4_UB(pix1, pix2, perc) \
546 GP_MIX_PIXELS_LINEAR_G4_UB(pix1, pix2, perc)
547
548/*
549 * Mixes two G8 pixels.
550 *
551 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
552 */
553#define GP_MIX_PIXELS_LINEAR_G8(pix1, pix2, perc) ({ \
554 gp_pixel V; \
555\
556 V = GP_PIXEL_GET_V_G8(pix1) * (perc); \
557 V += GP_PIXEL_GET_V_G8(pix2) * (255 - (perc)); \
558 V = (V + 128) / 255; \
559\
560\
561 GP_PIXEL_CREATE_G8(V); \
562})
563
564#define GP_MIX_PIXELS_G8(pix1, pix2, perc) \
565 GP_MIX_PIXELS_LINEAR_G8(pix1, pix2, perc)
566
567/*
568 * Mixes two GA88 pixels.
569 *
570 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
571 */
572#define GP_MIX_PIXELS_LINEAR_GA88(pix1, pix2, perc) ({ \
573 gp_pixel V; \
574\
575 V = GP_PIXEL_GET_V_GA88(pix1) * (perc); \
576 V += GP_PIXEL_GET_V_GA88(pix2) * (255 - (perc)); \
577 V = (V + 128) / 255; \
578\
579 gp_pixel A; \
580\
581 A = GP_PIXEL_GET_A_GA88(pix1) * (perc); \
582 A += GP_PIXEL_GET_A_GA88(pix2) * (255 - (perc)); \
583 A = (A + 128) / 255; \
584\
585\
586 GP_PIXEL_CREATE_GA88(V, A); \
587})
588
589#define GP_MIX_PIXELS_GA88(pix1, pix2, perc) \
590 GP_MIX_PIXELS_LINEAR_GA88(pix1, pix2, perc)
591
592/*
593 * Mixes two G16 pixels.
594 *
595 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
596 */
597#define GP_MIX_PIXELS_LINEAR_G16(pix1, pix2, perc) ({ \
598 gp_pixel V; \
599\
600 V = GP_PIXEL_GET_V_G16(pix1) * (perc); \
601 V += GP_PIXEL_GET_V_G16(pix2) * (255 - (perc)); \
602 V = (V + 128) / 255; \
603\
604\
605 GP_PIXEL_CREATE_G16(V); \
606})
607
608#define GP_MIX_PIXELS_G16(pix1, pix2, perc) \
609 GP_MIX_PIXELS_LINEAR_G16(pix1, pix2, perc)
610
611static inline gp_pixel gp_mix_pixels(gp_pixel pix1, gp_pixel pix2,
612 uint8_t perc, gp_pixel_type pixel_type)
613{
614 switch (pixel_type) {
615 case GP_PIXEL_RGB101010:
616 return GP_MIX_PIXELS_LINEAR_RGB101010(pix1, pix2, perc);
617 case GP_PIXEL_xRGB8888:
618 return GP_MIX_PIXELS_LINEAR_xRGB8888(pix1, pix2, perc);
619 case GP_PIXEL_RGBA8888:
620 return GP_MIX_PIXELS_LINEAR_RGBA8888(pix1, pix2, perc);
621 case GP_PIXEL_RGB888:
622 return GP_MIX_PIXELS_LINEAR_RGB888(pix1, pix2, perc);
623 case GP_PIXEL_BGR888:
624 return GP_MIX_PIXELS_LINEAR_BGR888(pix1, pix2, perc);
625 case GP_PIXEL_RGB555:
626 return GP_MIX_PIXELS_LINEAR_RGB555(pix1, pix2, perc);
627 case GP_PIXEL_RGB565_BE:
628 return GP_MIX_PIXELS_LINEAR_RGB565_BE(pix1, pix2, perc);
629 case GP_PIXEL_RGB565_LE:
630 return GP_MIX_PIXELS_LINEAR_RGB565_LE(pix1, pix2, perc);
631 case GP_PIXEL_RGB666:
632 return GP_MIX_PIXELS_LINEAR_RGB666(pix1, pix2, perc);
633 case GP_PIXEL_RGB332:
634 return GP_MIX_PIXELS_LINEAR_RGB332(pix1, pix2, perc);
635 case GP_PIXEL_CMYK8888:
636 return GP_MIX_PIXELS_LINEAR_CMYK8888(pix1, pix2, perc);
637 case GP_PIXEL_P2:
638 return GP_MIX_PIXELS_LINEAR_P2(pix1, pix2, perc);
639 case GP_PIXEL_P4:
640 return GP_MIX_PIXELS_LINEAR_P4(pix1, pix2, perc);
641 case GP_PIXEL_P8:
642 return GP_MIX_PIXELS_LINEAR_P8(pix1, pix2, perc);
643 case GP_PIXEL_G1_DB:
644 return GP_MIX_PIXELS_LINEAR_G1_DB(pix1, pix2, perc);
645 case GP_PIXEL_G2_DB:
646 return GP_MIX_PIXELS_LINEAR_G2_DB(pix1, pix2, perc);
647 case GP_PIXEL_G4_DB:
648 return GP_MIX_PIXELS_LINEAR_G4_DB(pix1, pix2, perc);
649 case GP_PIXEL_G1_UB:
650 return GP_MIX_PIXELS_LINEAR_G1_UB(pix1, pix2, perc);
651 case GP_PIXEL_G2_UB:
652 return GP_MIX_PIXELS_LINEAR_G2_UB(pix1, pix2, perc);
653 case GP_PIXEL_G4_UB:
654 return GP_MIX_PIXELS_LINEAR_G4_UB(pix1, pix2, perc);
655 case GP_PIXEL_G8:
656 return GP_MIX_PIXELS_LINEAR_G8(pix1, pix2, perc);
657 case GP_PIXEL_GA88:
658 return GP_MIX_PIXELS_LINEAR_GA88(pix1, pix2, perc);
659 case GP_PIXEL_G16:
660 return GP_MIX_PIXELS_LINEAR_G16(pix1, pix2, perc);
661 default:
662 GP_ABORT("Unknown pixeltype");
663 }
664}
665
666
667static inline void gp_mix_pixel_raw_RGB101010(gp_pixmap *pixmap,
668 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
669{
670 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
671 pix = GP_MIX_PIXELS_RGB101010(pixel, pix, perc);
672 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
673}
674
675static inline void gp_mix_pixel_raw_xRGB8888(gp_pixmap *pixmap,
676 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
677{
678 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
679 pix = GP_MIX_PIXELS_xRGB8888(pixel, pix, perc);
680 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
681}
682
683static inline void gp_mix_pixel_raw_RGBA8888(gp_pixmap *pixmap,
684 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
685{
686 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
687 pix = GP_MIX_PIXELS_RGBA8888(pixel, pix, perc);
688 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
689}
690
691static inline void gp_mix_pixel_raw_RGB888(gp_pixmap *pixmap,
692 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
693{
694 gp_pixel pix = gp_getpixel_raw_24BPP(pixmap, x, y);
695 pix = GP_MIX_PIXELS_RGB888(pixel, pix, perc);
696 gp_putpixel_raw_24BPP(pixmap, x, y, pix);
697}
698
699static inline void gp_mix_pixel_raw_BGR888(gp_pixmap *pixmap,
700 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
701{
702 gp_pixel pix = gp_getpixel_raw_24BPP(pixmap, x, y);
703 pix = GP_MIX_PIXELS_BGR888(pixel, pix, perc);
704 gp_putpixel_raw_24BPP(pixmap, x, y, pix);
705}
706
707static inline void gp_mix_pixel_raw_RGB555(gp_pixmap *pixmap,
708 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
709{
710 gp_pixel pix = gp_getpixel_raw_16BPP_BE(pixmap, x, y);
711 pix = GP_MIX_PIXELS_RGB555(pixel, pix, perc);
712 gp_putpixel_raw_16BPP_BE(pixmap, x, y, pix);
713}
714
715static inline void gp_mix_pixel_raw_RGB565_BE(gp_pixmap *pixmap,
716 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
717{
718 gp_pixel pix = gp_getpixel_raw_16BPP_BE(pixmap, x, y);
719 pix = GP_MIX_PIXELS_RGB565_BE(pixel, pix, perc);
720 gp_putpixel_raw_16BPP_BE(pixmap, x, y, pix);
721}
722
723static inline void gp_mix_pixel_raw_RGB565_LE(gp_pixmap *pixmap,
724 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
725{
726 gp_pixel pix = gp_getpixel_raw_16BPP_LE(pixmap, x, y);
727 pix = GP_MIX_PIXELS_RGB565_LE(pixel, pix, perc);
728 gp_putpixel_raw_16BPP_LE(pixmap, x, y, pix);
729}
730
731static inline void gp_mix_pixel_raw_RGB666(gp_pixmap *pixmap,
732 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
733{
734 gp_pixel pix = gp_getpixel_raw_18BPP_DB(pixmap, x, y);
735 pix = GP_MIX_PIXELS_RGB666(pixel, pix, perc);
736 gp_putpixel_raw_18BPP_DB(pixmap, x, y, pix);
737}
738
739static inline void gp_mix_pixel_raw_RGB332(gp_pixmap *pixmap,
740 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
741{
742 gp_pixel pix = gp_getpixel_raw_8BPP(pixmap, x, y);
743 pix = GP_MIX_PIXELS_RGB332(pixel, pix, perc);
744 gp_putpixel_raw_8BPP(pixmap, x, y, pix);
745}
746
747static inline void gp_mix_pixel_raw_CMYK8888(gp_pixmap *pixmap,
748 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
749{
750 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
751 pix = GP_MIX_PIXELS_CMYK8888(pixel, pix, perc);
752 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
753}
754
755static inline void gp_mix_pixel_raw_P2(gp_pixmap *pixmap,
756 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
757{
758 gp_pixel pix = gp_getpixel_raw_2BPP_UB(pixmap, x, y);
759 pix = GP_MIX_PIXELS_P2(pixel, pix, perc);
760 gp_putpixel_raw_2BPP_UB(pixmap, x, y, pix);
761}
762
763static inline void gp_mix_pixel_raw_P4(gp_pixmap *pixmap,
764 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
765{
766 gp_pixel pix = gp_getpixel_raw_4BPP_UB(pixmap, x, y);
767 pix = GP_MIX_PIXELS_P4(pixel, pix, perc);
768 gp_putpixel_raw_4BPP_UB(pixmap, x, y, pix);
769}
770
771static inline void gp_mix_pixel_raw_P8(gp_pixmap *pixmap,
772 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
773{
774 gp_pixel pix = gp_getpixel_raw_8BPP(pixmap, x, y);
775 pix = GP_MIX_PIXELS_P8(pixel, pix, perc);
776 gp_putpixel_raw_8BPP(pixmap, x, y, pix);
777}
778
779static inline void gp_mix_pixel_raw_G1_DB(gp_pixmap *pixmap,
780 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
781{
782 gp_pixel pix = gp_getpixel_raw_1BPP_DB(pixmap, x, y);
783 pix = GP_MIX_PIXELS_G1_DB(pixel, pix, perc);
784 gp_putpixel_raw_1BPP_DB(pixmap, x, y, pix);
785}
786
787static inline void gp_mix_pixel_raw_G2_DB(gp_pixmap *pixmap,
788 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
789{
790 gp_pixel pix = gp_getpixel_raw_2BPP_DB(pixmap, x, y);
791 pix = GP_MIX_PIXELS_G2_DB(pixel, pix, perc);
792 gp_putpixel_raw_2BPP_DB(pixmap, x, y, pix);
793}
794
795static inline void gp_mix_pixel_raw_G4_DB(gp_pixmap *pixmap,
796 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
797{
798 gp_pixel pix = gp_getpixel_raw_4BPP_DB(pixmap, x, y);
799 pix = GP_MIX_PIXELS_G4_DB(pixel, pix, perc);
800 gp_putpixel_raw_4BPP_DB(pixmap, x, y, pix);
801}
802
803static inline void gp_mix_pixel_raw_G1_UB(gp_pixmap *pixmap,
804 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
805{
806 gp_pixel pix = gp_getpixel_raw_1BPP_UB(pixmap, x, y);
807 pix = GP_MIX_PIXELS_G1_UB(pixel, pix, perc);
808 gp_putpixel_raw_1BPP_UB(pixmap, x, y, pix);
809}
810
811static inline void gp_mix_pixel_raw_G2_UB(gp_pixmap *pixmap,
812 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
813{
814 gp_pixel pix = gp_getpixel_raw_2BPP_UB(pixmap, x, y);
815 pix = GP_MIX_PIXELS_G2_UB(pixel, pix, perc);
816 gp_putpixel_raw_2BPP_UB(pixmap, x, y, pix);
817}
818
819static inline void gp_mix_pixel_raw_G4_UB(gp_pixmap *pixmap,
820 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
821{
822 gp_pixel pix = gp_getpixel_raw_4BPP_UB(pixmap, x, y);
823 pix = GP_MIX_PIXELS_G4_UB(pixel, pix, perc);
824 gp_putpixel_raw_4BPP_UB(pixmap, x, y, pix);
825}
826
827static inline void gp_mix_pixel_raw_G8(gp_pixmap *pixmap,
828 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
829{
830 gp_pixel pix = gp_getpixel_raw_8BPP(pixmap, x, y);
831 pix = GP_MIX_PIXELS_G8(pixel, pix, perc);
832 gp_putpixel_raw_8BPP(pixmap, x, y, pix);
833}
834
835static inline void gp_mix_pixel_raw_GA88(gp_pixmap *pixmap,
836 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
837{
838 gp_pixel pix = gp_getpixel_raw_16BPP_LE(pixmap, x, y);
839 pix = GP_MIX_PIXELS_GA88(pixel, pix, perc);
840 gp_putpixel_raw_16BPP_LE(pixmap, x, y, pix);
841}
842
843static inline void gp_mix_pixel_raw_G16(gp_pixmap *pixmap,
844 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
845{
846 gp_pixel pix = gp_getpixel_raw_16BPP_LE(pixmap, x, y);
847 pix = GP_MIX_PIXELS_G16(pixel, pix, perc);
848 gp_putpixel_raw_16BPP_LE(pixmap, x, y, pix);
849}
850
851
852static inline void gp_mix_pixel_raw_clipped_RGB101010(gp_pixmap *pixmap,
853 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
854{
855 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
856 return;
857
858 gp_mix_pixel_raw_RGB101010(pixmap, x, y, pixel, perc);
859}
860
861static inline void gp_mix_pixel_raw_clipped_xRGB8888(gp_pixmap *pixmap,
862 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
863{
864 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
865 return;
866
867 gp_mix_pixel_raw_xRGB8888(pixmap, x, y, pixel, perc);
868}
869
870static inline void gp_mix_pixel_raw_clipped_RGBA8888(gp_pixmap *pixmap,
871 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
872{
873 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
874 return;
875
876 gp_mix_pixel_raw_RGBA8888(pixmap, x, y, pixel, perc);
877}
878
879static inline void gp_mix_pixel_raw_clipped_RGB888(gp_pixmap *pixmap,
880 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
881{
882 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
883 return;
884
885 gp_mix_pixel_raw_RGB888(pixmap, x, y, pixel, perc);
886}
887
888static inline void gp_mix_pixel_raw_clipped_BGR888(gp_pixmap *pixmap,
889 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
890{
891 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
892 return;
893
894 gp_mix_pixel_raw_BGR888(pixmap, x, y, pixel, perc);
895}
896
897static inline void gp_mix_pixel_raw_clipped_RGB555(gp_pixmap *pixmap,
898 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
899{
900 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
901 return;
902
903 gp_mix_pixel_raw_RGB555(pixmap, x, y, pixel, perc);
904}
905
906static inline void gp_mix_pixel_raw_clipped_RGB565_BE(gp_pixmap *pixmap,
907 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
908{
909 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
910 return;
911
912 gp_mix_pixel_raw_RGB565_BE(pixmap, x, y, pixel, perc);
913}
914
915static inline void gp_mix_pixel_raw_clipped_RGB565_LE(gp_pixmap *pixmap,
916 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
917{
918 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
919 return;
920
921 gp_mix_pixel_raw_RGB565_LE(pixmap, x, y, pixel, perc);
922}
923
924static inline void gp_mix_pixel_raw_clipped_RGB666(gp_pixmap *pixmap,
925 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
926{
927 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
928 return;
929
930 gp_mix_pixel_raw_RGB666(pixmap, x, y, pixel, perc);
931}
932
933static inline void gp_mix_pixel_raw_clipped_RGB332(gp_pixmap *pixmap,
934 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
935{
936 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
937 return;
938
939 gp_mix_pixel_raw_RGB332(pixmap, x, y, pixel, perc);
940}
941
942static inline void gp_mix_pixel_raw_clipped_CMYK8888(gp_pixmap *pixmap,
943 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
944{
945 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
946 return;
947
948 gp_mix_pixel_raw_CMYK8888(pixmap, x, y, pixel, perc);
949}
950
951static inline void gp_mix_pixel_raw_clipped_P2(gp_pixmap *pixmap,
952 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
953{
954 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
955 return;
956
957 gp_mix_pixel_raw_P2(pixmap, x, y, pixel, perc);
958}
959
960static inline void gp_mix_pixel_raw_clipped_P4(gp_pixmap *pixmap,
961 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
962{
963 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
964 return;
965
966 gp_mix_pixel_raw_P4(pixmap, x, y, pixel, perc);
967}
968
969static inline void gp_mix_pixel_raw_clipped_P8(gp_pixmap *pixmap,
970 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
971{
972 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
973 return;
974
975 gp_mix_pixel_raw_P8(pixmap, x, y, pixel, perc);
976}
977
978static inline void gp_mix_pixel_raw_clipped_G1_DB(gp_pixmap *pixmap,
979 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
980{
981 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
982 return;
983
984 gp_mix_pixel_raw_G1_DB(pixmap, x, y, pixel, perc);
985}
986
987static inline void gp_mix_pixel_raw_clipped_G2_DB(gp_pixmap *pixmap,
988 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
989{
990 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
991 return;
992
993 gp_mix_pixel_raw_G2_DB(pixmap, x, y, pixel, perc);
994}
995
996static inline void gp_mix_pixel_raw_clipped_G4_DB(gp_pixmap *pixmap,
997 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
998{
999 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1000 return;
1001
1002 gp_mix_pixel_raw_G4_DB(pixmap, x, y, pixel, perc);
1003}
1004
1005static inline void gp_mix_pixel_raw_clipped_G1_UB(gp_pixmap *pixmap,
1006 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1007{
1008 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1009 return;
1010
1011 gp_mix_pixel_raw_G1_UB(pixmap, x, y, pixel, perc);
1012}
1013
1014static inline void gp_mix_pixel_raw_clipped_G2_UB(gp_pixmap *pixmap,
1015 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1016{
1017 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1018 return;
1019
1020 gp_mix_pixel_raw_G2_UB(pixmap, x, y, pixel, perc);
1021}
1022
1023static inline void gp_mix_pixel_raw_clipped_G4_UB(gp_pixmap *pixmap,
1024 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1025{
1026 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1027 return;
1028
1029 gp_mix_pixel_raw_G4_UB(pixmap, x, y, pixel, perc);
1030}
1031
1032static inline void gp_mix_pixel_raw_clipped_G8(gp_pixmap *pixmap,
1033 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1034{
1035 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1036 return;
1037
1038 gp_mix_pixel_raw_G8(pixmap, x, y, pixel, perc);
1039}
1040
1041static inline void gp_mix_pixel_raw_clipped_GA88(gp_pixmap *pixmap,
1042 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1043{
1044 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1045 return;
1046
1047 gp_mix_pixel_raw_GA88(pixmap, x, y, pixel, perc);
1048}
1049
1050static inline void gp_mix_pixel_raw_clipped_G16(gp_pixmap *pixmap,
1051 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1052{
1053 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1054 return;
1055
1056 gp_mix_pixel_raw_G16(pixmap, x, y, pixel, perc);
1057}
1058
1059
1060static inline void gp_mix_pixel_raw(gp_pixmap *pixmap, gp_coord x, gp_coord y,
1061 gp_pixel pixel, uint8_t perc)
1062{
1063 switch (pixmap->pixel_type) {
1064 case GP_PIXEL_RGB101010:
1065 gp_mix_pixel_raw_RGB101010(pixmap, x, y, pixel, perc);
1066 break;
1067 case GP_PIXEL_xRGB8888:
1068 gp_mix_pixel_raw_xRGB8888(pixmap, x, y, pixel, perc);
1069 break;
1070 case GP_PIXEL_RGBA8888:
1071 gp_mix_pixel_raw_RGBA8888(pixmap, x, y, pixel, perc);
1072 break;
1073 case GP_PIXEL_RGB888:
1074 gp_mix_pixel_raw_RGB888(pixmap, x, y, pixel, perc);
1075 break;
1076 case GP_PIXEL_BGR888:
1077 gp_mix_pixel_raw_BGR888(pixmap, x, y, pixel, perc);
1078 break;
1079 case GP_PIXEL_RGB555:
1080 gp_mix_pixel_raw_RGB555(pixmap, x, y, pixel, perc);
1081 break;
1082 case GP_PIXEL_RGB565_BE:
1083 gp_mix_pixel_raw_RGB565_BE(pixmap, x, y, pixel, perc);
1084 break;
1085 case GP_PIXEL_RGB565_LE:
1086 gp_mix_pixel_raw_RGB565_LE(pixmap, x, y, pixel, perc);
1087 break;
1088 case GP_PIXEL_RGB666:
1089 gp_mix_pixel_raw_RGB666(pixmap, x, y, pixel, perc);
1090 break;
1091 case GP_PIXEL_RGB332:
1092 gp_mix_pixel_raw_RGB332(pixmap, x, y, pixel, perc);
1093 break;
1094 case GP_PIXEL_CMYK8888:
1095 gp_mix_pixel_raw_CMYK8888(pixmap, x, y, pixel, perc);
1096 break;
1097 case GP_PIXEL_P2:
1098 gp_mix_pixel_raw_P2(pixmap, x, y, pixel, perc);
1099 break;
1100 case GP_PIXEL_P4:
1101 gp_mix_pixel_raw_P4(pixmap, x, y, pixel, perc);
1102 break;
1103 case GP_PIXEL_P8:
1104 gp_mix_pixel_raw_P8(pixmap, x, y, pixel, perc);
1105 break;
1106 case GP_PIXEL_G1_DB:
1107 gp_mix_pixel_raw_G1_DB(pixmap, x, y, pixel, perc);
1108 break;
1109 case GP_PIXEL_G2_DB:
1110 gp_mix_pixel_raw_G2_DB(pixmap, x, y, pixel, perc);
1111 break;
1112 case GP_PIXEL_G4_DB:
1113 gp_mix_pixel_raw_G4_DB(pixmap, x, y, pixel, perc);
1114 break;
1115 case GP_PIXEL_G1_UB:
1116 gp_mix_pixel_raw_G1_UB(pixmap, x, y, pixel, perc);
1117 break;
1118 case GP_PIXEL_G2_UB:
1119 gp_mix_pixel_raw_G2_UB(pixmap, x, y, pixel, perc);
1120 break;
1121 case GP_PIXEL_G4_UB:
1122 gp_mix_pixel_raw_G4_UB(pixmap, x, y, pixel, perc);
1123 break;
1124 case GP_PIXEL_G8:
1125 gp_mix_pixel_raw_G8(pixmap, x, y, pixel, perc);
1126 break;
1127 case GP_PIXEL_GA88:
1128 gp_mix_pixel_raw_GA88(pixmap, x, y, pixel, perc);
1129 break;
1130 case GP_PIXEL_G16:
1131 gp_mix_pixel_raw_G16(pixmap, x, y, pixel, perc);
1132 break;
1133 default:
1134 GP_ABORT("Unknown pixeltype");
1135 }
1136}
1137
1138static inline void gp_mix_pixel_raw_clipped(gp_pixmap *pixmap,
1139 gp_coord x, gp_coord y,
1140 gp_pixel pixel, uint8_t perc)
1141{
1142 switch (pixmap->pixel_type) {
1143 case GP_PIXEL_RGB101010:
1144 gp_mix_pixel_raw_clipped_RGB101010(pixmap, x, y, pixel, perc);
1145 break;
1146 case GP_PIXEL_xRGB8888:
1147 gp_mix_pixel_raw_clipped_xRGB8888(pixmap, x, y, pixel, perc);
1148 break;
1149 case GP_PIXEL_RGBA8888:
1150 gp_mix_pixel_raw_clipped_RGBA8888(pixmap, x, y, pixel, perc);
1151 break;
1152 case GP_PIXEL_RGB888:
1153 gp_mix_pixel_raw_clipped_RGB888(pixmap, x, y, pixel, perc);
1154 break;
1155 case GP_PIXEL_BGR888:
1156 gp_mix_pixel_raw_clipped_BGR888(pixmap, x, y, pixel, perc);
1157 break;
1158 case GP_PIXEL_RGB555:
1159 gp_mix_pixel_raw_clipped_RGB555(pixmap, x, y, pixel, perc);
1160 break;
1161 case GP_PIXEL_RGB565_BE:
1162 gp_mix_pixel_raw_clipped_RGB565_BE(pixmap, x, y, pixel, perc);
1163 break;
1164 case GP_PIXEL_RGB565_LE:
1165 gp_mix_pixel_raw_clipped_RGB565_LE(pixmap, x, y, pixel, perc);
1166 break;
1167 case GP_PIXEL_RGB666:
1168 gp_mix_pixel_raw_clipped_RGB666(pixmap, x, y, pixel, perc);
1169 break;
1170 case GP_PIXEL_RGB332:
1171 gp_mix_pixel_raw_clipped_RGB332(pixmap, x, y, pixel, perc);
1172 break;
1173 case GP_PIXEL_CMYK8888:
1174 gp_mix_pixel_raw_clipped_CMYK8888(pixmap, x, y, pixel, perc);
1175 break;
1176 case GP_PIXEL_P2:
1177 gp_mix_pixel_raw_clipped_P2(pixmap, x, y, pixel, perc);
1178 break;
1179 case GP_PIXEL_P4:
1180 gp_mix_pixel_raw_clipped_P4(pixmap, x, y, pixel, perc);
1181 break;
1182 case GP_PIXEL_P8:
1183 gp_mix_pixel_raw_clipped_P8(pixmap, x, y, pixel, perc);
1184 break;
1185 case GP_PIXEL_G1_DB:
1186 gp_mix_pixel_raw_clipped_G1_DB(pixmap, x, y, pixel, perc);
1187 break;
1188 case GP_PIXEL_G2_DB:
1189 gp_mix_pixel_raw_clipped_G2_DB(pixmap, x, y, pixel, perc);
1190 break;
1191 case GP_PIXEL_G4_DB:
1192 gp_mix_pixel_raw_clipped_G4_DB(pixmap, x, y, pixel, perc);
1193 break;
1194 case GP_PIXEL_G1_UB:
1195 gp_mix_pixel_raw_clipped_G1_UB(pixmap, x, y, pixel, perc);
1196 break;
1197 case GP_PIXEL_G2_UB:
1198 gp_mix_pixel_raw_clipped_G2_UB(pixmap, x, y, pixel, perc);
1199 break;
1200 case GP_PIXEL_G4_UB:
1201 gp_mix_pixel_raw_clipped_G4_UB(pixmap, x, y, pixel, perc);
1202 break;
1203 case GP_PIXEL_G8:
1204 gp_mix_pixel_raw_clipped_G8(pixmap, x, y, pixel, perc);
1205 break;
1206 case GP_PIXEL_GA88:
1207 gp_mix_pixel_raw_clipped_GA88(pixmap, x, y, pixel, perc);
1208 break;
1209 case GP_PIXEL_G16:
1210 gp_mix_pixel_raw_clipped_G16(pixmap, x, y, pixel, perc);
1211 break;
1212 default:
1213 GP_ABORT("Unknown pixeltype");
1214 }
1215}
1216#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_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_16BPP_LE(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 16BPP_LE
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 void gp_putpixel_raw_16BPP_BE(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 16BPP_BE
static void gp_putpixel_raw_16BPP_LE(gp_pixmap *c, gp_coord x, gp_coord y, gp_pixel p)
gp_putpixel for 16BPP_LE
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_BE(const gp_pixmap *c, gp_coord x, gp_coord y)
gp_getpixel for 16BPP_BE
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:131
A pixmap buffer.
Definition gp_pixmap.h:33
enum gp_pixel_type pixel_type
A pixel format.
Definition gp_pixmap.h:63