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 04 14 13:01:17 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/*
53 * Mixes two RGB101010 pixels.
54 *
55 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
56 */
57#define GP_MIX_PIXELS_GAMMA_RGB101010(pix1, pix2, perc) ({ \
58 gp_pixel R; \
59\
60 R = gp_gamma10_to_linear10(GP_PIXEL_GET_R_RGB101010(pix1)) * (perc); \
61 R += gp_gamma10_to_linear10(GP_PIXEL_GET_R_RGB101010(pix2)) * (255 - (perc)); \
62 R = (R + 128) / 255; \
63 R = gp_linear10_to_gamma10(R); \
64\
65 gp_pixel G; \
66\
67 G = gp_gamma10_to_linear10(GP_PIXEL_GET_G_RGB101010(pix1)) * (perc); \
68 G += gp_gamma10_to_linear10(GP_PIXEL_GET_G_RGB101010(pix2)) * (255 - (perc)); \
69 G = (G + 128) / 255; \
70 G = gp_linear10_to_gamma10(G); \
71\
72 gp_pixel B; \
73\
74 B = gp_gamma10_to_linear10(GP_PIXEL_GET_B_RGB101010(pix1)) * (perc); \
75 B += gp_gamma10_to_linear10(GP_PIXEL_GET_B_RGB101010(pix2)) * (255 - (perc)); \
76 B = (B + 128) / 255; \
77 B = gp_linear10_to_gamma10(B); \
78\
79\
80 GP_PIXEL_CREATE_RGB101010(R, G, B); \
81})
82
83#define GP_MIX_PIXELS_RGB101010(pix1, pix2, perc) \
84 GP_MIX_PIXELS_LINEAR_RGB101010(pix1, pix2, perc)
85
86/*
87 * Mixes two xRGB8888 pixels.
88 *
89 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
90 */
91#define GP_MIX_PIXELS_LINEAR_xRGB8888(pix1, pix2, perc) ({ \
92 gp_pixel R; \
93\
94 R = GP_PIXEL_GET_R_xRGB8888(pix1) * (perc); \
95 R += GP_PIXEL_GET_R_xRGB8888(pix2) * (255 - (perc)); \
96 R = (R + 128) / 255; \
97\
98 gp_pixel G; \
99\
100 G = GP_PIXEL_GET_G_xRGB8888(pix1) * (perc); \
101 G += GP_PIXEL_GET_G_xRGB8888(pix2) * (255 - (perc)); \
102 G = (G + 128) / 255; \
103\
104 gp_pixel B; \
105\
106 B = GP_PIXEL_GET_B_xRGB8888(pix1) * (perc); \
107 B += GP_PIXEL_GET_B_xRGB8888(pix2) * (255 - (perc)); \
108 B = (B + 128) / 255; \
109\
110\
111 GP_PIXEL_CREATE_xRGB8888(R, G, B); \
112})
113
114/*
115 * Mixes two xRGB8888 pixels.
116 *
117 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
118 */
119#define GP_MIX_PIXELS_GAMMA_xRGB8888(pix1, pix2, perc) ({ \
120 gp_pixel R; \
121\
122 R = gp_gamma8_to_linear10(GP_PIXEL_GET_R_xRGB8888(pix1)) * (perc); \
123 R += gp_gamma8_to_linear10(GP_PIXEL_GET_R_xRGB8888(pix2)) * (255 - (perc)); \
124 R = (R + 128) / 255; \
125 R = gp_linear10_to_gamma8(R); \
126\
127 gp_pixel G; \
128\
129 G = gp_gamma8_to_linear10(GP_PIXEL_GET_G_xRGB8888(pix1)) * (perc); \
130 G += gp_gamma8_to_linear10(GP_PIXEL_GET_G_xRGB8888(pix2)) * (255 - (perc)); \
131 G = (G + 128) / 255; \
132 G = gp_linear10_to_gamma8(G); \
133\
134 gp_pixel B; \
135\
136 B = gp_gamma8_to_linear10(GP_PIXEL_GET_B_xRGB8888(pix1)) * (perc); \
137 B += gp_gamma8_to_linear10(GP_PIXEL_GET_B_xRGB8888(pix2)) * (255 - (perc)); \
138 B = (B + 128) / 255; \
139 B = gp_linear10_to_gamma8(B); \
140\
141\
142 GP_PIXEL_CREATE_xRGB8888(R, G, B); \
143})
144
145#define GP_MIX_PIXELS_xRGB8888(pix1, pix2, perc) \
146 GP_MIX_PIXELS_LINEAR_xRGB8888(pix1, pix2, perc)
147
148/*
149 * Mixes two RGBA8888 pixels.
150 *
151 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
152 */
153#define GP_MIX_PIXELS_LINEAR_RGBA8888(pix1, pix2, perc) ({ \
154 gp_pixel R; \
155\
156 R = GP_PIXEL_GET_R_RGBA8888(pix1) * (perc); \
157 R += GP_PIXEL_GET_R_RGBA8888(pix2) * (255 - (perc)); \
158 R = (R + 128) / 255; \
159\
160 gp_pixel G; \
161\
162 G = GP_PIXEL_GET_G_RGBA8888(pix1) * (perc); \
163 G += GP_PIXEL_GET_G_RGBA8888(pix2) * (255 - (perc)); \
164 G = (G + 128) / 255; \
165\
166 gp_pixel B; \
167\
168 B = GP_PIXEL_GET_B_RGBA8888(pix1) * (perc); \
169 B += GP_PIXEL_GET_B_RGBA8888(pix2) * (255 - (perc)); \
170 B = (B + 128) / 255; \
171\
172 gp_pixel A; \
173\
174 A = GP_PIXEL_GET_A_RGBA8888(pix1) * (perc); \
175 A += GP_PIXEL_GET_A_RGBA8888(pix2) * (255 - (perc)); \
176 A = (A + 128) / 255; \
177\
178\
179 GP_PIXEL_CREATE_RGBA8888(R, G, B, A); \
180})
181
182/*
183 * Mixes two RGBA8888 pixels.
184 *
185 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
186 */
187#define GP_MIX_PIXELS_GAMMA_RGBA8888(pix1, pix2, perc) ({ \
188 gp_pixel R; \
189\
190 R = gp_gamma8_to_linear10(GP_PIXEL_GET_R_RGBA8888(pix1)) * (perc); \
191 R += gp_gamma8_to_linear10(GP_PIXEL_GET_R_RGBA8888(pix2)) * (255 - (perc)); \
192 R = (R + 128) / 255; \
193 R = gp_linear10_to_gamma8(R); \
194\
195 gp_pixel G; \
196\
197 G = gp_gamma8_to_linear10(GP_PIXEL_GET_G_RGBA8888(pix1)) * (perc); \
198 G += gp_gamma8_to_linear10(GP_PIXEL_GET_G_RGBA8888(pix2)) * (255 - (perc)); \
199 G = (G + 128) / 255; \
200 G = gp_linear10_to_gamma8(G); \
201\
202 gp_pixel B; \
203\
204 B = gp_gamma8_to_linear10(GP_PIXEL_GET_B_RGBA8888(pix1)) * (perc); \
205 B += gp_gamma8_to_linear10(GP_PIXEL_GET_B_RGBA8888(pix2)) * (255 - (perc)); \
206 B = (B + 128) / 255; \
207 B = gp_linear10_to_gamma8(B); \
208\
209 gp_pixel A; \
210\
211 A = gp_gamma8_to_linear10(GP_PIXEL_GET_A_RGBA8888(pix1)) * (perc); \
212 A += gp_gamma8_to_linear10(GP_PIXEL_GET_A_RGBA8888(pix2)) * (255 - (perc)); \
213 A = (A + 128) / 255; \
214 A = gp_linear10_to_gamma8(A); \
215\
216\
217 GP_PIXEL_CREATE_RGBA8888(R, G, B, A); \
218})
219
220#define GP_MIX_PIXELS_RGBA8888(pix1, pix2, perc) \
221 GP_MIX_PIXELS_LINEAR_RGBA8888(pix1, pix2, perc)
222
223/*
224 * Mixes two RGB888 pixels.
225 *
226 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
227 */
228#define GP_MIX_PIXELS_LINEAR_RGB888(pix1, pix2, perc) ({ \
229 gp_pixel R; \
230\
231 R = GP_PIXEL_GET_R_RGB888(pix1) * (perc); \
232 R += GP_PIXEL_GET_R_RGB888(pix2) * (255 - (perc)); \
233 R = (R + 128) / 255; \
234\
235 gp_pixel G; \
236\
237 G = GP_PIXEL_GET_G_RGB888(pix1) * (perc); \
238 G += GP_PIXEL_GET_G_RGB888(pix2) * (255 - (perc)); \
239 G = (G + 128) / 255; \
240\
241 gp_pixel B; \
242\
243 B = GP_PIXEL_GET_B_RGB888(pix1) * (perc); \
244 B += GP_PIXEL_GET_B_RGB888(pix2) * (255 - (perc)); \
245 B = (B + 128) / 255; \
246\
247\
248 GP_PIXEL_CREATE_RGB888(R, G, B); \
249})
250
251/*
252 * Mixes two RGB888 pixels.
253 *
254 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
255 */
256#define GP_MIX_PIXELS_GAMMA_RGB888(pix1, pix2, perc) ({ \
257 gp_pixel R; \
258\
259 R = gp_gamma8_to_linear10(GP_PIXEL_GET_R_RGB888(pix1)) * (perc); \
260 R += gp_gamma8_to_linear10(GP_PIXEL_GET_R_RGB888(pix2)) * (255 - (perc)); \
261 R = (R + 128) / 255; \
262 R = gp_linear10_to_gamma8(R); \
263\
264 gp_pixel G; \
265\
266 G = gp_gamma8_to_linear10(GP_PIXEL_GET_G_RGB888(pix1)) * (perc); \
267 G += gp_gamma8_to_linear10(GP_PIXEL_GET_G_RGB888(pix2)) * (255 - (perc)); \
268 G = (G + 128) / 255; \
269 G = gp_linear10_to_gamma8(G); \
270\
271 gp_pixel B; \
272\
273 B = gp_gamma8_to_linear10(GP_PIXEL_GET_B_RGB888(pix1)) * (perc); \
274 B += gp_gamma8_to_linear10(GP_PIXEL_GET_B_RGB888(pix2)) * (255 - (perc)); \
275 B = (B + 128) / 255; \
276 B = gp_linear10_to_gamma8(B); \
277\
278\
279 GP_PIXEL_CREATE_RGB888(R, G, B); \
280})
281
282#define GP_MIX_PIXELS_RGB888(pix1, pix2, perc) \
283 GP_MIX_PIXELS_LINEAR_RGB888(pix1, pix2, perc)
284
285/*
286 * Mixes two BGR888 pixels.
287 *
288 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
289 */
290#define GP_MIX_PIXELS_LINEAR_BGR888(pix1, pix2, perc) ({ \
291 gp_pixel B; \
292\
293 B = GP_PIXEL_GET_B_BGR888(pix1) * (perc); \
294 B += GP_PIXEL_GET_B_BGR888(pix2) * (255 - (perc)); \
295 B = (B + 128) / 255; \
296\
297 gp_pixel G; \
298\
299 G = GP_PIXEL_GET_G_BGR888(pix1) * (perc); \
300 G += GP_PIXEL_GET_G_BGR888(pix2) * (255 - (perc)); \
301 G = (G + 128) / 255; \
302\
303 gp_pixel R; \
304\
305 R = GP_PIXEL_GET_R_BGR888(pix1) * (perc); \
306 R += GP_PIXEL_GET_R_BGR888(pix2) * (255 - (perc)); \
307 R = (R + 128) / 255; \
308\
309\
310 GP_PIXEL_CREATE_BGR888(B, G, R); \
311})
312
313/*
314 * Mixes two BGR888 pixels.
315 *
316 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
317 */
318#define GP_MIX_PIXELS_GAMMA_BGR888(pix1, pix2, perc) ({ \
319 gp_pixel B; \
320\
321 B = gp_gamma8_to_linear10(GP_PIXEL_GET_B_BGR888(pix1)) * (perc); \
322 B += gp_gamma8_to_linear10(GP_PIXEL_GET_B_BGR888(pix2)) * (255 - (perc)); \
323 B = (B + 128) / 255; \
324 B = gp_linear10_to_gamma8(B); \
325\
326 gp_pixel G; \
327\
328 G = gp_gamma8_to_linear10(GP_PIXEL_GET_G_BGR888(pix1)) * (perc); \
329 G += gp_gamma8_to_linear10(GP_PIXEL_GET_G_BGR888(pix2)) * (255 - (perc)); \
330 G = (G + 128) / 255; \
331 G = gp_linear10_to_gamma8(G); \
332\
333 gp_pixel R; \
334\
335 R = gp_gamma8_to_linear10(GP_PIXEL_GET_R_BGR888(pix1)) * (perc); \
336 R += gp_gamma8_to_linear10(GP_PIXEL_GET_R_BGR888(pix2)) * (255 - (perc)); \
337 R = (R + 128) / 255; \
338 R = gp_linear10_to_gamma8(R); \
339\
340\
341 GP_PIXEL_CREATE_BGR888(B, G, R); \
342})
343
344#define GP_MIX_PIXELS_BGR888(pix1, pix2, perc) \
345 GP_MIX_PIXELS_LINEAR_BGR888(pix1, pix2, perc)
346
347/*
348 * Mixes two RGB555 pixels.
349 *
350 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
351 */
352#define GP_MIX_PIXELS_LINEAR_RGB555(pix1, pix2, perc) ({ \
353 gp_pixel R; \
354\
355 R = GP_PIXEL_GET_R_RGB555(pix1) * (perc); \
356 R += GP_PIXEL_GET_R_RGB555(pix2) * (255 - (perc)); \
357 R = (R + 128) / 255; \
358\
359 gp_pixel G; \
360\
361 G = GP_PIXEL_GET_G_RGB555(pix1) * (perc); \
362 G += GP_PIXEL_GET_G_RGB555(pix2) * (255 - (perc)); \
363 G = (G + 128) / 255; \
364\
365 gp_pixel B; \
366\
367 B = GP_PIXEL_GET_B_RGB555(pix1) * (perc); \
368 B += GP_PIXEL_GET_B_RGB555(pix2) * (255 - (perc)); \
369 B = (B + 128) / 255; \
370\
371\
372 GP_PIXEL_CREATE_RGB555(R, G, B); \
373})
374
375/*
376 * Mixes two RGB555 pixels.
377 *
378 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
379 */
380#define GP_MIX_PIXELS_GAMMA_RGB555(pix1, pix2, perc) ({ \
381 gp_pixel R; \
382\
383 R = gp_gamma5_to_linear10(GP_PIXEL_GET_R_RGB555(pix1)) * (perc); \
384 R += gp_gamma5_to_linear10(GP_PIXEL_GET_R_RGB555(pix2)) * (255 - (perc)); \
385 R = (R + 128) / 255; \
386 R = gp_linear10_to_gamma5(R); \
387\
388 gp_pixel G; \
389\
390 G = gp_gamma5_to_linear10(GP_PIXEL_GET_G_RGB555(pix1)) * (perc); \
391 G += gp_gamma5_to_linear10(GP_PIXEL_GET_G_RGB555(pix2)) * (255 - (perc)); \
392 G = (G + 128) / 255; \
393 G = gp_linear10_to_gamma5(G); \
394\
395 gp_pixel B; \
396\
397 B = gp_gamma5_to_linear10(GP_PIXEL_GET_B_RGB555(pix1)) * (perc); \
398 B += gp_gamma5_to_linear10(GP_PIXEL_GET_B_RGB555(pix2)) * (255 - (perc)); \
399 B = (B + 128) / 255; \
400 B = gp_linear10_to_gamma5(B); \
401\
402\
403 GP_PIXEL_CREATE_RGB555(R, G, B); \
404})
405
406#define GP_MIX_PIXELS_RGB555(pix1, pix2, perc) \
407 GP_MIX_PIXELS_LINEAR_RGB555(pix1, pix2, perc)
408
409/*
410 * Mixes two RGB565 pixels.
411 *
412 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
413 */
414#define GP_MIX_PIXELS_LINEAR_RGB565(pix1, pix2, perc) ({ \
415 gp_pixel R; \
416\
417 R = GP_PIXEL_GET_R_RGB565(pix1) * (perc); \
418 R += GP_PIXEL_GET_R_RGB565(pix2) * (255 - (perc)); \
419 R = (R + 128) / 255; \
420\
421 gp_pixel G; \
422\
423 G = GP_PIXEL_GET_G_RGB565(pix1) * (perc); \
424 G += GP_PIXEL_GET_G_RGB565(pix2) * (255 - (perc)); \
425 G = (G + 128) / 255; \
426\
427 gp_pixel B; \
428\
429 B = GP_PIXEL_GET_B_RGB565(pix1) * (perc); \
430 B += GP_PIXEL_GET_B_RGB565(pix2) * (255 - (perc)); \
431 B = (B + 128) / 255; \
432\
433\
434 GP_PIXEL_CREATE_RGB565(R, G, B); \
435})
436
437/*
438 * Mixes two RGB565 pixels.
439 *
440 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
441 */
442#define GP_MIX_PIXELS_GAMMA_RGB565(pix1, pix2, perc) ({ \
443 gp_pixel R; \
444\
445 R = gp_gamma5_to_linear10(GP_PIXEL_GET_R_RGB565(pix1)) * (perc); \
446 R += gp_gamma5_to_linear10(GP_PIXEL_GET_R_RGB565(pix2)) * (255 - (perc)); \
447 R = (R + 128) / 255; \
448 R = gp_linear10_to_gamma5(R); \
449\
450 gp_pixel G; \
451\
452 G = gp_gamma6_to_linear10(GP_PIXEL_GET_G_RGB565(pix1)) * (perc); \
453 G += gp_gamma6_to_linear10(GP_PIXEL_GET_G_RGB565(pix2)) * (255 - (perc)); \
454 G = (G + 128) / 255; \
455 G = gp_linear10_to_gamma6(G); \
456\
457 gp_pixel B; \
458\
459 B = gp_gamma5_to_linear10(GP_PIXEL_GET_B_RGB565(pix1)) * (perc); \
460 B += gp_gamma5_to_linear10(GP_PIXEL_GET_B_RGB565(pix2)) * (255 - (perc)); \
461 B = (B + 128) / 255; \
462 B = gp_linear10_to_gamma5(B); \
463\
464\
465 GP_PIXEL_CREATE_RGB565(R, G, B); \
466})
467
468#define GP_MIX_PIXELS_RGB565(pix1, pix2, perc) \
469 GP_MIX_PIXELS_LINEAR_RGB565(pix1, pix2, perc)
470
471/*
472 * Mixes two RGB666 pixels.
473 *
474 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
475 */
476#define GP_MIX_PIXELS_LINEAR_RGB666(pix1, pix2, perc) ({ \
477 gp_pixel R; \
478\
479 R = GP_PIXEL_GET_R_RGB666(pix1) * (perc); \
480 R += GP_PIXEL_GET_R_RGB666(pix2) * (255 - (perc)); \
481 R = (R + 128) / 255; \
482\
483 gp_pixel G; \
484\
485 G = GP_PIXEL_GET_G_RGB666(pix1) * (perc); \
486 G += GP_PIXEL_GET_G_RGB666(pix2) * (255 - (perc)); \
487 G = (G + 128) / 255; \
488\
489 gp_pixel B; \
490\
491 B = GP_PIXEL_GET_B_RGB666(pix1) * (perc); \
492 B += GP_PIXEL_GET_B_RGB666(pix2) * (255 - (perc)); \
493 B = (B + 128) / 255; \
494\
495\
496 GP_PIXEL_CREATE_RGB666(R, G, B); \
497})
498
499/*
500 * Mixes two RGB666 pixels.
501 *
502 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
503 */
504#define GP_MIX_PIXELS_GAMMA_RGB666(pix1, pix2, perc) ({ \
505 gp_pixel R; \
506\
507 R = gp_gamma6_to_linear10(GP_PIXEL_GET_R_RGB666(pix1)) * (perc); \
508 R += gp_gamma6_to_linear10(GP_PIXEL_GET_R_RGB666(pix2)) * (255 - (perc)); \
509 R = (R + 128) / 255; \
510 R = gp_linear10_to_gamma6(R); \
511\
512 gp_pixel G; \
513\
514 G = gp_gamma6_to_linear10(GP_PIXEL_GET_G_RGB666(pix1)) * (perc); \
515 G += gp_gamma6_to_linear10(GP_PIXEL_GET_G_RGB666(pix2)) * (255 - (perc)); \
516 G = (G + 128) / 255; \
517 G = gp_linear10_to_gamma6(G); \
518\
519 gp_pixel B; \
520\
521 B = gp_gamma6_to_linear10(GP_PIXEL_GET_B_RGB666(pix1)) * (perc); \
522 B += gp_gamma6_to_linear10(GP_PIXEL_GET_B_RGB666(pix2)) * (255 - (perc)); \
523 B = (B + 128) / 255; \
524 B = gp_linear10_to_gamma6(B); \
525\
526\
527 GP_PIXEL_CREATE_RGB666(R, G, B); \
528})
529
530#define GP_MIX_PIXELS_RGB666(pix1, pix2, perc) \
531 GP_MIX_PIXELS_LINEAR_RGB666(pix1, pix2, perc)
532
533/*
534 * Mixes two RGB332 pixels.
535 *
536 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
537 */
538#define GP_MIX_PIXELS_LINEAR_RGB332(pix1, pix2, perc) ({ \
539 gp_pixel R; \
540\
541 R = GP_PIXEL_GET_R_RGB332(pix1) * (perc); \
542 R += GP_PIXEL_GET_R_RGB332(pix2) * (255 - (perc)); \
543 R = (R + 128) / 255; \
544\
545 gp_pixel G; \
546\
547 G = GP_PIXEL_GET_G_RGB332(pix1) * (perc); \
548 G += GP_PIXEL_GET_G_RGB332(pix2) * (255 - (perc)); \
549 G = (G + 128) / 255; \
550\
551 gp_pixel B; \
552\
553 B = GP_PIXEL_GET_B_RGB332(pix1) * (perc); \
554 B += GP_PIXEL_GET_B_RGB332(pix2) * (255 - (perc)); \
555 B = (B + 128) / 255; \
556\
557\
558 GP_PIXEL_CREATE_RGB332(R, G, B); \
559})
560
561/*
562 * Mixes two RGB332 pixels.
563 *
564 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
565 */
566#define GP_MIX_PIXELS_GAMMA_RGB332(pix1, pix2, perc) ({ \
567 gp_pixel R; \
568\
569 R = gp_gamma3_to_linear10(GP_PIXEL_GET_R_RGB332(pix1)) * (perc); \
570 R += gp_gamma3_to_linear10(GP_PIXEL_GET_R_RGB332(pix2)) * (255 - (perc)); \
571 R = (R + 128) / 255; \
572 R = gp_linear10_to_gamma3(R); \
573\
574 gp_pixel G; \
575\
576 G = gp_gamma3_to_linear10(GP_PIXEL_GET_G_RGB332(pix1)) * (perc); \
577 G += gp_gamma3_to_linear10(GP_PIXEL_GET_G_RGB332(pix2)) * (255 - (perc)); \
578 G = (G + 128) / 255; \
579 G = gp_linear10_to_gamma3(G); \
580\
581 gp_pixel B; \
582\
583 B = gp_gamma2_to_linear10(GP_PIXEL_GET_B_RGB332(pix1)) * (perc); \
584 B += gp_gamma2_to_linear10(GP_PIXEL_GET_B_RGB332(pix2)) * (255 - (perc)); \
585 B = (B + 128) / 255; \
586 B = gp_linear10_to_gamma2(B); \
587\
588\
589 GP_PIXEL_CREATE_RGB332(R, G, B); \
590})
591
592#define GP_MIX_PIXELS_RGB332(pix1, pix2, perc) \
593 GP_MIX_PIXELS_LINEAR_RGB332(pix1, pix2, perc)
594
595/*
596 * Mixes two CMYK8888 pixels.
597 *
598 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
599 */
600#define GP_MIX_PIXELS_LINEAR_CMYK8888(pix1, pix2, perc) ({ \
601 gp_pixel K; \
602\
603 K = GP_PIXEL_GET_K_CMYK8888(pix1) * (perc); \
604 K += GP_PIXEL_GET_K_CMYK8888(pix2) * (255 - (perc)); \
605 K = (K + 128) / 255; \
606\
607 gp_pixel Y; \
608\
609 Y = GP_PIXEL_GET_Y_CMYK8888(pix1) * (perc); \
610 Y += GP_PIXEL_GET_Y_CMYK8888(pix2) * (255 - (perc)); \
611 Y = (Y + 128) / 255; \
612\
613 gp_pixel M; \
614\
615 M = GP_PIXEL_GET_M_CMYK8888(pix1) * (perc); \
616 M += GP_PIXEL_GET_M_CMYK8888(pix2) * (255 - (perc)); \
617 M = (M + 128) / 255; \
618\
619 gp_pixel C; \
620\
621 C = GP_PIXEL_GET_C_CMYK8888(pix1) * (perc); \
622 C += GP_PIXEL_GET_C_CMYK8888(pix2) * (255 - (perc)); \
623 C = (C + 128) / 255; \
624\
625\
626 GP_PIXEL_CREATE_CMYK8888(K, Y, M, C); \
627})
628
629/*
630 * Mixes two CMYK8888 pixels.
631 *
632 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
633 */
634#define GP_MIX_PIXELS_GAMMA_CMYK8888(pix1, pix2, perc) ({ \
635 gp_pixel K; \
636\
637 K = gp_gamma8_to_linear10(GP_PIXEL_GET_K_CMYK8888(pix1)) * (perc); \
638 K += gp_gamma8_to_linear10(GP_PIXEL_GET_K_CMYK8888(pix2)) * (255 - (perc)); \
639 K = (K + 128) / 255; \
640 K = gp_linear10_to_gamma8(K); \
641\
642 gp_pixel Y; \
643\
644 Y = gp_gamma8_to_linear10(GP_PIXEL_GET_Y_CMYK8888(pix1)) * (perc); \
645 Y += gp_gamma8_to_linear10(GP_PIXEL_GET_Y_CMYK8888(pix2)) * (255 - (perc)); \
646 Y = (Y + 128) / 255; \
647 Y = gp_linear10_to_gamma8(Y); \
648\
649 gp_pixel M; \
650\
651 M = gp_gamma8_to_linear10(GP_PIXEL_GET_M_CMYK8888(pix1)) * (perc); \
652 M += gp_gamma8_to_linear10(GP_PIXEL_GET_M_CMYK8888(pix2)) * (255 - (perc)); \
653 M = (M + 128) / 255; \
654 M = gp_linear10_to_gamma8(M); \
655\
656 gp_pixel C; \
657\
658 C = gp_gamma8_to_linear10(GP_PIXEL_GET_C_CMYK8888(pix1)) * (perc); \
659 C += gp_gamma8_to_linear10(GP_PIXEL_GET_C_CMYK8888(pix2)) * (255 - (perc)); \
660 C = (C + 128) / 255; \
661 C = gp_linear10_to_gamma8(C); \
662\
663\
664 GP_PIXEL_CREATE_CMYK8888(K, Y, M, C); \
665})
666
667#define GP_MIX_PIXELS_CMYK8888(pix1, pix2, perc) \
668 GP_MIX_PIXELS_LINEAR_CMYK8888(pix1, pix2, perc)
669
670/*
671 * Mixes two P2 pixels.
672 *
673 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
674 */
675#define GP_MIX_PIXELS_LINEAR_P2(pix1, pix2, perc) ({ \
676 gp_pixel P; \
677\
678 P = GP_PIXEL_GET_P_P2(pix1) * (perc); \
679 P += GP_PIXEL_GET_P_P2(pix2) * (255 - (perc)); \
680 P = (P + 128) / 255; \
681\
682\
683 GP_PIXEL_CREATE_P2(P); \
684})
685
686/*
687 * Mixes two P2 pixels.
688 *
689 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
690 */
691#define GP_MIX_PIXELS_GAMMA_P2(pix1, pix2, perc) ({ \
692 gp_pixel P; \
693\
694 P = gp_gamma2_to_linear10(GP_PIXEL_GET_P_P2(pix1)) * (perc); \
695 P += gp_gamma2_to_linear10(GP_PIXEL_GET_P_P2(pix2)) * (255 - (perc)); \
696 P = (P + 128) / 255; \
697 P = gp_linear10_to_gamma2(P); \
698\
699\
700 GP_PIXEL_CREATE_P2(P); \
701})
702
703#define GP_MIX_PIXELS_P2(pix1, pix2, perc) \
704 GP_MIX_PIXELS_LINEAR_P2(pix1, pix2, perc)
705
706/*
707 * Mixes two P4 pixels.
708 *
709 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
710 */
711#define GP_MIX_PIXELS_LINEAR_P4(pix1, pix2, perc) ({ \
712 gp_pixel P; \
713\
714 P = GP_PIXEL_GET_P_P4(pix1) * (perc); \
715 P += GP_PIXEL_GET_P_P4(pix2) * (255 - (perc)); \
716 P = (P + 128) / 255; \
717\
718\
719 GP_PIXEL_CREATE_P4(P); \
720})
721
722/*
723 * Mixes two P4 pixels.
724 *
725 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
726 */
727#define GP_MIX_PIXELS_GAMMA_P4(pix1, pix2, perc) ({ \
728 gp_pixel P; \
729\
730 P = gp_gamma4_to_linear10(GP_PIXEL_GET_P_P4(pix1)) * (perc); \
731 P += gp_gamma4_to_linear10(GP_PIXEL_GET_P_P4(pix2)) * (255 - (perc)); \
732 P = (P + 128) / 255; \
733 P = gp_linear10_to_gamma4(P); \
734\
735\
736 GP_PIXEL_CREATE_P4(P); \
737})
738
739#define GP_MIX_PIXELS_P4(pix1, pix2, perc) \
740 GP_MIX_PIXELS_LINEAR_P4(pix1, pix2, perc)
741
742/*
743 * Mixes two P8 pixels.
744 *
745 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
746 */
747#define GP_MIX_PIXELS_LINEAR_P8(pix1, pix2, perc) ({ \
748 gp_pixel P; \
749\
750 P = GP_PIXEL_GET_P_P8(pix1) * (perc); \
751 P += GP_PIXEL_GET_P_P8(pix2) * (255 - (perc)); \
752 P = (P + 128) / 255; \
753\
754\
755 GP_PIXEL_CREATE_P8(P); \
756})
757
758/*
759 * Mixes two P8 pixels.
760 *
761 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
762 */
763#define GP_MIX_PIXELS_GAMMA_P8(pix1, pix2, perc) ({ \
764 gp_pixel P; \
765\
766 P = gp_gamma8_to_linear10(GP_PIXEL_GET_P_P8(pix1)) * (perc); \
767 P += gp_gamma8_to_linear10(GP_PIXEL_GET_P_P8(pix2)) * (255 - (perc)); \
768 P = (P + 128) / 255; \
769 P = gp_linear10_to_gamma8(P); \
770\
771\
772 GP_PIXEL_CREATE_P8(P); \
773})
774
775#define GP_MIX_PIXELS_P8(pix1, pix2, perc) \
776 GP_MIX_PIXELS_LINEAR_P8(pix1, pix2, perc)
777
778/*
779 * Mixes two G1_DB pixels.
780 *
781 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
782 */
783#define GP_MIX_PIXELS_LINEAR_G1_DB(pix1, pix2, perc) ({ \
784 gp_pixel V; \
785\
786 V = GP_PIXEL_GET_V_G1_DB(pix1) * (perc); \
787 V += GP_PIXEL_GET_V_G1_DB(pix2) * (255 - (perc)); \
788 V = (V + 128) / 255; \
789\
790\
791 GP_PIXEL_CREATE_G1_DB(V); \
792})
793
794/*
795 * Mixes two G1_DB pixels.
796 *
797 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
798 */
799#define GP_MIX_PIXELS_GAMMA_G1_DB(pix1, pix2, perc) ({ \
800 gp_pixel V; \
801\
802 V = gp_gamma1_to_linear10(GP_PIXEL_GET_V_G1_DB(pix1)) * (perc); \
803 V += gp_gamma1_to_linear10(GP_PIXEL_GET_V_G1_DB(pix2)) * (255 - (perc)); \
804 V = (V + 128) / 255; \
805 V = gp_linear10_to_gamma1(V); \
806\
807\
808 GP_PIXEL_CREATE_G1_DB(V); \
809})
810
811#define GP_MIX_PIXELS_G1_DB(pix1, pix2, perc) \
812 GP_MIX_PIXELS_LINEAR_G1_DB(pix1, pix2, perc)
813
814/*
815 * Mixes two G2_DB pixels.
816 *
817 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
818 */
819#define GP_MIX_PIXELS_LINEAR_G2_DB(pix1, pix2, perc) ({ \
820 gp_pixel V; \
821\
822 V = GP_PIXEL_GET_V_G2_DB(pix1) * (perc); \
823 V += GP_PIXEL_GET_V_G2_DB(pix2) * (255 - (perc)); \
824 V = (V + 128) / 255; \
825\
826\
827 GP_PIXEL_CREATE_G2_DB(V); \
828})
829
830/*
831 * Mixes two G2_DB pixels.
832 *
833 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
834 */
835#define GP_MIX_PIXELS_GAMMA_G2_DB(pix1, pix2, perc) ({ \
836 gp_pixel V; \
837\
838 V = gp_gamma2_to_linear10(GP_PIXEL_GET_V_G2_DB(pix1)) * (perc); \
839 V += gp_gamma2_to_linear10(GP_PIXEL_GET_V_G2_DB(pix2)) * (255 - (perc)); \
840 V = (V + 128) / 255; \
841 V = gp_linear10_to_gamma2(V); \
842\
843\
844 GP_PIXEL_CREATE_G2_DB(V); \
845})
846
847#define GP_MIX_PIXELS_G2_DB(pix1, pix2, perc) \
848 GP_MIX_PIXELS_LINEAR_G2_DB(pix1, pix2, perc)
849
850/*
851 * Mixes two G4_DB pixels.
852 *
853 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
854 */
855#define GP_MIX_PIXELS_LINEAR_G4_DB(pix1, pix2, perc) ({ \
856 gp_pixel V; \
857\
858 V = GP_PIXEL_GET_V_G4_DB(pix1) * (perc); \
859 V += GP_PIXEL_GET_V_G4_DB(pix2) * (255 - (perc)); \
860 V = (V + 128) / 255; \
861\
862\
863 GP_PIXEL_CREATE_G4_DB(V); \
864})
865
866/*
867 * Mixes two G4_DB pixels.
868 *
869 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
870 */
871#define GP_MIX_PIXELS_GAMMA_G4_DB(pix1, pix2, perc) ({ \
872 gp_pixel V; \
873\
874 V = gp_gamma4_to_linear10(GP_PIXEL_GET_V_G4_DB(pix1)) * (perc); \
875 V += gp_gamma4_to_linear10(GP_PIXEL_GET_V_G4_DB(pix2)) * (255 - (perc)); \
876 V = (V + 128) / 255; \
877 V = gp_linear10_to_gamma4(V); \
878\
879\
880 GP_PIXEL_CREATE_G4_DB(V); \
881})
882
883#define GP_MIX_PIXELS_G4_DB(pix1, pix2, perc) \
884 GP_MIX_PIXELS_LINEAR_G4_DB(pix1, pix2, perc)
885
886/*
887 * Mixes two G1_UB pixels.
888 *
889 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
890 */
891#define GP_MIX_PIXELS_LINEAR_G1_UB(pix1, pix2, perc) ({ \
892 gp_pixel V; \
893\
894 V = GP_PIXEL_GET_V_G1_UB(pix1) * (perc); \
895 V += GP_PIXEL_GET_V_G1_UB(pix2) * (255 - (perc)); \
896 V = (V + 128) / 255; \
897\
898\
899 GP_PIXEL_CREATE_G1_UB(V); \
900})
901
902/*
903 * Mixes two G1_UB pixels.
904 *
905 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
906 */
907#define GP_MIX_PIXELS_GAMMA_G1_UB(pix1, pix2, perc) ({ \
908 gp_pixel V; \
909\
910 V = gp_gamma1_to_linear10(GP_PIXEL_GET_V_G1_UB(pix1)) * (perc); \
911 V += gp_gamma1_to_linear10(GP_PIXEL_GET_V_G1_UB(pix2)) * (255 - (perc)); \
912 V = (V + 128) / 255; \
913 V = gp_linear10_to_gamma1(V); \
914\
915\
916 GP_PIXEL_CREATE_G1_UB(V); \
917})
918
919#define GP_MIX_PIXELS_G1_UB(pix1, pix2, perc) \
920 GP_MIX_PIXELS_LINEAR_G1_UB(pix1, pix2, perc)
921
922/*
923 * Mixes two G2_UB pixels.
924 *
925 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
926 */
927#define GP_MIX_PIXELS_LINEAR_G2_UB(pix1, pix2, perc) ({ \
928 gp_pixel V; \
929\
930 V = GP_PIXEL_GET_V_G2_UB(pix1) * (perc); \
931 V += GP_PIXEL_GET_V_G2_UB(pix2) * (255 - (perc)); \
932 V = (V + 128) / 255; \
933\
934\
935 GP_PIXEL_CREATE_G2_UB(V); \
936})
937
938/*
939 * Mixes two G2_UB pixels.
940 *
941 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
942 */
943#define GP_MIX_PIXELS_GAMMA_G2_UB(pix1, pix2, perc) ({ \
944 gp_pixel V; \
945\
946 V = gp_gamma2_to_linear10(GP_PIXEL_GET_V_G2_UB(pix1)) * (perc); \
947 V += gp_gamma2_to_linear10(GP_PIXEL_GET_V_G2_UB(pix2)) * (255 - (perc)); \
948 V = (V + 128) / 255; \
949 V = gp_linear10_to_gamma2(V); \
950\
951\
952 GP_PIXEL_CREATE_G2_UB(V); \
953})
954
955#define GP_MIX_PIXELS_G2_UB(pix1, pix2, perc) \
956 GP_MIX_PIXELS_LINEAR_G2_UB(pix1, pix2, perc)
957
958/*
959 * Mixes two G4_UB pixels.
960 *
961 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
962 */
963#define GP_MIX_PIXELS_LINEAR_G4_UB(pix1, pix2, perc) ({ \
964 gp_pixel V; \
965\
966 V = GP_PIXEL_GET_V_G4_UB(pix1) * (perc); \
967 V += GP_PIXEL_GET_V_G4_UB(pix2) * (255 - (perc)); \
968 V = (V + 128) / 255; \
969\
970\
971 GP_PIXEL_CREATE_G4_UB(V); \
972})
973
974/*
975 * Mixes two G4_UB pixels.
976 *
977 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
978 */
979#define GP_MIX_PIXELS_GAMMA_G4_UB(pix1, pix2, perc) ({ \
980 gp_pixel V; \
981\
982 V = gp_gamma4_to_linear10(GP_PIXEL_GET_V_G4_UB(pix1)) * (perc); \
983 V += gp_gamma4_to_linear10(GP_PIXEL_GET_V_G4_UB(pix2)) * (255 - (perc)); \
984 V = (V + 128) / 255; \
985 V = gp_linear10_to_gamma4(V); \
986\
987\
988 GP_PIXEL_CREATE_G4_UB(V); \
989})
990
991#define GP_MIX_PIXELS_G4_UB(pix1, pix2, perc) \
992 GP_MIX_PIXELS_LINEAR_G4_UB(pix1, pix2, perc)
993
994/*
995 * Mixes two G8 pixels.
996 *
997 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
998 */
999#define GP_MIX_PIXELS_LINEAR_G8(pix1, pix2, perc) ({ \
1000 gp_pixel V; \
1001\
1002 V = GP_PIXEL_GET_V_G8(pix1) * (perc); \
1003 V += GP_PIXEL_GET_V_G8(pix2) * (255 - (perc)); \
1004 V = (V + 128) / 255; \
1005\
1006\
1007 GP_PIXEL_CREATE_G8(V); \
1008})
1009
1010/*
1011 * Mixes two G8 pixels.
1012 *
1013 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
1014 */
1015#define GP_MIX_PIXELS_GAMMA_G8(pix1, pix2, perc) ({ \
1016 gp_pixel V; \
1017\
1018 V = gp_gamma8_to_linear10(GP_PIXEL_GET_V_G8(pix1)) * (perc); \
1019 V += gp_gamma8_to_linear10(GP_PIXEL_GET_V_G8(pix2)) * (255 - (perc)); \
1020 V = (V + 128) / 255; \
1021 V = gp_linear10_to_gamma8(V); \
1022\
1023\
1024 GP_PIXEL_CREATE_G8(V); \
1025})
1026
1027#define GP_MIX_PIXELS_G8(pix1, pix2, perc) \
1028 GP_MIX_PIXELS_LINEAR_G8(pix1, pix2, perc)
1029
1030/*
1031 * Mixes two GA88 pixels.
1032 *
1033 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
1034 */
1035#define GP_MIX_PIXELS_LINEAR_GA88(pix1, pix2, perc) ({ \
1036 gp_pixel V; \
1037\
1038 V = GP_PIXEL_GET_V_GA88(pix1) * (perc); \
1039 V += GP_PIXEL_GET_V_GA88(pix2) * (255 - (perc)); \
1040 V = (V + 128) / 255; \
1041\
1042 gp_pixel A; \
1043\
1044 A = GP_PIXEL_GET_A_GA88(pix1) * (perc); \
1045 A += GP_PIXEL_GET_A_GA88(pix2) * (255 - (perc)); \
1046 A = (A + 128) / 255; \
1047\
1048\
1049 GP_PIXEL_CREATE_GA88(V, A); \
1050})
1051
1052/*
1053 * Mixes two GA88 pixels.
1054 *
1055 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
1056 */
1057#define GP_MIX_PIXELS_GAMMA_GA88(pix1, pix2, perc) ({ \
1058 gp_pixel V; \
1059\
1060 V = gp_gamma8_to_linear10(GP_PIXEL_GET_V_GA88(pix1)) * (perc); \
1061 V += gp_gamma8_to_linear10(GP_PIXEL_GET_V_GA88(pix2)) * (255 - (perc)); \
1062 V = (V + 128) / 255; \
1063 V = gp_linear10_to_gamma8(V); \
1064\
1065 gp_pixel A; \
1066\
1067 A = gp_gamma8_to_linear10(GP_PIXEL_GET_A_GA88(pix1)) * (perc); \
1068 A += gp_gamma8_to_linear10(GP_PIXEL_GET_A_GA88(pix2)) * (255 - (perc)); \
1069 A = (A + 128) / 255; \
1070 A = gp_linear10_to_gamma8(A); \
1071\
1072\
1073 GP_PIXEL_CREATE_GA88(V, A); \
1074})
1075
1076#define GP_MIX_PIXELS_GA88(pix1, pix2, perc) \
1077 GP_MIX_PIXELS_LINEAR_GA88(pix1, pix2, perc)
1078
1079/*
1080 * Mixes two G16 pixels.
1081 *
1082 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
1083 */
1084#define GP_MIX_PIXELS_LINEAR_G16(pix1, pix2, perc) ({ \
1085 gp_pixel V; \
1086\
1087 V = GP_PIXEL_GET_V_G16(pix1) * (perc); \
1088 V += GP_PIXEL_GET_V_G16(pix2) * (255 - (perc)); \
1089 V = (V + 128) / 255; \
1090\
1091\
1092 GP_PIXEL_CREATE_G16(V); \
1093})
1094
1095/*
1096 * Mixes two G16 pixels.
1097 *
1098 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
1099 */
1100#define GP_MIX_PIXELS_GAMMA_G16(pix1, pix2, perc) ({ \
1101 gp_pixel V; \
1102\
1103 V = gp_gamma16_to_linear10(GP_PIXEL_GET_V_G16(pix1)) * (perc); \
1104 V += gp_gamma16_to_linear10(GP_PIXEL_GET_V_G16(pix2)) * (255 - (perc)); \
1105 V = (V + 128) / 255; \
1106 V = gp_linear10_to_gamma16(V); \
1107\
1108\
1109 GP_PIXEL_CREATE_G16(V); \
1110})
1111
1112#define GP_MIX_PIXELS_G16(pix1, pix2, perc) \
1113 GP_MIX_PIXELS_LINEAR_G16(pix1, pix2, perc)
1114
1115static inline gp_pixel gp_mix_pixels(gp_pixel pix1, gp_pixel pix2,
1116 uint8_t perc, gp_pixel_type pixel_type)
1117{
1118 switch (pixel_type) {
1119 case GP_PIXEL_RGB101010:
1120 return GP_MIX_PIXELS_LINEAR_RGB101010(pix1, pix2, perc);
1121 case GP_PIXEL_xRGB8888:
1122 return GP_MIX_PIXELS_LINEAR_xRGB8888(pix1, pix2, perc);
1123 case GP_PIXEL_RGBA8888:
1124 return GP_MIX_PIXELS_LINEAR_RGBA8888(pix1, pix2, perc);
1125 case GP_PIXEL_RGB888:
1126 return GP_MIX_PIXELS_LINEAR_RGB888(pix1, pix2, perc);
1127 case GP_PIXEL_BGR888:
1128 return GP_MIX_PIXELS_LINEAR_BGR888(pix1, pix2, perc);
1129 case GP_PIXEL_RGB555:
1130 return GP_MIX_PIXELS_LINEAR_RGB555(pix1, pix2, perc);
1131 case GP_PIXEL_RGB565:
1132 return GP_MIX_PIXELS_LINEAR_RGB565(pix1, pix2, perc);
1133 case GP_PIXEL_RGB666:
1134 return GP_MIX_PIXELS_LINEAR_RGB666(pix1, pix2, perc);
1135 case GP_PIXEL_RGB332:
1136 return GP_MIX_PIXELS_LINEAR_RGB332(pix1, pix2, perc);
1137 case GP_PIXEL_CMYK8888:
1138 return GP_MIX_PIXELS_LINEAR_CMYK8888(pix1, pix2, perc);
1139 case GP_PIXEL_P2:
1140 return GP_MIX_PIXELS_LINEAR_P2(pix1, pix2, perc);
1141 case GP_PIXEL_P4:
1142 return GP_MIX_PIXELS_LINEAR_P4(pix1, pix2, perc);
1143 case GP_PIXEL_P8:
1144 return GP_MIX_PIXELS_LINEAR_P8(pix1, pix2, perc);
1145 case GP_PIXEL_G1_DB:
1146 return GP_MIX_PIXELS_LINEAR_G1_DB(pix1, pix2, perc);
1147 case GP_PIXEL_G2_DB:
1148 return GP_MIX_PIXELS_LINEAR_G2_DB(pix1, pix2, perc);
1149 case GP_PIXEL_G4_DB:
1150 return GP_MIX_PIXELS_LINEAR_G4_DB(pix1, pix2, perc);
1151 case GP_PIXEL_G1_UB:
1152 return GP_MIX_PIXELS_LINEAR_G1_UB(pix1, pix2, perc);
1153 case GP_PIXEL_G2_UB:
1154 return GP_MIX_PIXELS_LINEAR_G2_UB(pix1, pix2, perc);
1155 case GP_PIXEL_G4_UB:
1156 return GP_MIX_PIXELS_LINEAR_G4_UB(pix1, pix2, perc);
1157 case GP_PIXEL_G8:
1158 return GP_MIX_PIXELS_LINEAR_G8(pix1, pix2, perc);
1159 case GP_PIXEL_GA88:
1160 return GP_MIX_PIXELS_LINEAR_GA88(pix1, pix2, perc);
1161 case GP_PIXEL_G16:
1162 return GP_MIX_PIXELS_LINEAR_G16(pix1, pix2, perc);
1163 default:
1164 GP_ABORT("Unknown pixeltype");
1165 }
1166}
1167
1168
1169static inline void gp_mix_pixel_raw_RGB101010(gp_pixmap *pixmap,
1170 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1171{
1172 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
1173 pix = GP_MIX_PIXELS_RGB101010(pixel, pix, perc);
1174 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
1175}
1176
1177static inline void gp_mix_pixel_raw_xRGB8888(gp_pixmap *pixmap,
1178 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1179{
1180 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
1181 pix = GP_MIX_PIXELS_xRGB8888(pixel, pix, perc);
1182 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
1183}
1184
1185static inline void gp_mix_pixel_raw_RGBA8888(gp_pixmap *pixmap,
1186 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1187{
1188 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
1189 pix = GP_MIX_PIXELS_RGBA8888(pixel, pix, perc);
1190 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
1191}
1192
1193static inline void gp_mix_pixel_raw_RGB888(gp_pixmap *pixmap,
1194 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1195{
1196 gp_pixel pix = gp_getpixel_raw_24BPP(pixmap, x, y);
1197 pix = GP_MIX_PIXELS_RGB888(pixel, pix, perc);
1198 gp_putpixel_raw_24BPP(pixmap, x, y, pix);
1199}
1200
1201static inline void gp_mix_pixel_raw_BGR888(gp_pixmap *pixmap,
1202 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1203{
1204 gp_pixel pix = gp_getpixel_raw_24BPP(pixmap, x, y);
1205 pix = GP_MIX_PIXELS_BGR888(pixel, pix, perc);
1206 gp_putpixel_raw_24BPP(pixmap, x, y, pix);
1207}
1208
1209static inline void gp_mix_pixel_raw_RGB555(gp_pixmap *pixmap,
1210 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1211{
1212 gp_pixel pix = gp_getpixel_raw_16BPP(pixmap, x, y);
1213 pix = GP_MIX_PIXELS_RGB555(pixel, pix, perc);
1214 gp_putpixel_raw_16BPP(pixmap, x, y, pix);
1215}
1216
1217static inline void gp_mix_pixel_raw_RGB565(gp_pixmap *pixmap,
1218 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1219{
1220 gp_pixel pix = gp_getpixel_raw_16BPP(pixmap, x, y);
1221 pix = GP_MIX_PIXELS_RGB565(pixel, pix, perc);
1222 gp_putpixel_raw_16BPP(pixmap, x, y, pix);
1223}
1224
1225static inline void gp_mix_pixel_raw_RGB666(gp_pixmap *pixmap,
1226 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1227{
1228 gp_pixel pix = gp_getpixel_raw_18BPP_DB(pixmap, x, y);
1229 pix = GP_MIX_PIXELS_RGB666(pixel, pix, perc);
1230 gp_putpixel_raw_18BPP_DB(pixmap, x, y, pix);
1231}
1232
1233static inline void gp_mix_pixel_raw_RGB332(gp_pixmap *pixmap,
1234 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1235{
1236 gp_pixel pix = gp_getpixel_raw_8BPP(pixmap, x, y);
1237 pix = GP_MIX_PIXELS_RGB332(pixel, pix, perc);
1238 gp_putpixel_raw_8BPP(pixmap, x, y, pix);
1239}
1240
1241static inline void gp_mix_pixel_raw_CMYK8888(gp_pixmap *pixmap,
1242 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1243{
1244 gp_pixel pix = gp_getpixel_raw_32BPP(pixmap, x, y);
1245 pix = GP_MIX_PIXELS_CMYK8888(pixel, pix, perc);
1246 gp_putpixel_raw_32BPP(pixmap, x, y, pix);
1247}
1248
1249static inline void gp_mix_pixel_raw_P2(gp_pixmap *pixmap,
1250 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1251{
1252 gp_pixel pix = gp_getpixel_raw_2BPP_UB(pixmap, x, y);
1253 pix = GP_MIX_PIXELS_P2(pixel, pix, perc);
1254 gp_putpixel_raw_2BPP_UB(pixmap, x, y, pix);
1255}
1256
1257static inline void gp_mix_pixel_raw_P4(gp_pixmap *pixmap,
1258 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1259{
1260 gp_pixel pix = gp_getpixel_raw_4BPP_UB(pixmap, x, y);
1261 pix = GP_MIX_PIXELS_P4(pixel, pix, perc);
1262 gp_putpixel_raw_4BPP_UB(pixmap, x, y, pix);
1263}
1264
1265static inline void gp_mix_pixel_raw_P8(gp_pixmap *pixmap,
1266 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1267{
1268 gp_pixel pix = gp_getpixel_raw_8BPP(pixmap, x, y);
1269 pix = GP_MIX_PIXELS_P8(pixel, pix, perc);
1270 gp_putpixel_raw_8BPP(pixmap, x, y, pix);
1271}
1272
1273static inline void gp_mix_pixel_raw_G1_DB(gp_pixmap *pixmap,
1274 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1275{
1276 gp_pixel pix = gp_getpixel_raw_1BPP_DB(pixmap, x, y);
1277 pix = GP_MIX_PIXELS_G1_DB(pixel, pix, perc);
1278 gp_putpixel_raw_1BPP_DB(pixmap, x, y, pix);
1279}
1280
1281static inline void gp_mix_pixel_raw_G2_DB(gp_pixmap *pixmap,
1282 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1283{
1284 gp_pixel pix = gp_getpixel_raw_2BPP_DB(pixmap, x, y);
1285 pix = GP_MIX_PIXELS_G2_DB(pixel, pix, perc);
1286 gp_putpixel_raw_2BPP_DB(pixmap, x, y, pix);
1287}
1288
1289static inline void gp_mix_pixel_raw_G4_DB(gp_pixmap *pixmap,
1290 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1291{
1292 gp_pixel pix = gp_getpixel_raw_4BPP_DB(pixmap, x, y);
1293 pix = GP_MIX_PIXELS_G4_DB(pixel, pix, perc);
1294 gp_putpixel_raw_4BPP_DB(pixmap, x, y, pix);
1295}
1296
1297static inline void gp_mix_pixel_raw_G1_UB(gp_pixmap *pixmap,
1298 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1299{
1300 gp_pixel pix = gp_getpixel_raw_1BPP_UB(pixmap, x, y);
1301 pix = GP_MIX_PIXELS_G1_UB(pixel, pix, perc);
1302 gp_putpixel_raw_1BPP_UB(pixmap, x, y, pix);
1303}
1304
1305static inline void gp_mix_pixel_raw_G2_UB(gp_pixmap *pixmap,
1306 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1307{
1308 gp_pixel pix = gp_getpixel_raw_2BPP_UB(pixmap, x, y);
1309 pix = GP_MIX_PIXELS_G2_UB(pixel, pix, perc);
1310 gp_putpixel_raw_2BPP_UB(pixmap, x, y, pix);
1311}
1312
1313static inline void gp_mix_pixel_raw_G4_UB(gp_pixmap *pixmap,
1314 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1315{
1316 gp_pixel pix = gp_getpixel_raw_4BPP_UB(pixmap, x, y);
1317 pix = GP_MIX_PIXELS_G4_UB(pixel, pix, perc);
1318 gp_putpixel_raw_4BPP_UB(pixmap, x, y, pix);
1319}
1320
1321static inline void gp_mix_pixel_raw_G8(gp_pixmap *pixmap,
1322 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1323{
1324 gp_pixel pix = gp_getpixel_raw_8BPP(pixmap, x, y);
1325 pix = GP_MIX_PIXELS_G8(pixel, pix, perc);
1326 gp_putpixel_raw_8BPP(pixmap, x, y, pix);
1327}
1328
1329static inline void gp_mix_pixel_raw_GA88(gp_pixmap *pixmap,
1330 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1331{
1332 gp_pixel pix = gp_getpixel_raw_16BPP(pixmap, x, y);
1333 pix = GP_MIX_PIXELS_GA88(pixel, pix, perc);
1334 gp_putpixel_raw_16BPP(pixmap, x, y, pix);
1335}
1336
1337static inline void gp_mix_pixel_raw_G16(gp_pixmap *pixmap,
1338 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1339{
1340 gp_pixel pix = gp_getpixel_raw_16BPP(pixmap, x, y);
1341 pix = GP_MIX_PIXELS_G16(pixel, pix, perc);
1342 gp_putpixel_raw_16BPP(pixmap, x, y, pix);
1343}
1344
1345
1346static inline void gp_mix_pixel_raw_clipped_RGB101010(gp_pixmap *pixmap,
1347 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1348{
1349 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1350 return;
1351
1352 gp_mix_pixel_raw_RGB101010(pixmap, x, y, pixel, perc);
1353}
1354
1355static inline void gp_mix_pixel_raw_clipped_xRGB8888(gp_pixmap *pixmap,
1356 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1357{
1358 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1359 return;
1360
1361 gp_mix_pixel_raw_xRGB8888(pixmap, x, y, pixel, perc);
1362}
1363
1364static inline void gp_mix_pixel_raw_clipped_RGBA8888(gp_pixmap *pixmap,
1365 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1366{
1367 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1368 return;
1369
1370 gp_mix_pixel_raw_RGBA8888(pixmap, x, y, pixel, perc);
1371}
1372
1373static inline void gp_mix_pixel_raw_clipped_RGB888(gp_pixmap *pixmap,
1374 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1375{
1376 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1377 return;
1378
1379 gp_mix_pixel_raw_RGB888(pixmap, x, y, pixel, perc);
1380}
1381
1382static inline void gp_mix_pixel_raw_clipped_BGR888(gp_pixmap *pixmap,
1383 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1384{
1385 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1386 return;
1387
1388 gp_mix_pixel_raw_BGR888(pixmap, x, y, pixel, perc);
1389}
1390
1391static inline void gp_mix_pixel_raw_clipped_RGB555(gp_pixmap *pixmap,
1392 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1393{
1394 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1395 return;
1396
1397 gp_mix_pixel_raw_RGB555(pixmap, x, y, pixel, perc);
1398}
1399
1400static inline void gp_mix_pixel_raw_clipped_RGB565(gp_pixmap *pixmap,
1401 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1402{
1403 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1404 return;
1405
1406 gp_mix_pixel_raw_RGB565(pixmap, x, y, pixel, perc);
1407}
1408
1409static inline void gp_mix_pixel_raw_clipped_RGB666(gp_pixmap *pixmap,
1410 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1411{
1412 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1413 return;
1414
1415 gp_mix_pixel_raw_RGB666(pixmap, x, y, pixel, perc);
1416}
1417
1418static inline void gp_mix_pixel_raw_clipped_RGB332(gp_pixmap *pixmap,
1419 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1420{
1421 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1422 return;
1423
1424 gp_mix_pixel_raw_RGB332(pixmap, x, y, pixel, perc);
1425}
1426
1427static inline void gp_mix_pixel_raw_clipped_CMYK8888(gp_pixmap *pixmap,
1428 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1429{
1430 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1431 return;
1432
1433 gp_mix_pixel_raw_CMYK8888(pixmap, x, y, pixel, perc);
1434}
1435
1436static inline void gp_mix_pixel_raw_clipped_P2(gp_pixmap *pixmap,
1437 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1438{
1439 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1440 return;
1441
1442 gp_mix_pixel_raw_P2(pixmap, x, y, pixel, perc);
1443}
1444
1445static inline void gp_mix_pixel_raw_clipped_P4(gp_pixmap *pixmap,
1446 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1447{
1448 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1449 return;
1450
1451 gp_mix_pixel_raw_P4(pixmap, x, y, pixel, perc);
1452}
1453
1454static inline void gp_mix_pixel_raw_clipped_P8(gp_pixmap *pixmap,
1455 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1456{
1457 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1458 return;
1459
1460 gp_mix_pixel_raw_P8(pixmap, x, y, pixel, perc);
1461}
1462
1463static inline void gp_mix_pixel_raw_clipped_G1_DB(gp_pixmap *pixmap,
1464 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1465{
1466 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1467 return;
1468
1469 gp_mix_pixel_raw_G1_DB(pixmap, x, y, pixel, perc);
1470}
1471
1472static inline void gp_mix_pixel_raw_clipped_G2_DB(gp_pixmap *pixmap,
1473 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1474{
1475 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1476 return;
1477
1478 gp_mix_pixel_raw_G2_DB(pixmap, x, y, pixel, perc);
1479}
1480
1481static inline void gp_mix_pixel_raw_clipped_G4_DB(gp_pixmap *pixmap,
1482 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1483{
1484 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1485 return;
1486
1487 gp_mix_pixel_raw_G4_DB(pixmap, x, y, pixel, perc);
1488}
1489
1490static inline void gp_mix_pixel_raw_clipped_G1_UB(gp_pixmap *pixmap,
1491 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1492{
1493 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1494 return;
1495
1496 gp_mix_pixel_raw_G1_UB(pixmap, x, y, pixel, perc);
1497}
1498
1499static inline void gp_mix_pixel_raw_clipped_G2_UB(gp_pixmap *pixmap,
1500 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1501{
1502 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1503 return;
1504
1505 gp_mix_pixel_raw_G2_UB(pixmap, x, y, pixel, perc);
1506}
1507
1508static inline void gp_mix_pixel_raw_clipped_G4_UB(gp_pixmap *pixmap,
1509 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1510{
1511 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1512 return;
1513
1514 gp_mix_pixel_raw_G4_UB(pixmap, x, y, pixel, perc);
1515}
1516
1517static inline void gp_mix_pixel_raw_clipped_G8(gp_pixmap *pixmap,
1518 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1519{
1520 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1521 return;
1522
1523 gp_mix_pixel_raw_G8(pixmap, x, y, pixel, perc);
1524}
1525
1526static inline void gp_mix_pixel_raw_clipped_GA88(gp_pixmap *pixmap,
1527 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1528{
1529 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1530 return;
1531
1532 gp_mix_pixel_raw_GA88(pixmap, x, y, pixel, perc);
1533}
1534
1535static inline void gp_mix_pixel_raw_clipped_G16(gp_pixmap *pixmap,
1536 gp_coord x, gp_coord y, gp_pixel pixel, uint8_t perc)
1537{
1538 if (GP_PIXEL_IS_CLIPPED(pixmap, x, y))
1539 return;
1540
1541 gp_mix_pixel_raw_G16(pixmap, x, y, pixel, perc);
1542}
1543
1544
1545static inline void gp_mix_pixel_raw(gp_pixmap *pixmap, gp_coord x, gp_coord y,
1546 gp_pixel pixel, uint8_t perc)
1547{
1548 switch (pixmap->pixel_type) {
1549 case GP_PIXEL_RGB101010:
1550 gp_mix_pixel_raw_RGB101010(pixmap, x, y, pixel, perc);
1551 break;
1552 case GP_PIXEL_xRGB8888:
1553 gp_mix_pixel_raw_xRGB8888(pixmap, x, y, pixel, perc);
1554 break;
1555 case GP_PIXEL_RGBA8888:
1556 gp_mix_pixel_raw_RGBA8888(pixmap, x, y, pixel, perc);
1557 break;
1558 case GP_PIXEL_RGB888:
1559 gp_mix_pixel_raw_RGB888(pixmap, x, y, pixel, perc);
1560 break;
1561 case GP_PIXEL_BGR888:
1562 gp_mix_pixel_raw_BGR888(pixmap, x, y, pixel, perc);
1563 break;
1564 case GP_PIXEL_RGB555:
1565 gp_mix_pixel_raw_RGB555(pixmap, x, y, pixel, perc);
1566 break;
1567 case GP_PIXEL_RGB565:
1568 gp_mix_pixel_raw_RGB565(pixmap, x, y, pixel, perc);
1569 break;
1570 case GP_PIXEL_RGB666:
1571 gp_mix_pixel_raw_RGB666(pixmap, x, y, pixel, perc);
1572 break;
1573 case GP_PIXEL_RGB332:
1574 gp_mix_pixel_raw_RGB332(pixmap, x, y, pixel, perc);
1575 break;
1576 case GP_PIXEL_CMYK8888:
1577 gp_mix_pixel_raw_CMYK8888(pixmap, x, y, pixel, perc);
1578 break;
1579 case GP_PIXEL_P2:
1580 gp_mix_pixel_raw_P2(pixmap, x, y, pixel, perc);
1581 break;
1582 case GP_PIXEL_P4:
1583 gp_mix_pixel_raw_P4(pixmap, x, y, pixel, perc);
1584 break;
1585 case GP_PIXEL_P8:
1586 gp_mix_pixel_raw_P8(pixmap, x, y, pixel, perc);
1587 break;
1588 case GP_PIXEL_G1_DB:
1589 gp_mix_pixel_raw_G1_DB(pixmap, x, y, pixel, perc);
1590 break;
1591 case GP_PIXEL_G2_DB:
1592 gp_mix_pixel_raw_G2_DB(pixmap, x, y, pixel, perc);
1593 break;
1594 case GP_PIXEL_G4_DB:
1595 gp_mix_pixel_raw_G4_DB(pixmap, x, y, pixel, perc);
1596 break;
1597 case GP_PIXEL_G1_UB:
1598 gp_mix_pixel_raw_G1_UB(pixmap, x, y, pixel, perc);
1599 break;
1600 case GP_PIXEL_G2_UB:
1601 gp_mix_pixel_raw_G2_UB(pixmap, x, y, pixel, perc);
1602 break;
1603 case GP_PIXEL_G4_UB:
1604 gp_mix_pixel_raw_G4_UB(pixmap, x, y, pixel, perc);
1605 break;
1606 case GP_PIXEL_G8:
1607 gp_mix_pixel_raw_G8(pixmap, x, y, pixel, perc);
1608 break;
1609 case GP_PIXEL_GA88:
1610 gp_mix_pixel_raw_GA88(pixmap, x, y, pixel, perc);
1611 break;
1612 case GP_PIXEL_G16:
1613 gp_mix_pixel_raw_G16(pixmap, x, y, pixel, perc);
1614 break;
1615 default:
1616 GP_ABORT("Unknown pixeltype");
1617 }
1618}
1619
1620static inline void gp_mix_pixel_raw_clipped(gp_pixmap *pixmap,
1621 gp_coord x, gp_coord y,
1622 gp_pixel pixel, uint8_t perc)
1623{
1624 switch (pixmap->pixel_type) {
1625 case GP_PIXEL_RGB101010:
1626 gp_mix_pixel_raw_clipped_RGB101010(pixmap, x, y, pixel, perc);
1627 break;
1628 case GP_PIXEL_xRGB8888:
1629 gp_mix_pixel_raw_clipped_xRGB8888(pixmap, x, y, pixel, perc);
1630 break;
1631 case GP_PIXEL_RGBA8888:
1632 gp_mix_pixel_raw_clipped_RGBA8888(pixmap, x, y, pixel, perc);
1633 break;
1634 case GP_PIXEL_RGB888:
1635 gp_mix_pixel_raw_clipped_RGB888(pixmap, x, y, pixel, perc);
1636 break;
1637 case GP_PIXEL_BGR888:
1638 gp_mix_pixel_raw_clipped_BGR888(pixmap, x, y, pixel, perc);
1639 break;
1640 case GP_PIXEL_RGB555:
1641 gp_mix_pixel_raw_clipped_RGB555(pixmap, x, y, pixel, perc);
1642 break;
1643 case GP_PIXEL_RGB565:
1644 gp_mix_pixel_raw_clipped_RGB565(pixmap, x, y, pixel, perc);
1645 break;
1646 case GP_PIXEL_RGB666:
1647 gp_mix_pixel_raw_clipped_RGB666(pixmap, x, y, pixel, perc);
1648 break;
1649 case GP_PIXEL_RGB332:
1650 gp_mix_pixel_raw_clipped_RGB332(pixmap, x, y, pixel, perc);
1651 break;
1652 case GP_PIXEL_CMYK8888:
1653 gp_mix_pixel_raw_clipped_CMYK8888(pixmap, x, y, pixel, perc);
1654 break;
1655 case GP_PIXEL_P2:
1656 gp_mix_pixel_raw_clipped_P2(pixmap, x, y, pixel, perc);
1657 break;
1658 case GP_PIXEL_P4:
1659 gp_mix_pixel_raw_clipped_P4(pixmap, x, y, pixel, perc);
1660 break;
1661 case GP_PIXEL_P8:
1662 gp_mix_pixel_raw_clipped_P8(pixmap, x, y, pixel, perc);
1663 break;
1664 case GP_PIXEL_G1_DB:
1665 gp_mix_pixel_raw_clipped_G1_DB(pixmap, x, y, pixel, perc);
1666 break;
1667 case GP_PIXEL_G2_DB:
1668 gp_mix_pixel_raw_clipped_G2_DB(pixmap, x, y, pixel, perc);
1669 break;
1670 case GP_PIXEL_G4_DB:
1671 gp_mix_pixel_raw_clipped_G4_DB(pixmap, x, y, pixel, perc);
1672 break;
1673 case GP_PIXEL_G1_UB:
1674 gp_mix_pixel_raw_clipped_G1_UB(pixmap, x, y, pixel, perc);
1675 break;
1676 case GP_PIXEL_G2_UB:
1677 gp_mix_pixel_raw_clipped_G2_UB(pixmap, x, y, pixel, perc);
1678 break;
1679 case GP_PIXEL_G4_UB:
1680 gp_mix_pixel_raw_clipped_G4_UB(pixmap, x, y, pixel, perc);
1681 break;
1682 case GP_PIXEL_G8:
1683 gp_mix_pixel_raw_clipped_G8(pixmap, x, y, pixel, perc);
1684 break;
1685 case GP_PIXEL_GA88:
1686 gp_mix_pixel_raw_clipped_GA88(pixmap, x, y, pixel, perc);
1687 break;
1688 case GP_PIXEL_G16:
1689 gp_mix_pixel_raw_clipped_G16(pixmap, x, y, pixel, perc);
1690 break;
1691 default:
1692 GP_ABORT("Unknown pixeltype");
1693 }
1694}
1695#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