Re: NSImage and 8 bit
Re: NSImage and 8 bit
- Subject: Re: NSImage and 8 bit
- From: Marcel Weiher <email@hidden>
- Date: Mon, 29 Nov 2004 20:13:25 +0000
On 25 Nov 2004, at 14:29, Robert W. Kuhn wrote:
can NSImage not handle grayscale (8 bit) images?
Try using NSBitmapImageRep directly, the code you are using may or may
not do what you're thinking.
with
-(NSBitmapImageRep*)bitmapImageRep
{
NSArray *reps=[self representations];
NSEnumerator *enumerator = [reps objectEnumerator];
id obj;
NSBitmapImageRep *bir=nil;
// cycle through the image reps until we find a suitable one
while ((obj = [enumerator nextObject])) {
bir=nil;
if([obj isKindOfClass: [NSBitmapImageRep class]]) {
bir=(NSBitmapImageRep *)obj;
break;
}
}
return bir;
}
This is probably a cached representation, so you are getting the depth
of the bitmap cache. The last time I checked NSImage discards the
original data unless you tell it to -setDataRetained:YES.
And it seems that the cached representations are "kinds of"
NSBitmapImageRep these days.
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden