[comp.sys.mac.programmer] HOWTO: Gray things in color

time@ice.com (Tim Endres) (05/24/91)

This seems like a really stupid question, but I see no reference to
it in my docs. I've have heard say that the way to get the nice smooth
dimming in color is to "blend a 50% gray RGB".

Anybody got a ready handy snippet to gray an icon or text?

-------------------------------------------------------------
Tim Endres                |  time@ice.com
ICE Engineering           |  uupsi!ice.com!time
8840 Main Street          |  Voice            FAX
Whitmore Lake MI. 48189   |  (313) 449 8288   (313) 449 9208

peirce@outpost.UUCP (Michael Peirce) (05/24/91)

In article <1CE00001.geic0m@tbomb.ice.com>, time@ice.com (Tim Endres) writes:
> 
> This seems like a really stupid question, but I see no reference to
> it in my docs. I've have heard say that the way to get the nice smooth
> dimming in color is to "blend a 50% gray RGB".
> 
> Anybody got a ready handy snippet to gray an icon or text?

Here are some snippets from some code I did to play with this type of
thing:

VAR
	blendWeight			: RGBColor;
	foreColor			: RGBColor;
...
	{ % this blends in whiteI }
	WITH foreColor DO BEGIN
		red		:= 65535;
		blue	:= 65535;
		green	:= 65535;
	END;
						
	WITH blendWeight DO BEGIN
		red		:= 32768;
		blue	:= 32768;
		green	:= 32768;
	END;

	{ %Jblends in black }
	WITH foreColor DO BEGIN
		red		:= 0;
		blue	:= 0;
		green	:= 0;
	END;
						
	WITH blendWeight DO BEGIN
		red		:= 28672;
		blue	:= 28672;
		green	:= 28672;
	END;


	PenMode(blend);
	OpColor(blendWeight);
	RGBForeColor(foreColor);
	PaintRgn(theRgnToTint);
	PenMode(patCopy);

--  Michael Peirce         --   outpost!peirce@claris.com
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California 95117
--           & Consulting  --   (408) 244-6554, AppleLink: PEIRCE

glenn@gla-aux.uucp (Glenn Austin) (05/29/91)

In article <1CE00001.geic0m@tbomb.ice.com>, time@ice.com (Tim Endres) writes:
> This seems like a really stupid question, but I see no reference to
> it in my docs. I've have heard say that the way to get the nice smooth
> dimming in color is to "blend a 50% gray RGB".

Use CopyMask to gray the item (there's a pretty good example on Color Plate
XXIII in the front of IM 6 of the result).

If you are drawing it in gray, check for System 7 and color, then set the
RGBForeColor to the best gray (from using GetGray), and simply draw the
item.

===============================================================================
| Glenn L. Austin                | "Turn too soon, run out of room.           |
| Macintosh Wizard and           |    Turn too late, much better fate."       |
| Auto Racing Driver             |   -- Jim Russell Racing School Instructors |
|-----------------------------------------------------------------------------|
| Don't take me too seriously -- I never do!  :-)                             |
|-----------------------------------------------------------------------------|
| Usenet:  glenn@gla-aux.uucp or glenn%gla-aux.uucp@skinner.cs.uoregon.edu    |
===============================================================================