TIFFRepresentation alpha channel inverted???
TIFFRepresentation alpha channel inverted???
- Subject: TIFFRepresentation alpha channel inverted???
- From: Uli Kusterer <email@hidden>
- Date: Wed, 23 Jul 2003 05:18:49 +0200
Hi,
I have bitmap data that consists of two 1-bit bitmaps, the second one
being a mask (black = opaque, white = transparent). I load these into
an NSImage by using:
planes[0] = (char*) [myData bytes]; // myData is a class member.
planes[1] = planes[0] + (4 * 32); // 32 lines a 4 bytes.
bir = [[[NSBitmapImageRep alloc] autorelease]
initWithBitmapDataPlanes:planes
pixelsWide:32 pixelsHigh:32
bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES
isPlanar:YES colorSpaceName:NSCalibratedBlackColorSpace
bytesPerRow:4 bitsPerPixel:1];
[theImage addRepresentation:bir];
So far everything works swell. The NSImage draws perfectly. However,
later, I save it using:
NSImage* img = (NSImage*) contextInfo;
NSData* data = [img TIFFRepresentation];
[data writeToFile:[sheet filename] atomically: YES];
The resulting file shows up empty in Preview.app, and in Photoshop I
see that the alpha channel seems to be reversed. The areas I want to be
opaque are transparent, and vice versa. Anybody know why this only
occurs when saving, but not during display in my app (in an
NSImageView)?
Thanks for any clues and cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.