Re: gdk color values



On Fri, 2003-06-27 at 18:09, Peter "Firefly" Lund wrote:
On Fri, 27 Jun 2003, Rajarshi Guha wrote:

Hi,
  I'm using a GdkColor variable to paint a GtkDrawingArea. From the
example code in the Gtk2 distribution I see that the red, blue and green
values of a GdkColor struct can range from 0 to 65535. However my user
interface requires me to use RGB values in the range between 0 and 255.

Is there any standard way to map from a 0-255 range to the 0-65535 range
used by GdkColor?

Multiplication?

I tried that - I'm using a spin button whose range is 0 to 255. So using
three spin buttons I set the RGB components of a GdkColor by

color.red = rvalue * 65535 / 255
etc

However the colors in the drawing area that is drawn into with the
resultant GdkColor dont match what I see from the color selection
dialog. The docs say that the range from 0-65535 indicates that
intensity is present - does this mean that getting rid of the intensity
portion of a color I would get the 'plain' color - I dont know if this
makes sense, but if this is the way to go how do I get rid of intensity?

-------------------------------------------------------------------
Rajarshi Guha <rajarshi presidency com> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
After a number of decimal places, nobody gives a damn.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]