• 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
NSImage question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSImage question


  • Subject: NSImage question
  • From: Hussein Yahia <email@hidden>
  • Date: Fri, 22 Jul 2005 16:25:16 +0200

hello list,

What is the standard way of creating a NSImage from raw data ? I mean, I have a raw image, in the form of say, of a collection of bytes organized in a NSData object. How to create an NSImage from this ?

There is a method of class NSImage called - (id)initWithData:(NSData *)data but I don't understand how to specify the size of the image, the number of bits per pixel etc.

So I suppose the standard way is the following:

1- create a NSImage with [NSImage initWithSize:size];
2- Add an NSImageRep by specifying the number of bits per pixels etc.
3- Create an NSBitmapImageRep with method initWithData and add it to the NSImageRep.


Am I right doing that ? Will the NSBitmapImageRep initWithData correctly read from the NSData object knowing the size, number of bits per pixels etc. specified before ? Or is the standard way completely different ? I don't understand very well the documentation about that matter.

Thank you

h. yahia


_______________________________________________ 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 question
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: More information about KVC, KVO, and KVB
  • Next by Date: Re: NSTableView column order in Interface Builder
  • Previous by thread: More information about KVC, KVO, and KVB
  • Next by thread: Re: NSImage question
  • Index(es):
    • Date
    • Thread