1draw_trans_sprite(3)            Allegro manual            draw_trans_sprite(3)
2
3
4

NAME

6       draw_trans_sprite  -  Draws  a sprite blending it with the destination.
7       Allegro game programming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       void draw_trans_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y);
14

DESCRIPTION

16       Uses the global color_map table or truecolor blender functions to over‐
17       lay  the  sprite  on  top of the existing image. This must only be used
18       after you have set up the color mapping table (for 256-color modes)  or
19       blender functions (for truecolor modes). Because it involves reading as
20       well as writing the bitmap memory, translucent drawing is very slow  if
21       you  draw  directly to video RAM, so wherever possible you should use a
22       memory bitmap instead. Example:
23
24          /* Some one time initialisation code. */
25          COLOR_MAP global_trans_table;
26          create_trans_table(&global_trans_table, my_palette,
27                             128, 128, 128, NULL);
28          ...
29          if (get_color_depth() == 8)
30             color_map = &global_trans_table;
31          else
32             set_trans_blender(128, 128, 128, 128);
33
34          draw_trans_sprite(buffer, ghost_sprite, x, y);
35
36       The bitmap and sprite must normally be in the same color depth, but  as
37       a special case you can draw 32 bit RGBA format sprites onto any hicolor
38       or truecolor bitmap, as long as you call set_alpha_blender() first, and
39       you can draw 8-bit alpha images onto a 32-bit RGBA destination, as long
40       as you call  set_write_alpha_blender()  first.  As  draw_sprite()  this
41       function  skips  transparent  pixels, except if the source sprite is an
42       8-bit image; if this is the case, you should pay attention to  properly
43       set up your color map table for index 0.
44
45

SEE ALSO

47       draw_sprite(3),      draw_lit_sprite(3),      draw_trans_rle_sprite(3),
48       color_map(3),        set_trans_blender(3),        set_alpha_blender(3),
49       set_write_alpha_blender(3),      bitmap_mask_color(3),      exalpha(3),
50       exblend(3), exlights(3), exrotscl(3), extrans(3), exxfade(3)
51
52
53
54Allegro                          version 4.4.2            draw_trans_sprite(3)
Impressum