Re:“Your program is stupid. It doesn't work,” my wife told m...
by rudedogg on Saturday November 26, 2016 @03:09AM
(#13042453)
Thanks for explaining that, it makes sense. I ended up writing my own Color struct to store the values in HSB like you suggest.
It's odd I couldn't find information about this anywhere. The NSColor/UIColor docs don't mention it, but there is a clue I guess. They note that NSColor/UIColor is stored as CGColor internally, and CGColor doesn't have an HSB init.
Thanks again, I searched everywhere for the answer to this.
Re:“Your program is stupid. It doesn't work,” my wife told m...
by eridius on Monday November 28, 2016 @04:02PM
(#13058383)
More specifically, UIColor and NSColor store a reference to a colorspace and a set of components (plus alpha). The colorspace defines the number of components and their meaning. So all of the RGB colorspaces define 3 components, Red, Green, and Blue, which means UIColor and NSColor need to store the color using those 3 components (plus alpha) whenever they're using an RGB colorspace.
So basically, if you're writing an application that exposes HSB colors to the user, you should be storing the HSB values yourself rather than relying on UIColor/NSColor to preserve them, because it won't.