Re: Mutable NSColor?
Re: Mutable NSColor?
- Subject: Re: Mutable NSColor?
- From: Rob Rix <email@hidden>
- Date: Mon, 24 Sep 2001 09:33:28 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Come on. I guess that is a reason strong enough to redesign the API.
Err...not really. I need to perform math on colour instances. I can't do
that by means of a simple category (because not even the header reveals
how to set colour values...probably because it's such a versatile class),
nor can I figure out how to make a mutable subclass of NSColor, even
though the docs talk about doing just that.
I would really rather not force users of my framework to either handle the
math themselves or update their pointers every time they call -addColor:
Or, if the worst came to the worst, what about this (unfinished and
untested) pattern:
As I just mentioned to Rick, I ended up just making a really simple
(five-minute code, like) class which manages four floats (r, g, b, a) and
can translate to and from NSColor. Only real difference is that mine isn't
as versatile (no CMYK, et cetera), and mine is mutable.
Again, I'd _like_ to be able to integrate as closely as possible with
Foundation and AppKit, and I am in fact doing that in several places
already. Unfortunately, the closest I seem to be able to get with colours
is the solution I just mentioned.
- -- Rob
Flying is not difficult. Surviving the landing is difficult.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (Darwin)
Comment: For info see
http://www.gnupg.org
iD8DBQE7rzYqnZTWcucI1tgRAq0QAKDJAhNihrg6w8j87QaW2934pFTNZQCghv4L
QXx/wPLvNDQdcLJ4KJl/thA=
=/knp
-----END PGP SIGNATURE-----