Re: Colour Gradient



On Tue, 2 Mar 2004, Matthew A Tobiasz wrote:
How could I make a widget that shows a colour gradient (eg. a widget that goes
from one colour to another, that can be used as a scale for a graph).  Like
the ones in the GIMP, that are used for colour selection of the individual
colour componenets (hue/saturation/value/red/green/blue).  Thanks.
Hello Matthew,
I suggest you use a GtkDrawingArea. Connect to the expose-event to draw
the color gradient and the selection mark. You can use widget.allocation
to determine the size of the widget, so you can interpolate the color
values from one end to the other.
Connect to the button-press-event and motion-notify-event to move the
selection mark on the gradient.

Regards,
                    Peter
-- 
====================================================================
Peter Krüger

applied software solutions (appss) GmbH
Sandtorstr. 23
D-39106 Magdeburg
Germany

Phone:  +49-(0)391-54486-19388
Fax:    +49-(0)391-54486-19222
email:  krueger appss de
URL:    http://www.appss.de

Managing Director: Uwe Hess, Dietmar Schäfer
Register: HRB12386, AG Mageburg

"Virtual business becomes reality!"

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
====================================================================




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