URL:
  <http://savannah.gnu.org/bugs/?34740>

                 Summary: gnustep has problems with PNGs that have a sRGB
colorspace
                 Project: GNUstep
            Submitted by: julian_
            Submitted on: Do 03 Nov 2011 18:40:29 GMT
                Category: Gui/AppKit
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

i've problem with gnustep and PNGs in sRGB colorspace.

i do not know if these pictures display fine e.g. in NSImageViews, but i know
that obtaining raw pixel data from  sRGB-PNG => NSImage => NSBitmapImageRep =>
bitmapData is broken.

i am using the following code for extracting raw pixel data out of PNGs and it
works fine for the attached picture OK.png (256x256) but not for the picture
BUG.png (256x256, sRGB):


            NSImage *theImg = [[NSImage alloc] initWithContentsOfURL:_url];
            NSBitmapImageRep *bitmap = [NSBitmapImageRep alloc];
            NSSize imgSize = [theImg size];
            width = imgSize.width;
           height = imgSize.height;
            NSImageRep *rep = [theImg bestRepresentationForDevice: nil];
            [theImg lockFocus];
            [rep drawInRect:NSMakeRect(0,0,[theImg size].width, [theImg
size].height)];
            [bitmap initWithFocusedViewRect:NSMakeRect(0.0, 0.0,
imgSize.width, imgSize.height)];
            [theImg unlockFocus];
            int bpp = [bitmap bitsPerPixel] / 8;
            const int rowsize = width * bpp;
            _data = (char *)calloc( rowsize * height, 1);
            memcpy(_data, [bitmap bitmapData], width * bpp * height);


if you want i can create a more complete test-case e.g. a full application
that loads two 2x2 PNGs but i am not sure this is necessary and it would take
some time




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Do 03 Nov 2011 18:40:29 GMT  Name: OK.png  Size: 16kB   By: julian_

<http://savannah.gnu.org/bugs/download.php?file_id=24293>
-------------------------------------------------------
Date: Do 03 Nov 2011 18:40:29 GMT  Name: BUG.png  Size: 34kB   By: julian_

<http://savannah.gnu.org/bugs/download.php?file_id=24294>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34740>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/


_______________________________________________
Bug-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to