CcColorcombinateDialog

CcColorcombinateDialog — A GtkDialog to ease palette creation

Synopsis




enum        CcCombineType;
enum        CcVariationType;
            CcColorcombinateDialog;
GtkWidget*  cc_colorcombinate_dialog_new    (void);
gboolean    cc_load_palette                 (CcColorcombinateDialog *dlg,
                                             gchar *file,
                                             GError **error);
gboolean    cc_get_palette_file_is_loaded   (CcColorcombinateDialog *dlg);
gchar*      cc_get_palette_name             (CcColorcombinateDialog *dlg);
gchar*      cc_get_palette_filename         (CcColorcombinateDialog *dlg);
gint        cc_get_palette_columns          (CcColorcombinateDialog *dlg);
CcCombineType cc_get_combination_type       (CcColorcombinateDialog *dlg);
CcVariationType cc_get_variation_type       (CcColorcombinateDialog *dlg);
gchar*      cc_get_palette_as_string        (CcColorcombinateDialog *dlg);
GList*      cc_get_combination_colors       (CcColorcombinateDialog *dlg);
GList*      cc_get_variation_colors         (CcColorcombinateDialog *dlg);
GList*      cc_get_palette_colors           (CcColorcombinateDialog *dlg);
void        cc_color_list_free              (GList *colors_list);
void        cc_add_tool_button              (CcColorcombinateDialog *dlg,
                                             GtkToolItem *item,
                                             gint pos);


Description

CcColorcombinateDialog is a GtkDialog to ease creation of palettes based on the color theory. It let you create color harmonies and apply variations to them, to save the final result as a color palette to be used on any supporting application.

Details

enum CcCombineType

typedef enum _cc_combine_type {
	CC_MONOCHROMATIC,
	CC_ANALOGOUS,	
	CC_COMPLEMENTARY,
	CC_SPLIT_COMPLEMENTARY,
	CC_TRIADIC,
	CC_TETRADIC
} CcCombineType;

The type of combination selected by the user

CC_MONOCHROMATIC Monochromatic combinations use only one color.
CC_ANALOGOUS Analogous combinations uses colors ajacent on the color wheel.
CC_COMPLEMENTARY Complementary colors are oposite colors on the color wheel.
CC_SPLIT_COMPLEMENTARY Split complementary harmonies uses a color and the two color adjacent to its complementary
CC_TRIADIC Triadic harmonies uses three colors evenly spaced on the color wheel.
CC_TETRADIC Tetradic harmonies uses four colors with two complementaries.

enum CcVariationType

typedef enum _cc_variation_type {
	CC_LIGHTNESS,
	CC_SATURATION,
	CC_TINT,
	CC_SHADE
} CcVariationType;

The type of variation selected by the user

CC_LIGHTNESS Lightness
CC_SATURATION Saturation
CC_TINT Tint
CC_SHADE Shade

CcColorcombinateDialog

typedef struct {
	GtkDialog parent_instance; 
	
	GtkColorSelection *colorselection;
} CcColorcombinateDialog;

This structure implements a ColorCombinate dialog widget.

GtkDialog parent_instance; The parent GtkDialog
GtkColorSelection *colorselection; The gtk color selection widget used on the dialog.

cc_colorcombinate_dialog_new ()

GtkWidget*  cc_colorcombinate_dialog_new    (void);

Creates a CcColorcombinateDialog widget.

Returns : A new CcColorcombinateDialog

cc_load_palette ()

gboolean    cc_load_palette                 (CcColorcombinateDialog *dlg,
                                             gchar *file,
                                             GError **error);

Loads a Gimp palette on the dialog's palette view.

dlg : The CcColorcombinateDialog
file : The palette file
error : A return value for the error if any
Returns : A boolean indicating success or failure loading the file.

cc_get_palette_file_is_loaded ()

gboolean    cc_get_palette_file_is_loaded   (CcColorcombinateDialog *dlg);

Returns whether a palette file is loaded or nt in the dialog.

dlg : The CcColorcombinateDialog
Returns : A boolean indicating whether a palette file is loaded or not

cc_get_palette_name ()

gchar*      cc_get_palette_name             (CcColorcombinateDialog *dlg);

Returns the palette name, if any.

dlg : The CcColorcombinateDialog
Returns : A newly allocated string with the palette name or NULL if the palette have no name. The caller must free the returned string when no longer needed.

cc_get_palette_filename ()

gchar*      cc_get_palette_filename         (CcColorcombinateDialog *dlg);

Returns the palette file name (path), if any.

dlg : The CcColorcombinateDialog
Returns : A newly allocated string with the palette file name or NULL if the palette have no name. The caller must free the returned string when no longer needed.

cc_get_palette_columns ()

gint        cc_get_palette_columns          (CcColorcombinateDialog *dlg);

Returns the number of columns in the palette. It have a meaning for other Gimp palette supporting applications - such as Gimp and Inkscape - but not for the dialog itself.

dlg : The CcColorcombinateDialog
Returns : The number of columns on the palette.

cc_get_combination_type ()

CcCombineType cc_get_combination_type       (CcColorcombinateDialog *dlg);

Returns the CcCombineType indicating the type of combination being used.

dlg : The CcColorcombinateDialog.
Returns : A CcCombineType value.

cc_get_variation_type ()

CcVariationType cc_get_variation_type       (CcColorcombinateDialog *dlg);

Returns the CcVariationType indicating the type of variation being used.

dlg : The CcColorcombinateDialog.
Returns : A CcVariationType value.

cc_get_palette_as_string ()

gchar*      cc_get_palette_as_string        (CcColorcombinateDialog *dlg);

This function generates a newly allocated string in Gimp palette format with current colors and settings. This string is suited to be saved as a Gimp palette file. The caller must free the string when no longer needed.

dlg : The CcColorcombinateDialog.
Returns : A newly allocated UTF-8 string in Gimp palette format.

cc_get_combination_colors ()

GList*      cc_get_combination_colors       (CcColorcombinateDialog *dlg);

This function generates a GList of pointers to GdkColor structures, with the current combination colors. All colors should be free with gtk_color_free or using the function cc_color_list_free to free the whole list.

dlg : The CcColorcombinateDialog.
Returns : A GList* of GdkColor pointers.

cc_get_variation_colors ()

GList*      cc_get_variation_colors         (CcColorcombinateDialog *dlg);

This function generates a GList of pointers to GdkColor structures, with the current variation colors. All colors should be free with gtk_color_free or using the function cc_color_list_free to free the whole list.

dlg : The CcColorcombinateDialog.
Returns : A GList* of GdkColor pointers.

cc_get_palette_colors ()

GList*      cc_get_palette_colors           (CcColorcombinateDialog *dlg);

This function generates a GList of pointers to GdkColor structures, with the colors on the palette view. All colors should be free with gtk_color_free or using the function cc_color_list_free to free the whole list.

dlg : The CcColorcombinateDialog.
Returns : A GList* of GdkColor pointers.

cc_color_list_free ()

void        cc_color_list_free              (GList *colors_list);

Frees a GList* of allocated GdkColor* as those returned by cc_get_combination_colors cc_get_variation_colors and cc_get_palette_colors

colors_list : A GList* of allocated GdkColor pointers.

cc_add_tool_button ()

void        cc_add_tool_button              (CcColorcombinateDialog *dlg,
                                             GtkToolItem *item,
                                             gint pos);

Adds a button in the actions tool bar.

dlg : The CcColorcombinateDialog.
item : A GtkToolitem
pos : The position on the tool bar.

See Also

GtkDialog