FROM : Marcel Weiher
DATE : Mon Nov 29 21:13:25 2004
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_removed> www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
DATE : Mon Nov 29 21:13:25 2004
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_removed> www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
| Related mails | Author | Date |
|---|---|---|
| Robert W. Kuhn | Nov 25, 15:29 | |
| Marcel Weiher | Nov 29, 21:13 | |
| Robert W. Kuhn | Nov 30, 09:26 | |
| Marcel Weiher | Nov 30, 11:56 |






Cocoa mail archive

