1al_premul_rgba_f(3)                                        al_premul_rgba_f(3)
2
3
4

NAME

6       al_premul_rgba_f - Allegro 5 API
7

SYNOPSIS

9              #include <allegro5/allegro.h>
10
11              ALLEGRO_COLOR al_premul_rgba_f(float r, float g, float b, float a)
12

DESCRIPTION

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

SINCE

34       5.1.12
35

SEE ALSO

37       al_map_rgba_f(3), al_premul_rgba(3)
38
39
40
41Allegro reference manual                                   al_premul_rgba_f(3)
Impressum