home *** CD-ROM | disk | FTP | other *** search
- Subject: ODF's Color Model
- Sent: 5/23/96 8:54 PM
- Received: 5/24/96 8:49 AM
- From: Martin Sandberg, msandber@Sigma4.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- While working on a 3-d icon for ODF, I ran into a problem with the color
- handling in ODF, specifically with FW_SColor (in <SLColor.h> of DR5). The
- internal representation is (by inference & reverse engineering, the
- documentation is unhelpful on this issue) as a single long, with the red, green
- and blue intensitites encoded as bytes from least toward most significant.
-
- However, there is a hole in the following snip from SLColor.h:
-
- struct FW_SColor
- {
- unsigned long fRGB;
- };
-
- #define FW_RGB(r, g, b) (((unsigned long)(r)) | ((unsigned long)(g) << 8) |
- ((unsigned long)(b) << 16))
-
- inline void FW_SetRGB(FW_SColor& color, short r, short g, short b)
- {
- color.fRGB = FW_RGB(r, g, b);
- }
-
- inline unsigned char FW_RGB_R(FW_SColor color)
- {
- return (unsigned char) (color.fRGB);
- }
-
- inline unsigned char FW_RGB_G(FW_SColor color)
- {
- return (unsigned char) (color.fRGB >> 8);
- }
-
- inline unsigned char FW_RGB_B(FW_SColor color)
- {
- return (unsigned char) (color.fRGB >> 16);
- }
-
- The inlines FW_RGB_R, ...G, and ...B clearly show an intent to encode
- the RGB values as 8-bit (uchar) intensities. Unfortunately, the setting inline
- function FW_SetRGB uses the value-setting macro FW_RGB with short values
- for r, g, and b. If one looks at the Set function's interface, which is
- reflected upward to _all_ color classes and their interfaces, one is lead to
- believe that 16-bit (i.e., Mac-like) color values are supported. This is not
- the case, unfortunately. Although the parameters are shorts, only values in
- the range 0..255 will work _correctly_. All others _will_ result in incorrect
- colors being encoded in the ulong fRGB.
- It sure would have been nice to see a proper interface, using unsigned char's
- as the parameters, for setting rgb values. This would have been clear and
- unambiguous and _correct_ in every sense. The current system is none of those
- desirable characteristics. But this would only mask a deeper problem with
- ODF's color model.
- I consider the basic ODF color representation (a single unsigned long
- _encodoing_ of an 8-bit rgb color model) to be inadequate. For example, SGI
- is now shipping a (medical imaging) system using triple 12-bit DAC's, requiring
- at least 36-bit representations of colors. Then there is the Pantone Corp.'s
- Hexachrome (tm) hi-fi color system, with 6 color intensities. How do we encode
- this system in 32 bits? Hmmm? 5-bit intensities?
- We need to fix this color model problem _now_, before so much code is
- written on the existing model that resistance to change becomes insurmountable.
- If ODF intends to provide a platform-independent imaging model, it cannot and
- must not rely upon a lowest-common-denominator approach, it must support a
- model that is powerful enough to support the most powerful existing models and
- allow for future growth in imaging technology. I believe that this requires,
- among other things, a 48-bit or greater color model.
-
- While I'm in rant mode, I'd like to take a shot at the available ODF
- documentation. Sure, ODF is a work in progress, but is that any excuse not to
- write meaningful comments in the code? Remember, ODF source code must be
- read and understood by (hopefully tens of) thousands of programmers. Getting
- all these people enthusiastic about ODF requires that we not have to work _too_
- hard to understand it. The ODF Class Reference (ODFCR) is only about 2/3
- written, and even that is (necessarily, I realize) not fully up to date. How
- am I supposed grok the essence (let alone the fullness) of anything in the
- framework layer when there is _no_ data in the ODFCR (at least the useable one
- in Quickview form) on the Framework layer? I frankly don't have the spare time
- to waste thrashing thru the engineering notes, the development notes and other
- random possible sources to try to find prose explanations for why some things
- are done the way they are. If such explanations exist except inside some
- already overworked Apple programmer's head.
- I guess my complaint is that while ODF may grow into a really useful way to
- do OpenDoc parts, it will be a hard sell to the programmer community unless it
- is easier to use and understand. That means (shudder <G>) documentation.
- Otherwise, the Direct to SOM folks will win the "hearts and minds" battle,
- justifiably.
-
- ODF has a lot of potential, but it is a tool and the usability of any complex
- tool is highly dependant on its documentation. Consider this a plea for some
- additional efforts in that area.
-
- Martin, Bill & the Sigma 4 gang
-
-