Xref: utzoo comp.windows.x:35595 comp.graphics:17434 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!dkuug!modulex!ssn From: ssn@modulex.dk (Svend Skafte Nielsen) Newsgroups: comp.windows.x,comp.graphics Subject: Re: changing color intensity in X Message-ID: <728@modulex.dk> Date: 23 Apr 91 09:11:37 GMT References: <1991Apr20.204325.2078@eng.ufl.edu> Organization: A/S MODULEX, Copenhagen, Denmark Lines: 40 tsao@helios.tcad.ee.ufl.edu ( Tsao) writes: > I am writing a graphics program for shading, would somebody tell me how to >change the intensity of the same color like 'setgray' in postscript ? or the >only way to do that is using different colors (blue, light blue, etc). > thanks. >-- >--- Qing Intensity (also called lightness or luminance) is usually calculated as I = (R+G+B)/3 where R, G and B are the resp. red, green and blue components of the color (e.g. from the XColor structure). One way of changing the intensity of a color then is to increase or decrease each RGB component with an equal ammount. A better way is to use a conversion of RGB to IHS values ( Intesity, Hue and Saturation), change I and transform back to RGB. There are several books and articles on the subject e.g. Durrett: "Color and Computers", John Rankin (I don't remember the title), Wayne Niblack: "Digital Image Processing". Good luck Svend. --------------------------------------------------- Svend Skafte Nielsen | Email: ssn@modulex.dk A/S MODULEX | Phone: +45 44 53 30 11 Lyskaer 15 | Telefax: +45 44 53 30 74 DK-2730 Herlev | Denmark |