Question

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);
[..]
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top