|
View:
New views
17 Messages
—
Rating Filter:
Alert me
|
|
|
SDL_ConvertSurface losing information on alpha?Hello,
i updated SDL to the latest version on Mac, and i came across the BGR/RGB conversion due to the switch to ImageIO in SDL_image. I found this forum thread that explained very well what to do (even though is was for BMP while i use PNG): http://www.idevgames.com/forum/showpost.php?p=85954&postcount=9 So i used SDL_ConvertSurface() to update the surface that is created from the IMG_Loda() with a proper pixel format SDL_PixelFormat format = {NULL, 32, 4, 0, 0, 0, 0, 0, 8, 16, 24, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000, 0, 255};and normal images were loaded very well! However i noticed that every image that had transparency (eg. faded into the background) was no more transparent!i've tried in any way i knew, but i couldn't make head or tails of this! can anyone help me? Thanks Vittorio -- Pablo Picasso - "Computers are useless. They can only give you answers." _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
Re: SDL_ConvertSurface losing information on alpha?Did you try SDL_DisplayFormatAlpha() instead?
On Wed, Oct 21, 2009 at 8:35 PM, Vittorio G. <vitto.giova@...> wrote: > Hello, > i updated SDL to the latest version on Mac, and i came across the BGR/RGB > conversion due to the switch to ImageIO in SDL_image. > I found this forum thread that explained very well what to do (even though > is was for BMP while i use PNG): > http://www.idevgames.com/forum/showpost.php?p=85954&postcount=9 > > So i used SDL_ConvertSurface() to update the surface that is created from > the IMG_Loda() with a proper pixel format > > SDL_PixelFormat format = {NULL, 32, 4, 0, 0, 0, 0, 0, 8, 16, 24, 0x000000FF, > 0x0000FF00, 0x00FF0000, 0xFF000000, 0, 255}; > > > and normal images were loaded very well! However i noticed that every image > that had transparency (eg. faded into the background) was no more > transparent! > i've tried in any way i knew, but i couldn't make head or tails of this! > > can anyone help me? > Thanks > Vittorio > -- > > Pablo Picasso - "Computers are useless. They can only give you answers." > _______________________________________________ > SDL mailing list > SDL@... > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org > > -- -Sam Lantinga, Founder and President, Galaxy Gameworks LLC _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
Re: SDL_ConvertSurface losing information on alpha?Yes i tried that but perhaps in a wrong way
here's what i tried call SDL_ConvertSurface and then SDL_DisplayFormatAlpha -> switch again red and blue channels (wrong result) directly call SDL_DisplayFormatAlpha -> the red and blue channel are not swapped (wrong result) try to hack the format of the surface loaded with img_load, image.format= convertedFormat -> some very weird color distortion (wrong result) plus in all three cases alpha was not applied i could post images if needed Vittorio On Thu, Oct 22, 2009 at 6:49 AM, Sam Lantinga <slouken@...> wrote: Did you try SDL_DisplayFormatAlpha() instead? -- Joan Crawford - "I, Joan Crawford, I believe in the dollar. Everything I earn, I spend." _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
Re: SDL_ConvertSurface losing information on alpha?have you tried this?
SDL_Surface* tmp; SDL_Surface* img; SDL_PixelFormat f = {0}; SDL_PixelFormatEnumToMasks( SDL_ARRAYORDER_BGRA, /* or SDL_ARRAYORDER_ABGR */ &f.BitsPerPixel, &f.Rmask, &f.Gmask, &f.Bmask, &f.Amask ); /* other format fields are ignored anyway for conversion */ tmp = IMG_Load("myimage.png"); img = SDL_ConvertSurface(tmp, f, 0); SDL_FreeSurface(tmp); /* do stuff with img... */ _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
Re: SDL_ConvertSurface losing information on alpha?i was going to try it but then i discovered it was only for sdl 1.3
i need something compatible in both 1.2 and 1.3 what can i do? vittorio On Fri, Oct 23, 2009 at 5:07 AM, Kenneth Bull <llubnek@...> wrote: have you tried this? -- Stephen Leacock - "I detest life-insurance agents: they always argue that I shall some day die, which is not so." _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
Re: SDL_ConvertSurface losing information on alpha?2009/10/23 Vittorio G. <vitto.giova@...>:
> i was going to try it but then i discovered it was only for sdl 1.3 > i need something compatible in both 1.2 and 1.3 > what can i do? If this doesn't work... SDL_Surface* tmp; SDL_Surface* img; tmp = IMG_Load("myimage.png"); img = SDL_DisplayFormatAlpha(tmp); SDL_FreeSurface(tmp); /* do stuff with img */ ... then check your source image, submit a bug report and use this temporarily: Uint32 tmpmask; tmpmask = img.format.Rmask; img.format.Rmask = img.format.Bmask; img.format.Bmask = tmpmask; (and similar for loss and shift). That is, if red and blue are swapped, swap them back. _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
Re: SDL_ConvertSurface losing information on alpha?I've filed a bug here: http://bugzilla.libsdl.org/show_bug.cgi?id=868
we've discovered that basically alpha works only if alpha color is red... my suspect is that red and alpha channel get somehow swapped during blending Vittorio On Sat, Oct 24, 2009 at 2:22 AM, Kenneth Bull <llubnek@...> wrote: 2009/10/23 Vittorio G. <vitto.giova@...>: -- Joan Crawford - "I, Joan Crawford, I believe in the dollar. Everything I earn, I spend." _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
Re: SDL_ConvertSurface losing information on alpha?On Thu, Oct 29, 2009 at 3:13 PM, Vittorio G. <vitto.giova@...> wrote:
> I've filed a bug here: http://bugzilla.libsdl.org/show_bug.cgi?id=868 > we've discovered that basically alpha works only if alpha color is red... my > suspect is that red and alpha channel get somehow swapped during blending > Vittorio > > On Sat, Oct 24, 2009 at 2:22 AM, Kenneth Bull <llubnek@...> wrote: >> >> 2009/10/23 Vittorio G. <vitto.giova@...>: >> > i was going to try it but then i discovered it was only for sdl 1.3 >> > i need something compatible in both 1.2 and 1.3 >> > what can i do? >> >> If this doesn't work... >> >> SDL_Surface* tmp; >> SDL_Surface* img; >> >> tmp = IMG_Load("myimage.png"); >> img = SDL_DisplayFormatAlpha(tmp); >> SDL_FreeSurface(tmp); >> >> /* do stuff with img */ >> >> .... then check your source image, submit a bug report and use this >> temporarily: >> >> Uint32 tmpmask; >> >> tmpmask = img.format.Rmask; >> img.format.Rmask = img.format.Bmask; >> img.format.Bmask = tmpmask; >> >> (and similar for loss and shift). >> >> That is, if red and blue are swapped, swap them back. >> _______________________________________________ >> SDL mailing list >> SDL@... >> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org >> > > > > -- > > Joan Crawford - "I, Joan Crawford, I believe in the dollar. Everything I > earn, I spend." > _______________________________________________ > SDL mailing list > SDL@... > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org > > hi, Is there a way to build using the normal SDL_image stuff on OSX? Considering this bug, and for consistency with other platforms I'd like to do that. That is probably a good work around for it... if it's possible. cu, _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
Re: SDL_ConvertSurface losing information on alpha?yes, you can still use the old backend but it's not a real solution
plus on the iphone you can't use other backends at all so the problem still applies Vittorio On Thu, Oct 29, 2009 at 7:34 PM, René Dudfield <renesd@...> wrote:
-- Marie von Ebner-Eschenbach - "Even a stopped clock is right twice a day." _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
using SDL_UserEvent with SDL_timerhello:
how can i call a function from a timer using a SDL_UserEvent, i know how this work but what i don't know is how to connect the function to the SDL_UserEvent. _______________________________________________ SDL mailing list SDL@... http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||
|
|
|
| René Dudfield wrote: | ||
On Thu, Oct 29, 2009 at 3:13 PM, Vittorio G. <> wrote:
hi, Is there a way to build using the normal SDL_image stuff on OSX? Considering this bug, and for consistency with other platforms I'd like to do that. That is probably a good work around for it... if it's possible. cu, |
| Free embeddable forum powered by Nabble | Forum Help |