Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Change images colors

This thread is locked; no one can reply to it. rss feed Print
Change images colors
Flávio Silva
Member #16,886
August 2018

Please, i need changing images colors. For exemplo, I need change my IMAGE.JPG to green. I need get two images to do anaglyph, is possible with Allegro?

How do it?

Frank Drebin
Member #2,987
December 2002
avatar

Maybe 'al_draw_tinted_bitmap' is what you are lookig for?

Flávio Silva
Member #16,886
August 2018

Hi, tks for your comment but I used this command. It return an image original and tinted in the same. How separate both and save only the tinted?

The image is attached and the code is below:

ALLEGRO_BITMAP *bmp = NULL;
char path[256] = "C:\\Dev\\ProgVisualizarEstereo\\";
strcpy(cta, path);
sprintf(numero, "I1");
strcat(cta, numero);
strcat(cta, ".jpg");
sprintf(filename, "%s", cta);
bmp = al_load_bitmap(filename);
al_draw_tinted_bitmap(bmp, al_map_rgb(255, 0, 0), 0, 0, 0);
al_draw_scaled_bitmap(bmp, 150, 150, 4608, 2592, 400, 100, 2100, 1300, 0);
al_flip_display();
al_destroy_bitmap(bmp);

William Labbett
Member #4,486
March 2004
avatar

It sounds like you want to save a bitmap with

al_save_bitmap();

<code>
/* Make a bitmap to save. */

ALLEGRO_BITMAP *bitmap_to_save = al_create_bitmap(....,....);

al_set_target_bitmap(bitmap_to_save);

/* draw tinted bitmap to bitmap_to_save : */

al_draw_tinted_bitmap(bmp, al_map_rgb(255, 0, 0), 0, 0, 0);

then al_save_bitmap();

Go to: