Transaparent logo. My brain is dead :-(
Bob Bobosky

Please help
I have background and logo ( all 32bit )
My code:
--------------------------------------------
BITMAP *bg,*logo;

set_color_depth(32);
set_palette(desktop_palette);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0);

logo=load_bitmap("logo.bmp",NULL);
bg=load_bitmap("bg.bmp",NULL);
while (1){
blit(bg, buffer, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
masked_blit(logo, buffer, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
blit(buffer,screen ,0, 0, 0, 0, SCREEN_W, SCREEN_H);
if (key[KEY_ESC]){break;}
}
--------------------------------------------

This is my result : http://www.hostfornet.net/vasilevs/problem.htm
I loking in this forum but not found solution ... :-(
Please help

***********
Привет русскoязычным кoдерам планеты ! :-)

umperio

The problem is the shadow is not proper bright pink. For it to be transparent it needs to be exactly 255,0,255. While the shadow you have is a combination of the bright pink with black.

Fladimir da Gorf

The solution: save your image as a 32-bit RGBA image and render it with set_alpha_blender/draw_trans_sprite.

Neil Walker

btw, you don't need set_palette if you're working with 32 bit. If you have 8bit graphics they are dealt with by the colour conversion global.

You could always try the png library extension.

Ceagon Xylas

Bob, use the code tags around your code. You can reference tags by the HTML Mockup Code link at the top of the reply text input.

Bob Bobosky

umperio, I know about this problem but i need shadows etc.

Fladimir da Gorf, I create my images in Photoshop CS 9 . My experience in C very poor ( as my english :-) . And i don't uses BMP files ( i'm PHP/Perl coder over 7 years ) and i don't know how create like this format file :-(
Please look at this 2 bmp files : http://www.hostfornet.net/vasilevs/imgs.zip
It is RGBA image ?
And this my code don't work with these images:-(

1#include <allegro.h>
2BITMAP *logo;
3int main(void)
4{
5 allegro_init();
6 install_timer();
7 install_keyboard();
8 set_color_depth(32);
9 set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0);
10 logo=load_bitmap("logo1.bmp",NULL);
11 set_alpha_blender();
12 draw_trans_sprite(screen, logo, 10, 10);
13 readkey();
14 destroy_bitmap(logo);
15}
16END_OF_MAIN();

Please , show me any working code , may be i understand it (set_alpha_blender,draw_trans_sprite)

Neil Walker, I try libpng but not working
Do you have any working code ?

Thank you all for reply

Fladimir da Gorf

In Photoshop, delete the pink layer (which is probably the surface layer). Then save your image as a .tga instead of .bmp.

Bob Bobosky

This picture in this format ?
http://www.hostfornet.net/vasilevs/logo.tga

Fladimir da Gorf

Yeah, but you need to make the background translucent (thus, delete background layer).

Bob Bobosky

I make picture but without background translucent :-(
Please, look at my steps: http://www.hostfornet.net/vasilevs/photoshop/photoshop.htm

What is wrong i do ?

Fladimir da Gorf

Ah yeah, Photoshop can't save RGBA .tga files. Well, .png files are better anyways and they work with Photoshop, but you'll need loadpng, libpng and libz -libraries to load them in your game.

Inphernic
Quote:

Ah yeah, Photoshop can't save RGBA .tga files.

It can.

Bob Bobosky

GIMP Forever :-)

Amen ! :-))

Thank you !

LordHolNapul

To create a Trasluncent TGA with photoshop you must do as I say below:

- Create your 32RGB color Bitmap, ad be sure to have upon your sprite ;)

- Look (down right) for the LEVEL manager , that is a popup with all the levels you create for yor image.

- Select in this popup window the "RGB level manager". This manager should discrimiate your bitmap in the 3 color level, and you should see the RGB selection that return to all color RGB . ok, this is not so important...

- below click the icon to create a new RGB level. Automatically you will obtain a level called ALPHA. This is your level. select it, and draw Black or White if you want transparency or opacity upon your picture.

- Save this image as TGA 32 bit = 8 bit for Red/Green/Blue and 8 for alpha... 32!

- Use the Allegro command draw_trans_sprite() and you will obtain 32 transparency images.

- I used Photoshop 6.

My game has been done like this.
Ciao

Thread #581147. Printed from Allegro.cc