FB II Compiler
Modify colour brightness
if you pull an rgbrecord out, say something like this:
Nucolor.red = 65135
Nucolor.green = 16381
Nucolor.blue = 32796
and assuming you want xx& percent of _that_ shade of color, you'd say:
Nucolor.red = Nucolor.red / 100 * xx&
For example, substitute 75 for xx& and you'll get 75% of the original brightness. Substitute 125 for xx& and you'll get 25% brighter.
Nucolor.green = Nucolor.green / 100 * xx&
Nucolor.blue = Nucolor.blue / 100 * xx&
The lowest your red, green, and blue values can be is &H0000/Zero, zilch, mega nega tory. The highest is &HFFFF/65535, 64k, 256^2, &HFF^2.
If you look at Photoshop & other similar packages, under "Curves" or "Brightness/Contrast" (if they combine Curves there) you'll see that the "brightness" is dealt with in one of two ways; either by capping the maximum value, as you're doing here, or by "modifying the curve".
Modifying the brightness curve is tricky, but will give you "better" results in many cases; the trick is that low-end values and high-end values change very little, if at all, while mid-range values are increased proportionately more. This lowers contrast in the brighter (or darker) areas but doesn't affect it (or increases it slightly) in the midrange.
The problem is that the "wheel" is HSB (Hue, Saturation, & Brightness) format, and RGBFORECOLOR is, as the name implies, Red, Green, Blue format. You need to get a copy of Inside Mac (I think it's "Imaging With Color" or something like that) and look at all the conversion routines they supply. Then you can take the RGB value from GETCOLOR, convert to HSB, "add" as much brightness as you want, and convert back.
As Bill points out, modifying the brightness is tricky as the perception of it is not linear. The correcting curve is called the Gamma curve. Changes of brigthness is most noticable in the middle range. This is why cheap scanner working with 24 bits give poor resolution in the very dark and very light areas.