• 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 is a pain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage is a pain


  • Subject: Re: NSImage is a pain
  • From: Lee Morgan <email@hidden>
  • Date: Thu, 23 Jun 2005 16:22:18 -0400

I think the problem isn't so much with the docs, but rather with the way your reading them. Allow me to _fully_ quote the docs for NSImage addRepresentation
<quote>
Adds imageRep to the receiver’s list of representations. After invoking this method, you may need to explicitly set features of the new representation, such as size, number of colors, and so on. This fact is true in particular if the NSImage has multiple image representations to choose from. See NSImageRep and its subclasses for the methods you use to complete initialization.
</quote>
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..."

- Lee


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.
 _______________________________________________
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 is a pain
      • From: Scott Anguish <email@hidden>
References: 
 >Re: NSImage is a pain (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: String conversion help.
  • Next by Date: Re: String conversion help.
  • Previous by thread: Re: NSImage is a pain
  • Next by thread: Re: NSImage is a pain
  • Index(es):
    • Date
    • Thread