0

I use masked_blit() in my program to display a .bmp with transparency (using perfect pink). But when I build, it says :

error: ‘masked_blit’ was not declared in this scope

I included Allegro's .h, and of course I didn't forgot all of these:

-lallegro -lallegro_font -lallegro_ttf -lallegro_image

here is an excerpt of the code I wrote :

#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
[...]
 head = al_load_bitmap("head.bmp");
 masked_blit(head, display, 0,0,0,0,10,10);
 al_clear_to_color(al_map_rgb(0,0,0));
 al_draw_bitmap(head, screen_w / 2, screen_h / 2, 0);
[..]
Matthew
  • 47,584
  • 11
  • 86
  • 98
Elanore
  • 3
  • 1

1 Answers1

3

masked_blit is Allegro 4 function. It does not exist in Allegro 5.

Here are graphics functions in Allegro 5

al_draw_bitmap_region is the most similiar function to masked_blit, but transparency rules are different (8-bit alpha channel vs 1-bit pink color as alpha).

al_convert_mask_to_alpha(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR mask_color) may be useful here.

milleniumbug
  • 15,379
  • 3
  • 47
  • 71
  • 1
    All Allegro 5 functions begin with `al_`, so it should be easy to tell when you are looking at Allegro 4 code, docs, tutorials, etc. – Matthew Mar 19 '13 at 01:01