As you noted "and so on." is in there, the likes of which is never good for docs IMO. However I think your missing two key parts... one "you may need to explicitly set features of the new REPRESENTATION" this implies setting values for the NSImageRep not the NSImage which contains it.
Also the second sentence after "and so on.", "See NSImageRep and it's subclasses for the methods you use to complete initialization." This is pretty self explaining IMHO.
So I think the problem is a simple misunderstanding of the docs, where you were thinking you need to set the NSImage settings you in fact may* need to set the NSImageRep settings to help finalize it's initialization.
*may, because you don't always have to set NSImageRep settings to have a valid NSImageRep to use. The docs state this in the second line "...you MAY need to explicitly set features..."
On Jun 23, 2005, at 3:58 PM, Theodore H. Smith wrote:
<newbie rant snipped>
Face it, learning new things takes time - especially things that are
worth learning. Some things you just can't rush, and grokking a new
framework is one of them. You need to allow it some time to sink in.
OK. Let me express it in a non-rant manner.
The docs do not explain how to to create an NSImage from an NSImageRep. The closest it comes to saying how to do this, says "and so on". Which is vague.
"After invoking this method, you may need to explicitly set features of the new representation, such as size, number of colors, and so on."
"allow it some time to sink in". This requires material to sink in. Mostly there is the material to sink in. And so yep, I'm doing that.
I've just noted how in this particular case, there is a hole in Apple's material (the "and so on" hole), and there is nothing to sink in.
What do you suggest then? I looked on google. I looked on cocoadev.com
Experiment on setting stuff?
I count 12 "set" methods that could be set in NSImage. How do I find out the right combination without doing it in excess? Use some kind of binary search technique with combinations of set methods?
What is the problem is not in setting methods in NSImage? I could have done all that experimentation and end up with nothing.
Let me make this simple and clear. The docs are lacking on [NSImage addRepresentation].
One of my other points, is that the Cocoa framework does not appear as well designed as I would have made it. For example: [NSImageRep colorAtX:(int)x y:(int)y] Do you see any design flaws in such a method?
For someone who really appreciates good design, Cocoa's colorAtX:y: method does not make me feel comfortable. I see good design in most of the Cocoa classes I've come across. NSImage/NSImageRep are two that I do not see good design, they are in the minority by far, of course.
To me, an example of good design, is NSString's file path methods. They do what you want, do it well, are clearly designed, and take on a task that is awkward for most software developers yet most software developers do need. GREAT. Exactly correct design.
NSImage/NSImageRep however, I can see many design problems there.