Date: Thu, 31 Mar 1994 07:46:27 -0800
From: "Robert W. Kieffer" <kieffer@gemstone.com>
To: next-icon@gun.com
Subject: Creating "Hypercolors" (A How To Guide)
Reply-To: kieffer@gemstone.com

Gang,

David Hamiltons Golden-egg challenge has prompted me to post the solution to one of the more intriguing icon problems I've run across...

(BTW David, thanks for the entertainment... I'll see what challenges I can come up with)

I'm sure many of you have seen the "X-Ray" tiff floating around that does wierd stuff when dragged over other images and wondered what was going on.  I inadvertantly discovered the answer and have since then done a little hacking around with the phenomenon.

The X-Ray tiff uses a phenomenon that I've termed, somewhat presumptiously, as "Hypercolor".  A hypercolor exists as a result of the fact that transparent images have their RGB values pre-multiplied by the alpha value.  This is presumably to speed up the compositing operations.  In other words, if a pixel has an alpha value of 93, the largest valid value for the RGB channels is 93.  Anything larger then the alpha value (i.e. "really, really, red"... hence the term "hypercolor") sometimes results in an overflow when the compositing operations are performed, giving the X-Ray effect.  In any case, the results when using hypercolors are "undefined".

So, for those of you that are curious and want to play around with this phenomenon, I've hacked together a utility, "WierdTiff.m", that will take a 24-bit, RGB image, and replace the totally transparent regions with the RGB-Alpha combination of your choice. In an attempt to stay within the size constraints of this mailing list, I've included just the source, no executable.

From the source header:

// This software is entered into the public domain.  Any copies of
// this software or software derived from this software, in part or
// whole, should include this header text.  Distribution of this software
// is restricted to non-profit purposes only.
//
// <Standard disclaimer> - This application is intended for recreational
// use only.  The author is not responsible for damage of any type
// resulting from it's use.
//
// To compile:cc -ObjC WierdTiff.m -o WierdTiff -g -lm -lMedia_s -lNeXT_s
//
// Author: Robert Kieffer
//
// WierdTiff.m...
// An application for screwing with the transparent regions of an image.
// This app will replace regions of alpha = 0 with the color specified by
// the red, green, blue, and alpha values supplied. These values should
// be between 0 and 255.  The most interesting results occur when the red,
// green, or blue values are greater than alpha... "Hypercolors".
//
// Be forewarned, the input image must be a 24-bit, alpha, RGB, meshed-format,
// TIFF.  (a standard 24-bit TIFF with alpha).

(WierdTiff directory)

The .dir.tiff icon was created using "WierdTiff Wierd.tiff .dir.tiff 255 255 255 127".

A suggestion from Alex B. Cone, of Objective Technologies:
	"Try creating a hypercolor image and using that as a pattern in WetPaint"

Have Fun!!!

---
Robert Kieffer - kieffer@gemstone.com - NeXTMail welcome
Gemstone Systems, Inc.
19616 Redbeam Ave.
Torrance, CA   90503