• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSImage and 8 bit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSImage and 8 bit
      • From: "Robert W. Kuhn" <email@hidden>
References: 
 >NSImage and 8 bit (From: "Robert W. Kuhn" <email@hidden>)

  • Prev by Date: Re: Resizing an image inside a text view
  • Next by Date: Problem with NSConnection between threads and archiving?
  • Previous by thread: NSImage and 8 bit
  • Next by thread: Re: NSImage and 8 bit
  • Index(es):
    • Date
    • Thread