Re: NSImage is a pain
Re: NSImage is a pain
- Subject: Re: NSImage is a pain
- From: "Theodore H. Smith" <email@hidden>
- Date: Thu, 23 Jun 2005 20:58:36 +0100
OK, so I wanted to load an image which had a white background, and
treat that white as transparant. Seems reasonable enough, it's a
common technique used in gif and many file formats.
But no, it's not there.
<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.
--
http://elfdata.com/plugin/ Industrial strength string processing,
made easy.
"All things are logical. Putting free-will in the slot for premises in
a logical system, makes all of life both understandable, and free."
_______________________________________________
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