4 Macros to mix two pixels accordingly to percentage.
12 %% for pt in pixeltypes
13 %% if not pt.is_unknown()
15 * Mixes two {{ pt.name }} pixels.
17 * The percentage is expected as 8 bit unsigned integer [0 .. 255]
19 #define GP_MIX_PIXELS_{{ pt.name }}(pix1, pix2, perc) ({ \
20 %% for c in pt.chanslist
21 GP_Pixel {{ c[0] }}; \
23 {{ c[0] }} = GP_Pixel_GET_{{ c[0] }}_{{ pt.name }}(pix1) * (perc); \
24 {{ c[0] }} += GP_Pixel_GET_{{ c[0] }}_{{ pt.name }}(pix2) * (255 - (perc)); \
25 {{ c[0] }} = ({{ c[0] }} + 128) / 255; \
29 GP_Pixel_CREATE_{{ pt.name }}({{ pt.chanslist[0][0] }}{% for c in pt.chanslist[1:] %}, {{ c[0] }}{% endfor %}); \