Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » blitting sprites

Credits go to Alex Hanson-White, Jonny Cook, Miles Lombardi, Onewing, and Richard Phipps for helping out!
This thread is locked; no one can reply to it. rss feed Print
 1   2   3   4 
blitting sprites
Money
Member #6,730
December 2005
avatar

here is the orignial sprite.bmp

Alex Hanson-White
Member #6,657
December 2005
avatar

sounds like when you're saving the file it is converting the colors. make sure you are saving it correctly.
What program are you useing to save the image?

Evert
Member #794
November 2000
avatar

Also make sure that you entered the 255,0,255 as RGB and not in some other colourspace (don't know if Paintbrush can do that or not).

Money
Member #6,730
December 2005
avatar

microsoft paint, i save it as 24 bit bmp

count
Member #5,401
January 2005

The image you attached was a 8 bpp image. ???

Money
Member #6,730
December 2005
avatar

ok, attached screenshot*, now i told you, its something with ms paint or something

Richard Phipps
Member #1,632
November 2001
avatar

Try this

EDIT: Too big to attach as a 24-bit bmp.
I'll clip it..

Fladimir da Gorf
Member #1,565
October 2001
avatar

All this trouble while you could just go and save the image as an RGBA PNG and you wouldn't have to worry about pinks, your images would look nicer etc ;) Though you can't do that in Paint anyways.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

Alex Hanson-White
Member #6,657
December 2005
avatar

you shoudl save the file as 16 bit not 24.. because your allegro program is running in 16 bit, so it converts the colors when it runs(because you saved it as a different depth).
or try defineing the graphics mode to 24 bit instead in your allegro code

Richard Phipps
Member #1,632
November 2001
avatar

Try this section of your sprite.bmp file:

Money
Member #6,730
December 2005
avatar

255-0-255 in 16 bit bmp

Richard Phipps
Member #1,632
November 2001
avatar

Did the sprite I changed work for you?

Money
Member #6,730
December 2005
avatar

richard: that worked perfectly, how come i couldn't get it to work, what color was that(rgb)

count
Member #5,401
January 2005

it has to be 255-0-255 in richards image.

probably your ms paint is messing soemthing up.

Richard Phipps
Member #1,632
November 2001
avatar

It's R: 255, G: 0, B: 255 saved as a 24-bit Bmp file.
MS Paint is obviously not saving your image right for one reason or another.

Glad it worked! Now I'm off to bed.

Money
Member #6,730
December 2005
avatar

yea...i said that like 4 times too

is there another program other than ms paint?

Neil Walker
Member #210
April 2000
avatar

Hello,
Check out this, which is basically what Alex is saying: http://www.allegro.cc/manual/api/loading-image-files/set_color_conversion

You are setting 16bit graphics mode, but your picture is 8bit paletted, so on loading the image, the system converts all colours to RGB.

What you need to do is save the image as hi/true colour not 8bit and make sure the background/mask colour is magenta (255,0,255).

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Fladimir da Gorf
Member #1,565
October 2001
avatar

Money, that's clearly not the color you want. How do you get the color and use it? If you've picked the pink from the default palette, you should choose the lighter one, just below the one you've chosen.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

Money
Member #6,730
December 2005
avatar

what is true color mode? 256? 16, 24? i tried all of them, but it won't work with mine :'(

none of those color conversions work

Matthew Leverton
Supreme Loser
January 1999
avatar

If your paint program is operating in 8-bits, then it is quite likely that even if you select (255,0,255) that it will select a different color depending on the palette.

If your image is 16-bit and you select (255,0,255) and save it as a BMP file, it will work with Allegro if you set_color_depth(16).

Summary:

  • Use a 16-bit image

  • Select (255,0,255) as the pink color

  • Save it as a BMP

  • set_color_depth(16) BEFORE setting the graphics

  • masked_blit will now be transparent

Just keep reading that and following it till you get it right.

PS: Truecolor is 24/32 bit and High color is 15/16 bit.

Money
Member #6,730
December 2005
avatar

what bmp did you want me to save it as? my color depth is 16 in my code, so i saved the sprite as a 16 bit bmp and when i ran the exe it was all distored and green

count
Member #5,401
January 2005

Quote:

what bmp did you want me to save it as?

Quote:

Use a 16-bit image

So you should save it as 16 bit bitmap.
It was just a general advice.

Money
Member #6,730
December 2005
avatar

i did everything you said,

but it just showed up as the sprite, but with the background behind it :(

anyone want to remote assistance? please :|

Jonny Cook
Member #4,055
November 2003

Okay, zip your entire project and post it so we can see exactly what is going on.

The face of a child can say it all, especially the mouth part of the face.

count
Member #5,401
January 2005

I guess it has nothing to do with his project, but his paint program. see his attached screenshot of his paint.

It works in 8 bit modus.
I guess it is because the image he is working with is a 8 bpp image.
When he opens it, paint goes to 8 bit modus.

So he can not set the right color.

 1   2   3   4 


Go to: