[SDL] new SDL_image on MacOSX loads PNG different than earlier
Vittorio Giovara
vitto.giova at yahoo.it
Tue Jan 3 14:33:51 PST 2012
IIRC, this is because using imageio requires to have the alpha channel
premultiplied.
The fix proposed did this, but negleted byte precision information: see
http://bugzilla.libsdl.org/show_bug.cgi?id=868
If you ever try out Eric's changes do let us know :)
Vittorio
On Mon, Dec 26, 2011 at 12:37 PM, albert <albzey at gmail.com> wrote:
> **
> This is the png:
>
> https://github.com/albertz/openlierox/raw/0.59/share/gamedir/data/gfx/font.png
>
> The code for checking is basically:
>
>
>
>
> Code:
>
>
> void DumpPixelFormat(const SDL_PixelFormat* format) {
> std::ostringstream str;
> str << "PixelFormat:" << std::endl
> << " BitsPerPixel: " << (int)format->BitsPerPixel << ","
> << " BytesPerPixel: " << (int)format->BytesPerPixel << std::endl
> << " R/G/B/A mask: " << std::hex
> << (uint)format->Rmask << "/"
> << (uint)format->Gmask << "/"
> << (uint)format->Bmask << "/"
> << (uint)format->Amask << std::endl
> << " R/G/B/A loss: "
> << (uint)format->Rloss << "/"
> << (uint)format->Gloss << "/"
> << (uint)format->Bloss << "/"
> << (uint)format->Aloss << std::endl
> << " Colorkey: " << std::hex << (uint)format->colorkey << ","
> << " Alpha: " << std::dec << (int)format->alpha;
> cout << str.str() << endl;
> }
>
> void DumpSurface(SDL_Surface* s) {
> DumpPixelFormat(s->format);
> for(int y = 0; y < MIN(10, s->h); ++y) {
> for(int x = 0; x < MIN(10, s->w); ++x)
> printf(" %.8X", GetPixel(s, x, y));
> printf("\n");
> }
> }
>
> void load() {
> SDL_Surface* img= IMG_Load("font.png");
> DumpSurface(img);
> }
>
>
>
>
> And this is the output:
>
>
>
>
> Code:
>
>
> PixelFormat:
> BitsPerPixel: 32, BytesPerPixel: 4
> R/G/B/A mask: ff0000/ff00/ff/ff000000
> R/G/B/A loss: 0/0/0/0
> Colorkey: 0, Alpha: 255
> 00000000 00000000 00000000 00000000 FF1514F4 00000000 00000000 00000000
> 00000000 00000000
> 00000000 00000000 00000000 00000000 FF1514F4 00000000 00000000 00000000
> 00000000 00000000
> 00000000 00000000 00000000 00000000 FF1514F4 00000000 00000000 00000000
> 00000000 00000000
> 00000000 00000000 00000000 00000000 FF1514F4 18000000 ED000000 00000000
> 00000000 00000000
> 00000000 00000000 00000000 00000000 FF1514F4 18000000 ED000000 00000000
> 00000000 00000000
> 00000000 00000000 00000000 00000000 FF1514F4 18000000 ED000000 00000000
> 00000000 00000000
> 00000000 00000000 00000000 00000000 FF1514F4 18000000 ED000000 00000000
> 00000000 00000000
> 00000000 00000000 00000000 00000000 FF1514F4 18000000 ED000000 00000000
> 00000000 00000000
> 00000000 00000000 00000000 00000000 FF1514F4 00000000 00000000 00000000
> 00000000 00000000
> 00000000 00000000 00000000 00000000 FF1514F4 00000000 00000000 00000000
> 00000000 00000000
>
>
>
>
> Earlier, the value FF1514F4 has been FF0000FF. Gimp also shows FF0000FF at
> this place. Seashore and other applications show FF1514F4. When I load the
> image via libgd, I also get FF0000FF.
>
> This might be an issue in ImageIO. Or maybe some color profile thingie.
>
> Any idea?
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20120103/adb9c996/attachment.htm>
More information about the SDL
mailing list