1al_premul_rgba(3)                                            al_premul_rgba(3)
2
3
4

NAME

6       al_premul_rgba - Allegro 5 API
7

SYNOPSIS

9              #include <allegro5/allegro.h>
10
11              ALLEGRO_COLOR al_premul_rgba(
12                 unsigned char r, unsigned char g, unsigned char b, unsigned char a)
13

DESCRIPTION

15       This is a shortcut for al_map_rgba(3)(r * a / 255, g * a / 255, b * a /
16       255, a).
17
18       By default Allegro uses pre-multiplied alpha for  transparent  blending
19       of bitmaps and primitives (see al_load_bitmap_flags(3) for a discussion
20       of that feature).  This means that if you want  to  tint  a  bitmap  or
21       primitive  to  be transparent you need to multiply the color components
22       by the alpha components when you pass them to this function.  For exam‐
23       ple:
24
25              int r = 255;
26              int g = 0;
27              int b = 0;
28              int a = 127;
29              ALLEGRO_COLOR c = al_premul_rgba(r, g, b, a);
30              /* Draw the bitmap tinted red and half-transparent. */
31              al_draw_tinted_bitmap(bmp, c, 0, 0, 0);
32
33       This function can be called before Allegro is initialized.
34

SINCE

36       5.1.12
37

SEE ALSO

39       al_map_rgba(3), al_premul_rgba_f(3)
40
41
42
43Allegro reference manual                                     al_premul_rgba(3)
Impressum