GtkHSV

GtkHSV — A 'color wheel' widget

Synopsis

#include <gtk/gtk.h>

struct              GtkHSV;
GtkWidget *         gtk_hsv_new                         (void);
void                gtk_hsv_set_color                   (GtkHSV *hsv,
                                                         double h,
                                                         double s,
                                                         double v);
void                gtk_hsv_get_color                   (GtkHSV *hsv,
                                                         gdouble *h,
                                                         gdouble *s,
                                                         gdouble *v);
void                gtk_hsv_set_metrics                 (GtkHSV *hsv,
                                                         gint size,
                                                         gint ring_width);
void                gtk_hsv_get_metrics                 (GtkHSV *hsv,
                                                         gint *size,
                                                         gint *ring_width);
gboolean            gtk_hsv_is_adjusting                (GtkHSV *hsv);
void                gtk_hsv_to_rgb                      (gdouble h,
                                                         gdouble s,
                                                         gdouble v,
                                                         gdouble *r,
                                                         gdouble *g,
                                                         gdouble *b);
void                gtk_rgb_to_hsv                      (gdouble r,
                                                         gdouble g,
                                                         gdouble b,
                                                         gdouble *h,
                                                         gdouble *s,
                                                         gdouble *v);

Description

GtkHSV is the 'color wheel' part of a complete color selector widget. It allows to select a color by determining its HSV components in an intuitive way. Moving the selection around the outer ring changes the hue, and moving the selection point inside the inner triangle changes value and saturation.

Details

struct GtkHSV

struct GtkHSV {
  GtkWidget parent_instance;

  /* Private data */
  gpointer GSEAL (priv);
};


gtk_hsv_new ()

GtkWidget *         gtk_hsv_new                         (void);

Creates a new HSV color selector.

Returns :

A newly-created HSV color selector.

Since 2.14


gtk_hsv_set_color ()

void                gtk_hsv_set_color                   (GtkHSV *hsv,
                                                         double h,
                                                         double s,
                                                         double v);

Sets the current color in an HSV color selector. Color component values must be in the [0.0, 1.0] range.

hsv :

An HSV color selector

h :

Hue

s :

Saturation

v :

Value

Since 2.14


gtk_hsv_get_color ()

void                gtk_hsv_get_color                   (GtkHSV *hsv,
                                                         gdouble *h,
                                                         gdouble *s,
                                                         gdouble *v);

Queries the current color in an HSV color selector. Returned values will be in the [0.0, 1.0] range.

hsv :

An HSV color selector

h :

Return value for the hue

s :

Return value for the saturation

v :

Return value for the value

Since 2.14


gtk_hsv_set_metrics ()

void                gtk_hsv_set_metrics                 (GtkHSV *hsv,
                                                         gint size,
                                                         gint ring_width);

Sets the size and ring width of an HSV color selector.

hsv :

An HSV color selector

size :

Diameter for the hue ring

ring_width :

Width of the hue ring

Since 2.14


gtk_hsv_get_metrics ()

void                gtk_hsv_get_metrics                 (GtkHSV *hsv,
                                                         gint *size,
                                                         gint *ring_width);

Queries the size and ring width of an HSV color selector.

hsv :

An HSV color selector

size :

Return value for the diameter of the hue ring

ring_width :

Return value for the width of the hue ring

Since 2.14


gtk_hsv_is_adjusting ()

gboolean            gtk_hsv_is_adjusting                (GtkHSV *hsv);

An HSV color selector can be said to be adjusting if multiple rapid changes are being made to its value, for example, when the user is adjusting the value with the mouse. This function queries whether the HSV color selector is being adjusted or not.

hsv :

A GtkHSV

Returns :

TRUE if clients can ignore changes to the color value, since they may be transitory, or FALSE if they should consider the color value status to be final.

Since 2.14


gtk_hsv_to_rgb ()

void                gtk_hsv_to_rgb                      (gdouble h,
                                                         gdouble s,
                                                         gdouble v,
                                                         gdouble *r,
                                                         gdouble *g,
                                                         gdouble *b);

Converts a color from HSV space to RGB. Input values must be in the [0.0, 1.0] range; output values will be in the same range.

h :

Hue

s :

Saturation

v :

Value

r :

Return value for the red component

g :

Return value for the green component

b :

Return value for the blue component

Since 2.14


gtk_rgb_to_hsv ()

void                gtk_rgb_to_hsv                      (gdouble r,
                                                         gdouble g,
                                                         gdouble b,
                                                         gdouble *h,
                                                         gdouble *s,
                                                         gdouble *v);

Converts a color from RGB space to HSV. Input values must be in the [0.0, 1.0] range; output values will be in the same range.

r :

Red

g :

Green

b :

Blue

h :

Return value for the hue component

s :

Return value for the saturation component

v :

Return value for the value component

Since 2.14

See Also

GtkColorSelection

a complete color selection widget

GtkColorSelectionDialog

a color selection dialog