SDL RWops and png |
mandarx
|
Hello
does SDL RWops work with png files? I,ve read this tutorial. http://gpwiki.org/index.php/C:Displaying_a_Bitmap_from_a_Custom_Resource_File_using_SDL_RWops It works if you load bmps...
...but how to load a png or a jpg from memory? MandarX |
|||||||||||||
|
nfries88
|
With SDL_image, yes.
But core SDL package only provides facilities for bitmaps. Look here: http://www.libsdl.org/projects/SDL_image/docs/SDL_image_12.html |
|||||||||||
|
mandarx
|
thanks!! |
|||||||||||||
|
mandarx
|
if I use this code
I get the png correctly blitted on the screen when I blit it if I load it in this way:
the png seems to lose the alpha channel Is there a way to preserve the alpha channel using SDL_RWFromMem ?? MandarX |
|||||||||||||||||
|
nfries88
|
SDL 1.2 does not support alpha channels, it at most supports color keys (a color that represents full transparency).
|
|||||||||||
|
SDL RWops and png |
Jeremiah
Guest
|
Then what is SDL_SRCALPHA for?
On Tue, Mar 2, 2010 at 12:40 PM, nfries88 wrote:
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Re: SDL RWops and png |
SDL RWops and png |
Jonny D
|
It does support per-pixel alpha. It does not support much in the way of blending modes. Destination alpha is preserved, so if you alpha blend to a transparent region on an RGBA surface, then you can't see the result. Maybe this has happened to you?
Jonny D On Tue, Mar 2, 2010 at 2:26 PM, nfries88 wrote:
|
|||||||||||||
|
Re: SDL RWops and png |
nfries88
|
No. maybe I just did something wrong. I didn't really need it and ended up just using the colorkey anyway. |
|||||||||||||
|
mandarx
|
YES!!!!! because I used image = SDL_DisplayFormat(temp); instead of image = SDL_DisplayFormatAlpha(temp); it works now !! |
|||||||||||||||
|