colorizeByMappingGray doesn't like bitmap format
colorizeByMappingGray doesn't like bitmap format
- Subject: colorizeByMappingGray doesn't like bitmap format
- From: Ron Wagner <email@hidden>
- Date: Mon, 20 Oct 2003 12:28:41 -0400
I am trying to use colorizeByMappingGray on a NSBitmapImageRep and get
a message printed to the console that says "Can't deal with image
format".
Here is some code:
NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:(unsigned char**)&planes
pixelsWide:width
pixelsHigh:height
bitsPerSample:8
samplesPerPixel:1
hasAlpha:NO
isPlanar:NO
colorSpaceName:NSDeviceBlackColorSpace
bytesPerRow: rowBytes bitsPerPixel:8];
if ( imageRep ) {
[imageRep colorizeByMappingGray:0.5 toColor:[NSColor redColor]
blackMapping:[NSColor redColor] whiteMapping:[NSColor whiteColor]];
[image addRepresentation:imageRep];
[imageRep release];
}
The NSImage works fine when drawn into the window, but doesn't get
colorized. Does anyone see any problems with what I am doing, or is
there an easier way to draw a 1 bit bitmap as a specific RGB color.
Yes, I meant 1 bit. I am converting my image data from 1 bit to 8 bit
before creating the imageRep above, but my original data starts out
life as 1 bit. I will also be compositing multiple layers of these
NSImages on top of each other as well. The white part of the image
should be transparent.
Thanks,
Ron Wagner
_______________________________________________
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.