Bitmaps and color shift
Bitmaps and color shift
- Subject: Bitmaps and color shift
- From: Trygve Inda <email@hidden>
- Date: Fri, 28 Mar 2008 11:09:36 +0000
- Thread-topic: Bitmaps and color shift
segImageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:5
pixelsHigh:5
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bitmapFormat:NSAlphaFirstBitmapFormat
bytesPerRow:5 * 4
bitsPerPixel:32];
segBaseAddr = [segImageRep bitmapData];
NSImage * image = [NSImage imageNamed:@"colorNew.png"];
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext
graphicsContextWithBitmapImageRep:segImageRep]];
image drawInRect:NSMakeRect(0,0,5,5) fromRect:NSMakeRect(0,0,5,5)
operation:NSCompositeCopy fraction:1.0];
NSGraphicsContext restoreGraphicsState];
When looking at the source image in PhotoShop (no color management in file),
the first row is (ignoring alpha).
FF FF 00 FF 00 00 00 00 00 00 00 FF FF FF FF
But my bitmap gets:
FE FF 00 F6 00 06 00 00 00 13 00 FF FF FF FF
Why the shift? This is not a jpg file. Is there a better choice over
NSDeviceRGBColorSpace?
Thanks,
Trygve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden