mirror of https://github.com/GNOME/gimp.git
app, libgimp, pdb, plug-ins: canvas grid now using GeglColor.
This commit is contained in:
parent
f9c97aeb72
commit
b53da69f3c
|
@ -42,27 +42,28 @@ static cairo_user_data_key_t surface_data_key = { 0, };
|
|||
|
||||
|
||||
cairo_pattern_t *
|
||||
gimp_cairo_pattern_create_stipple (const GimpRGB *fg,
|
||||
const GimpRGB *bg,
|
||||
gint index,
|
||||
gdouble offset_x,
|
||||
gdouble offset_y)
|
||||
gimp_cairo_pattern_create_stipple (GeglColor *fg,
|
||||
GeglColor *bg,
|
||||
gint index,
|
||||
gdouble offset_x,
|
||||
gdouble offset_y,
|
||||
const Babl *render_space)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_pattern_t *pattern;
|
||||
guchar *data;
|
||||
guchar *d;
|
||||
guchar fg_r, fg_g, fg_b, fg_a;
|
||||
guchar bg_r, bg_g, bg_b, bg_a;
|
||||
guchar fg_rgba[4];
|
||||
guchar bg_rgba[4];
|
||||
gint x, y;
|
||||
|
||||
g_return_val_if_fail (fg != NULL, NULL);
|
||||
g_return_val_if_fail (bg != NULL, NULL);
|
||||
g_return_val_if_fail (GEGL_IS_COLOR (fg), NULL);
|
||||
g_return_val_if_fail (GEGL_IS_COLOR (bg), NULL);
|
||||
|
||||
data = g_malloc (8 * 8 * 4);
|
||||
|
||||
gimp_rgba_get_uchar (fg, &fg_r, &fg_g, &fg_b, &fg_a);
|
||||
gimp_rgba_get_uchar (bg, &bg_r, &bg_g, &bg_b, &bg_a);
|
||||
gegl_color_get_pixel (fg, babl_format_with_space ("R'G'B'A u8", render_space), fg_rgba);
|
||||
gegl_color_get_pixel (bg, babl_format_with_space ("R'G'B'A u8", render_space), bg_rgba);
|
||||
|
||||
d = data;
|
||||
|
||||
|
@ -71,9 +72,9 @@ gimp_cairo_pattern_create_stipple (const GimpRGB *fg,
|
|||
for (x = 0; x < 8; x++)
|
||||
{
|
||||
if ((x + y + index) % 8 >= 4)
|
||||
GIMP_CAIRO_ARGB32_SET_PIXEL (d, fg_r, fg_g, fg_b, fg_a);
|
||||
GIMP_CAIRO_ARGB32_SET_PIXEL (d, fg_rgba[0], fg_rgba[1], fg_rgba[2], fg_rgba[3]);
|
||||
else
|
||||
GIMP_CAIRO_ARGB32_SET_PIXEL (d, bg_r, bg_g, bg_b, bg_a);
|
||||
GIMP_CAIRO_ARGB32_SET_PIXEL (d, bg_rgba[0], bg_rgba[1], bg_rgba[2], bg_rgba[3]);
|
||||
|
||||
d += 4;
|
||||
}
|
||||
|
|
|
@ -25,27 +25,28 @@
|
|||
#define __APP_GIMP_CAIRO_H__
|
||||
|
||||
|
||||
cairo_pattern_t * gimp_cairo_pattern_create_stipple (const GimpRGB *fg,
|
||||
const GimpRGB *bg,
|
||||
gint index,
|
||||
gdouble offset_x,
|
||||
gdouble offset_y);
|
||||
cairo_pattern_t * gimp_cairo_pattern_create_stipple (GeglColor *fg,
|
||||
GeglColor *bg,
|
||||
gint index,
|
||||
gdouble offset_x,
|
||||
gdouble offset_y,
|
||||
const Babl *render_space);
|
||||
|
||||
void gimp_cairo_arc (cairo_t *cr,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble radius,
|
||||
gdouble start_angle,
|
||||
gdouble slice_angle);
|
||||
void gimp_cairo_rounded_rectangle (cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
gdouble corner_radius);
|
||||
void gimp_cairo_segments (cairo_t *cr,
|
||||
GimpSegment *segs,
|
||||
gint n_segs);
|
||||
void gimp_cairo_arc (cairo_t *cr,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble radius,
|
||||
gdouble start_angle,
|
||||
gdouble slice_angle);
|
||||
void gimp_cairo_rounded_rectangle (cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
gdouble corner_radius);
|
||||
void gimp_cairo_segments (cairo_t *cr,
|
||||
GimpSegment *segs,
|
||||
gint n_segs);
|
||||
|
||||
|
||||
#endif /* __APP_GIMP_CAIRO_H__ */
|
||||
|
|
|
@ -54,6 +54,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static void gimp_grid_finalize (GObject *object);
|
||||
static void gimp_grid_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
|
@ -67,20 +68,20 @@ static void gimp_grid_set_property (GObject *object,
|
|||
G_DEFINE_TYPE_WITH_CODE (GimpGrid, gimp_grid, GIMP_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
|
||||
|
||||
#define parent_class gimp_grid_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_grid_class_init (GimpGridClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpRGB black;
|
||||
GimpRGB white;
|
||||
GeglColor *black = gegl_color_new ("black");
|
||||
GeglColor *white = gegl_color_new ("white");
|
||||
|
||||
object_class->finalize = gimp_grid_finalize;
|
||||
object_class->get_property = gimp_grid_get_property;
|
||||
object_class->set_property = gimp_grid_set_property;
|
||||
|
||||
gimp_rgba_set (&black, 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE);
|
||||
gimp_rgba_set (&white, 1.0, 1.0, 1.0, GIMP_OPACITY_OPAQUE);
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_STYLE,
|
||||
"style",
|
||||
_("Line style"),
|
||||
|
@ -89,20 +90,20 @@ gimp_grid_class_init (GimpGridClass *klass)
|
|||
GIMP_GRID_SOLID,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_RGB (object_class, PROP_FGCOLOR,
|
||||
"fgcolor",
|
||||
_("Foreground color"),
|
||||
_("The foreground color of the grid."),
|
||||
TRUE, &black,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_PROP_COLOR (object_class, PROP_FGCOLOR,
|
||||
"fgcolor",
|
||||
_("Foreground color"),
|
||||
_("The foreground color of the grid."),
|
||||
/*TRUE,*/ black,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_RGB (object_class, PROP_BGCOLOR,
|
||||
"bgcolor",
|
||||
_("Background color"),
|
||||
_("The background color of the grid; "
|
||||
"only used in double dashed line style."),
|
||||
TRUE, &white,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_PROP_COLOR (object_class, PROP_BGCOLOR,
|
||||
"bgcolor",
|
||||
_("Background color"),
|
||||
_("The background color of the grid; "
|
||||
"only used in double dashed line style."),
|
||||
/*TRUE,*/ white,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_XSPACING,
|
||||
"xspacing",
|
||||
|
@ -149,11 +150,27 @@ gimp_grid_class_init (GimpGridClass *klass)
|
|||
NULL,
|
||||
FALSE, FALSE, GIMP_UNIT_INCH,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_unref (black);
|
||||
g_object_unref (white);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_grid_init (GimpGrid *grid)
|
||||
{
|
||||
grid->fgcolor = gegl_color_new ("black");
|
||||
grid->bgcolor = gegl_color_new ("white");
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_grid_finalize (GObject *object)
|
||||
{
|
||||
GimpGrid *grid = GIMP_GRID (object);
|
||||
|
||||
g_object_unref (grid->fgcolor);
|
||||
g_object_unref (grid->bgcolor);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -170,10 +187,10 @@ gimp_grid_get_property (GObject *object,
|
|||
g_value_set_enum (value, grid->style);
|
||||
break;
|
||||
case PROP_FGCOLOR:
|
||||
g_value_set_boxed (value, &grid->fgcolor);
|
||||
g_value_set_object (value, grid->fgcolor);
|
||||
break;
|
||||
case PROP_BGCOLOR:
|
||||
g_value_set_boxed (value, &grid->bgcolor);
|
||||
g_value_set_object (value, grid->bgcolor);
|
||||
break;
|
||||
case PROP_XSPACING:
|
||||
g_value_set_double (value, grid->xspacing);
|
||||
|
@ -206,7 +223,6 @@ gimp_grid_set_property (GObject *object,
|
|||
GParamSpec *pspec)
|
||||
{
|
||||
GimpGrid *grid = GIMP_GRID (object);
|
||||
GimpRGB *color;
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -214,12 +230,12 @@ gimp_grid_set_property (GObject *object,
|
|||
grid->style = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_FGCOLOR:
|
||||
color = g_value_get_boxed (value);
|
||||
grid->fgcolor = *color;
|
||||
g_clear_object (&grid->fgcolor);
|
||||
grid->fgcolor = gegl_color_duplicate (g_value_get_object (value));
|
||||
break;
|
||||
case PROP_BGCOLOR:
|
||||
color = g_value_get_boxed (value);
|
||||
grid->bgcolor = *color;
|
||||
g_clear_object (&grid->bgcolor);
|
||||
grid->bgcolor = gegl_color_duplicate (g_value_get_object (value));
|
||||
break;
|
||||
case PROP_XSPACING:
|
||||
grid->xspacing = g_value_get_double (value);
|
||||
|
@ -256,24 +272,20 @@ gimp_grid_get_style (GimpGrid *grid)
|
|||
return grid->style;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_grid_get_fgcolor (GimpGrid *grid,
|
||||
GimpRGB *fgcolor)
|
||||
GeglColor *
|
||||
gimp_grid_get_fgcolor (GimpGrid *grid)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GRID (grid));
|
||||
g_return_if_fail (fgcolor != NULL);
|
||||
g_return_val_if_fail (GIMP_IS_GRID (grid), NULL);
|
||||
|
||||
*fgcolor = grid->fgcolor;
|
||||
return grid->fgcolor;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_grid_get_bgcolor (GimpGrid *grid,
|
||||
GimpRGB *bgcolor)
|
||||
GeglColor *
|
||||
gimp_grid_get_bgcolor (GimpGrid *grid)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GRID (grid));
|
||||
g_return_if_fail (bgcolor != NULL);
|
||||
g_return_val_if_fail (GIMP_IS_GRID (grid), NULL);
|
||||
|
||||
*bgcolor = grid->bgcolor;
|
||||
return grid->bgcolor;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -40,8 +40,8 @@ struct _GimpGrid
|
|||
GimpObject parent_instance;
|
||||
|
||||
GimpGridStyle style;
|
||||
GimpRGB fgcolor;
|
||||
GimpRGB bgcolor;
|
||||
GeglColor *fgcolor;
|
||||
GeglColor *bgcolor;
|
||||
gdouble xspacing;
|
||||
gdouble yspacing;
|
||||
GimpUnit spacing_unit;
|
||||
|
@ -57,25 +57,23 @@ struct _GimpGridClass
|
|||
};
|
||||
|
||||
|
||||
GType gimp_grid_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_grid_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpGridStyle gimp_grid_get_style (GimpGrid *grid);
|
||||
GimpGridStyle gimp_grid_get_style (GimpGrid *grid);
|
||||
|
||||
void gimp_grid_get_fgcolor (GimpGrid *grid,
|
||||
GimpRGB *fgcolor);
|
||||
void gimp_grid_get_bgcolor (GimpGrid *grid,
|
||||
GimpRGB *bgcolor);
|
||||
GeglColor * gimp_grid_get_fgcolor (GimpGrid *grid);
|
||||
GeglColor * gimp_grid_get_bgcolor (GimpGrid *grid);
|
||||
|
||||
void gimp_grid_get_spacing (GimpGrid *grid,
|
||||
gdouble *xspacing,
|
||||
gdouble *yspacing);
|
||||
void gimp_grid_get_offset (GimpGrid *grid,
|
||||
gdouble *xoffset,
|
||||
gdouble *yoffset);
|
||||
void gimp_grid_get_spacing (GimpGrid *grid,
|
||||
gdouble *xspacing,
|
||||
gdouble *yspacing);
|
||||
void gimp_grid_get_offset (GimpGrid *grid,
|
||||
gdouble *xoffset,
|
||||
gdouble *yoffset);
|
||||
|
||||
const gchar * gimp_grid_parasite_name (void) G_GNUC_CONST;
|
||||
GimpParasite * gimp_grid_to_parasite (GimpGrid *grid);
|
||||
GimpGrid * gimp_grid_from_parasite (const GimpParasite *parasite);
|
||||
const gchar * gimp_grid_parasite_name (void) G_GNUC_CONST;
|
||||
GimpParasite * gimp_grid_to_parasite (GimpGrid *grid);
|
||||
GimpGrid * gimp_grid_from_parasite (const GimpParasite *parasite);
|
||||
|
||||
|
||||
#endif /* __GIMP_GRID_H__ */
|
||||
|
|
|
@ -28,73 +28,201 @@
|
|||
|
||||
#include "display-types.h"
|
||||
|
||||
#include "config/gimpcoreconfig.h"
|
||||
|
||||
#include "core/gimp-cairo.h"
|
||||
#include "core/gimpgrid.h"
|
||||
#include "core/gimplayer.h"
|
||||
|
||||
#include "gimpcanvas.h"
|
||||
#include "gimpcanvas-style.h"
|
||||
|
||||
/* Styles for common and custom guides. */
|
||||
static const GimpRGB guide_normal_fg = { 0.0, 0.0, 0.0, 1.0 };
|
||||
static const GimpRGB guide_normal_bg = { 0.0, 0.8, 1.0, 1.0 };
|
||||
static const GimpRGB guide_active_fg = { 0.0, 0.0, 0.0, 1.0 };
|
||||
static const GimpRGB guide_active_bg = { 1.0, 0.0, 0.0, 1.0 };
|
||||
static GeglColor *guide_normal_fg;
|
||||
static GeglColor *guide_normal_bg;
|
||||
static GeglColor *guide_active_fg;
|
||||
static GeglColor *guide_active_bg;
|
||||
|
||||
static const GimpRGB guide_mirror_normal_fg = { 1.0, 1.0, 1.0, 1.0 };
|
||||
static const GimpRGB guide_mirror_normal_bg = { 0.0, 1.0, 0.0, 1.0 };
|
||||
static const GimpRGB guide_mirror_active_fg = { 0.0, 1.0, 0.0, 1.0 };
|
||||
static const GimpRGB guide_mirror_active_bg = { 1.0, 0.0, 0.0, 1.0 };
|
||||
static GeglColor *guide_mirror_normal_fg;
|
||||
static GeglColor *guide_mirror_normal_bg;
|
||||
static GeglColor *guide_mirror_active_fg;
|
||||
static GeglColor *guide_mirror_active_bg;
|
||||
|
||||
static const GimpRGB guide_mandala_normal_fg = { 1.0, 1.0, 1.0, 1.0 };
|
||||
static const GimpRGB guide_mandala_normal_bg = { 0.0, 1.0, 1.0, 1.0 };
|
||||
static const GimpRGB guide_mandala_active_fg = { 0.0, 1.0, 1.0, 1.0 };
|
||||
static const GimpRGB guide_mandala_active_bg = { 1.0, 0.0, 0.0, 1.0 };
|
||||
static GeglColor *guide_mandala_normal_fg;
|
||||
static GeglColor *guide_mandala_normal_bg;
|
||||
static GeglColor *guide_mandala_active_fg;
|
||||
static GeglColor *guide_mandala_active_bg;
|
||||
|
||||
static const GimpRGB guide_split_normal_fg = { 1.0, 1.0, 1.0, 1.0 };
|
||||
static const GimpRGB guide_split_normal_bg = { 1.0, 0.0, 1.0, 1.0 };
|
||||
static const GimpRGB guide_split_active_fg = { 1.0, 0.0, 1.0, 1.0 };
|
||||
static const GimpRGB guide_split_active_bg = { 1.0, 0.0, 0.0, 1.0 };
|
||||
static GeglColor *guide_split_normal_fg;
|
||||
static GeglColor *guide_split_normal_bg;
|
||||
static GeglColor *guide_split_active_fg;
|
||||
static GeglColor *guide_split_active_bg;
|
||||
|
||||
/* Styles for other canvas items. */
|
||||
static const GimpRGB sample_point_normal = { 0.0, 0.8, 1.0, 1.0 };
|
||||
static const GimpRGB sample_point_active = { 1.0, 0.0, 0.0, 1.0 };
|
||||
static GeglColor *sample_point_normal;
|
||||
static GeglColor *sample_point_active;
|
||||
|
||||
static const GimpRGB layer_fg = { 0.0, 0.0, 0.0, 1.0 };
|
||||
static const GimpRGB layer_bg = { 1.0, 1.0, 0.0, 1.0 };
|
||||
static GeglColor *layer_fg;
|
||||
static GeglColor *layer_bg;
|
||||
|
||||
static const GimpRGB layer_group_fg = { 0.0, 0.0, 0.0, 1.0 };
|
||||
static const GimpRGB layer_group_bg = { 0.0, 1.0, 1.0, 1.0 };
|
||||
static GeglColor *layer_group_fg;
|
||||
static GeglColor *layer_group_bg;
|
||||
|
||||
static const GimpRGB layer_mask_fg = { 0.0, 0.0, 0.0, 1.0 };
|
||||
static const GimpRGB layer_mask_bg = { 0.0, 1.0, 0.0, 1.0 };
|
||||
static GeglColor *layer_mask_fg;
|
||||
static GeglColor *layer_mask_bg;
|
||||
|
||||
static const GimpRGB canvas_fg = { 0.0, 0.0, 0.0, 1.0 };
|
||||
static const GimpRGB canvas_bg = { 1.0, 0.5, 0.0, 1.0 };
|
||||
static GeglColor *canvas_fg;
|
||||
static GeglColor *canvas_bg;
|
||||
|
||||
static const GimpRGB selection_out_fg = { 1.0, 1.0, 1.0, 1.0 };
|
||||
static const GimpRGB selection_out_bg = { 0.5, 0.5, 0.5, 1.0 };
|
||||
static GeglColor *selection_out_fg;
|
||||
static GeglColor *selection_out_bg;
|
||||
|
||||
static const GimpRGB selection_in_fg = { 0.0, 0.0, 0.0, 1.0 };
|
||||
static const GimpRGB selection_in_bg = { 1.0, 1.0, 1.0, 1.0 };
|
||||
static GeglColor *selection_in_fg;
|
||||
static GeglColor *selection_in_bg;
|
||||
|
||||
static const GimpRGB vectors_normal_bg = { 1.0, 1.0, 1.0, 0.6 };
|
||||
static const GimpRGB vectors_normal_fg = { 0.0, 0.0, 1.0, 0.8 };
|
||||
static GeglColor *vectors_normal_bg;
|
||||
static GeglColor *vectors_normal_fg;
|
||||
|
||||
static const GimpRGB vectors_active_bg = { 1.0, 1.0, 1.0, 0.6 };
|
||||
static const GimpRGB vectors_active_fg = { 1.0, 0.0, 0.0, 0.8 };
|
||||
static GeglColor *vectors_active_bg;
|
||||
static GeglColor *vectors_active_fg;
|
||||
|
||||
static const GimpRGB outline_bg = { 1.0, 1.0, 1.0, 0.6 };
|
||||
static const GimpRGB outline_fg = { 0.0, 0.0, 0.0, 0.8 };
|
||||
static GeglColor *outline_bg;
|
||||
static GeglColor *outline_fg;
|
||||
|
||||
static const GimpRGB passe_partout = { 0.0, 0.0, 0.0, 1.0 };
|
||||
static GeglColor *passe_partout;
|
||||
|
||||
static const GimpRGB tool_bg = { 0.0, 0.0, 0.0, 0.4 };
|
||||
static const GimpRGB tool_fg = { 1.0, 1.0, 1.0, 0.8 };
|
||||
static const GimpRGB tool_fg_highlight = { 1.0, 0.8, 0.2, 0.8 };
|
||||
static GeglColor *tool_bg;
|
||||
static GeglColor *tool_fg;
|
||||
static GeglColor *tool_fg_highlight;
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
|
||||
void
|
||||
gimp_canvas_styles_init (void)
|
||||
{
|
||||
const Babl *format = babl_format ("R'G'B'A double");
|
||||
gdouble rgba1[4] = { 0.0, 0.8, 1.0, 1.0 };
|
||||
gdouble rgba2[4] = { 1.0, 0.5, 0.0, 1.0 };
|
||||
gdouble rgba3[4] = { 1.0, 0.8, 0.2, 0.8 };
|
||||
|
||||
/* Styles for common and custom guides. */
|
||||
guide_normal_fg = gegl_color_new ("black");
|
||||
guide_normal_bg = gegl_color_new (NULL);
|
||||
gegl_color_set_pixel (guide_normal_bg, format, rgba1);
|
||||
guide_active_fg = gegl_color_new ("black");
|
||||
guide_active_bg = gegl_color_new ("red");
|
||||
|
||||
guide_mirror_normal_fg = gegl_color_new ("white");
|
||||
guide_mirror_normal_bg = gegl_color_new ("lime");
|
||||
guide_mirror_active_fg = gegl_color_new ("lime");
|
||||
guide_mirror_active_bg = gegl_color_new ("red");
|
||||
|
||||
guide_mandala_normal_fg = gegl_color_new ("white");
|
||||
guide_mandala_normal_bg = gegl_color_new ("aqua");
|
||||
guide_mandala_active_fg = gegl_color_new ("aqua");
|
||||
guide_mandala_active_bg = gegl_color_new ("red");
|
||||
|
||||
guide_split_normal_fg = gegl_color_new ("white");
|
||||
guide_split_normal_bg = gegl_color_new ("fuchsia");
|
||||
guide_split_active_fg = gegl_color_new ("fuchsia");
|
||||
guide_split_active_bg = gegl_color_new ("red");
|
||||
|
||||
/* Styles for other canvas items. */
|
||||
sample_point_normal = gegl_color_new (NULL);
|
||||
gegl_color_set_pixel (sample_point_normal, format, rgba1);
|
||||
sample_point_active = gegl_color_new ("red");
|
||||
|
||||
layer_fg = gegl_color_new ("black");
|
||||
layer_bg = gegl_color_new ("yellow");
|
||||
|
||||
layer_group_fg = gegl_color_new ("black");
|
||||
layer_group_bg = gegl_color_new ("aqua");
|
||||
|
||||
layer_mask_fg = gegl_color_new ("black");
|
||||
layer_mask_bg = gegl_color_new ("lime");
|
||||
|
||||
canvas_fg = gegl_color_new ("black");
|
||||
canvas_bg = gegl_color_new (NULL);
|
||||
gegl_color_set_pixel (canvas_bg, format, rgba2);
|
||||
|
||||
selection_out_fg = gegl_color_new ("white");
|
||||
selection_out_bg = gegl_color_new ("gray");
|
||||
|
||||
selection_in_fg = gegl_color_new ("black");
|
||||
selection_in_bg = gegl_color_new ("white");
|
||||
|
||||
vectors_normal_bg = gegl_color_new ("white");
|
||||
gimp_color_set_alpha (vectors_normal_bg, 0.6);
|
||||
vectors_normal_fg = gegl_color_new ("blue");
|
||||
gimp_color_set_alpha (vectors_normal_fg, 0.8);
|
||||
|
||||
vectors_active_bg = gegl_color_new ("white");
|
||||
gimp_color_set_alpha (vectors_active_bg, 0.6);
|
||||
vectors_active_fg = gegl_color_new ("red");
|
||||
gimp_color_set_alpha (vectors_active_fg, 0.8);
|
||||
|
||||
outline_bg = gegl_color_new ("white");
|
||||
gimp_color_set_alpha (outline_bg, 0.6);
|
||||
outline_fg = gegl_color_new ("black");
|
||||
gimp_color_set_alpha (outline_fg, 0.8);
|
||||
|
||||
passe_partout = gegl_color_new ("black");
|
||||
|
||||
tool_bg = gegl_color_new ("black");
|
||||
gimp_color_set_alpha (tool_bg, 0.4);
|
||||
tool_fg = gegl_color_new ("white");
|
||||
gimp_color_set_alpha (tool_fg, 0.8);
|
||||
tool_fg_highlight = gegl_color_new (NULL);
|
||||
gegl_color_set_pixel (tool_fg_highlight, format, rgba3);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_canvas_styles_exit (void)
|
||||
{
|
||||
g_object_unref (guide_normal_fg);
|
||||
g_object_unref (guide_normal_bg);
|
||||
g_object_unref (guide_active_fg);
|
||||
g_object_unref (guide_active_bg);
|
||||
g_object_unref (guide_mirror_normal_fg);
|
||||
g_object_unref (guide_mirror_normal_bg);
|
||||
g_object_unref (guide_mirror_active_fg);
|
||||
g_object_unref (guide_mirror_active_bg);
|
||||
g_object_unref (guide_mandala_normal_fg);
|
||||
g_object_unref (guide_mandala_normal_bg);
|
||||
g_object_unref (guide_mandala_active_fg);
|
||||
g_object_unref (guide_mandala_active_bg);
|
||||
g_object_unref (guide_split_normal_fg);
|
||||
g_object_unref (guide_split_normal_bg);
|
||||
g_object_unref (guide_split_active_fg);
|
||||
g_object_unref (guide_split_active_bg);
|
||||
g_object_unref (sample_point_normal);
|
||||
g_object_unref (sample_point_active);
|
||||
g_object_unref (layer_fg);
|
||||
g_object_unref (layer_bg);
|
||||
g_object_unref (layer_group_fg);
|
||||
g_object_unref (layer_group_bg);
|
||||
g_object_unref (layer_mask_fg);
|
||||
g_object_unref (layer_mask_bg);
|
||||
g_object_unref (canvas_fg);
|
||||
g_object_unref (canvas_bg);
|
||||
g_object_unref (selection_out_fg);
|
||||
g_object_unref (selection_out_bg);
|
||||
g_object_unref (selection_in_fg);
|
||||
g_object_unref (selection_in_bg);
|
||||
g_object_unref (vectors_normal_bg);
|
||||
g_object_unref (vectors_normal_fg);
|
||||
g_object_unref (vectors_active_bg);
|
||||
g_object_unref (vectors_active_fg);
|
||||
g_object_unref (outline_bg);
|
||||
g_object_unref (outline_fg);
|
||||
g_object_unref (passe_partout);
|
||||
g_object_unref (tool_bg);
|
||||
g_object_unref (tool_fg);
|
||||
g_object_unref (tool_fg_highlight);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_canvas_set_guide_style (GtkWidget *canvas,
|
||||
cairo_t *cr,
|
||||
|
@ -103,11 +231,13 @@ gimp_canvas_set_guide_style (GtkWidget *canvas,
|
|||
gdouble offset_x,
|
||||
gdouble offset_y)
|
||||
{
|
||||
const Babl *render_space;
|
||||
GimpColorConfig *config;
|
||||
cairo_pattern_t *pattern;
|
||||
GimpRGB normal_fg;
|
||||
GimpRGB normal_bg;
|
||||
GimpRGB active_fg;
|
||||
GimpRGB active_bg;
|
||||
GeglColor *normal_fg;
|
||||
GeglColor *normal_bg;
|
||||
GeglColor *active_fg;
|
||||
GeglColor *active_bg;
|
||||
gdouble line_width;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
|
@ -154,12 +284,14 @@ gimp_canvas_set_guide_style (GtkWidget *canvas,
|
|||
|
||||
cairo_set_line_width (cr, line_width);
|
||||
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
render_space = gimp_widget_get_render_space (canvas, config);
|
||||
if (active)
|
||||
pattern = gimp_cairo_pattern_create_stipple (&active_fg, &active_bg, 0,
|
||||
offset_x, offset_y);
|
||||
pattern = gimp_cairo_pattern_create_stipple (active_fg, active_bg, 0,
|
||||
offset_x, offset_y, render_space);
|
||||
else
|
||||
pattern = gimp_cairo_pattern_create_stipple (&normal_fg, &normal_bg, 0,
|
||||
offset_x, offset_y);
|
||||
pattern = gimp_cairo_pattern_create_stipple (normal_fg, normal_bg, 0,
|
||||
offset_x, offset_y, render_space);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
@ -170,15 +302,18 @@ gimp_canvas_set_sample_point_style (GtkWidget *canvas,
|
|||
cairo_t *cr,
|
||||
gboolean active)
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
if (active)
|
||||
gimp_cairo_set_source_rgb (cr, &sample_point_active);
|
||||
gimp_cairo_set_source_color (cr, sample_point_active, config, FALSE, canvas);
|
||||
else
|
||||
gimp_cairo_set_source_rgb (cr, &sample_point_normal);
|
||||
gimp_cairo_set_source_color (cr, sample_point_normal, config, FALSE, canvas);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -188,8 +323,10 @@ gimp_canvas_set_grid_style (GtkWidget *canvas,
|
|||
gdouble offset_x,
|
||||
gdouble offset_y)
|
||||
{
|
||||
GimpRGB fg;
|
||||
GimpRGB bg;
|
||||
const Babl *render_space;
|
||||
GimpColorConfig *config;
|
||||
GeglColor *fg;
|
||||
GeglColor *bg;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
@ -197,8 +334,10 @@ gimp_canvas_set_grid_style (GtkWidget *canvas,
|
|||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
|
||||
gimp_grid_get_fgcolor (grid, &fg);
|
||||
fg = gimp_grid_get_fgcolor (grid);
|
||||
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
render_space = gimp_widget_get_render_space (canvas, config);
|
||||
switch (gimp_grid_get_style (grid))
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
|
@ -207,17 +346,20 @@ gimp_canvas_set_grid_style (GtkWidget *canvas,
|
|||
case GIMP_GRID_DOUBLE_DASH:
|
||||
if (grid->style == GIMP_GRID_DOUBLE_DASH)
|
||||
{
|
||||
gimp_grid_get_bgcolor (grid, &bg);
|
||||
bg = gimp_grid_get_bgcolor (grid);
|
||||
|
||||
pattern = gimp_cairo_pattern_create_stipple (&fg, &bg, 0,
|
||||
offset_x, offset_y);
|
||||
pattern = gimp_cairo_pattern_create_stipple (fg, bg, 0,
|
||||
offset_x, offset_y,
|
||||
render_space);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
|
||||
bg = gegl_color_new ("transparent");
|
||||
|
||||
pattern = gimp_cairo_pattern_create_stipple (&fg, &bg, 0,
|
||||
offset_x, offset_y);
|
||||
pattern = gimp_cairo_pattern_create_stipple (fg, bg, 0,
|
||||
offset_x, offset_y,
|
||||
render_space);
|
||||
g_clear_object (&bg);
|
||||
}
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
|
@ -227,27 +369,30 @@ gimp_canvas_set_grid_style (GtkWidget *canvas,
|
|||
case GIMP_GRID_DOTS:
|
||||
case GIMP_GRID_INTERSECTIONS:
|
||||
case GIMP_GRID_SOLID:
|
||||
gimp_cairo_set_source_rgb (cr, &fg);
|
||||
gimp_cairo_set_source_color (cr, fg, config, FALSE, canvas);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_canvas_set_pen_style (GtkWidget *canvas,
|
||||
cairo_t *cr,
|
||||
const GimpRGB *color,
|
||||
gint width)
|
||||
gimp_canvas_set_pen_style (GtkWidget *canvas,
|
||||
cairo_t *cr,
|
||||
GeglColor *color,
|
||||
gint width)
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
g_return_if_fail (cr != NULL);
|
||||
g_return_if_fail (color != NULL);
|
||||
g_return_if_fail (GEGL_IS_COLOR (color));
|
||||
|
||||
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
|
||||
cairo_set_line_width (cr, width);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||
|
||||
gimp_cairo_set_source_rgb (cr, color);
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
gimp_cairo_set_source_color (cr, color, config, FALSE, canvas);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -257,6 +402,8 @@ gimp_canvas_set_layer_style (GtkWidget *canvas,
|
|||
gdouble offset_x,
|
||||
gdouble offset_y)
|
||||
{
|
||||
const Babl *render_space;
|
||||
GimpColorConfig *config;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
|
@ -266,27 +413,25 @@ gimp_canvas_set_layer_style (GtkWidget *canvas,
|
|||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
||||
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
render_space = gimp_widget_get_render_space (canvas, config);
|
||||
if (gimp_layer_get_mask (layer) &&
|
||||
gimp_layer_get_edit_mask (layer))
|
||||
{
|
||||
pattern = gimp_cairo_pattern_create_stipple (&layer_mask_fg,
|
||||
&layer_mask_bg,
|
||||
pattern = gimp_cairo_pattern_create_stipple (layer_mask_fg,
|
||||
layer_mask_bg,
|
||||
0,
|
||||
offset_x, offset_y);
|
||||
offset_x, offset_y, render_space);
|
||||
}
|
||||
else if (gimp_viewable_get_children (GIMP_VIEWABLE (layer)))
|
||||
{
|
||||
pattern = gimp_cairo_pattern_create_stipple (&layer_group_fg,
|
||||
&layer_group_bg,
|
||||
0,
|
||||
offset_x, offset_y);
|
||||
pattern = gimp_cairo_pattern_create_stipple (layer_group_fg, layer_group_bg, 0,
|
||||
offset_x, offset_y, render_space);
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern = gimp_cairo_pattern_create_stipple (&layer_fg,
|
||||
&layer_bg,
|
||||
0,
|
||||
offset_x, offset_y);
|
||||
pattern = gimp_cairo_pattern_create_stipple (layer_fg, layer_bg, 0,
|
||||
offset_x, offset_y, render_space);
|
||||
}
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
|
@ -299,6 +444,8 @@ gimp_canvas_set_canvas_style (GtkWidget *canvas,
|
|||
gdouble offset_x,
|
||||
gdouble offset_y)
|
||||
{
|
||||
const Babl *render_space;
|
||||
GimpColorConfig *config;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
|
@ -307,10 +454,10 @@ gimp_canvas_set_canvas_style (GtkWidget *canvas,
|
|||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
||||
|
||||
pattern = gimp_cairo_pattern_create_stipple (&canvas_fg,
|
||||
&canvas_bg,
|
||||
0,
|
||||
offset_x, offset_y);
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
render_space = gimp_widget_get_render_space (canvas, config);
|
||||
pattern = gimp_cairo_pattern_create_stipple (canvas_fg, canvas_bg, 0,
|
||||
offset_x, offset_y, render_space);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
@ -322,6 +469,8 @@ gimp_canvas_set_selection_out_style (GtkWidget *canvas,
|
|||
gdouble offset_x,
|
||||
gdouble offset_y)
|
||||
{
|
||||
const Babl *render_space;
|
||||
GimpColorConfig *config;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
|
@ -330,10 +479,10 @@ gimp_canvas_set_selection_out_style (GtkWidget *canvas,
|
|||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
||||
|
||||
pattern = gimp_cairo_pattern_create_stipple (&selection_out_fg,
|
||||
&selection_out_bg,
|
||||
0,
|
||||
offset_x, offset_y);
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
render_space = gimp_widget_get_render_space (canvas, config);
|
||||
pattern = gimp_cairo_pattern_create_stipple (selection_out_fg, selection_out_bg, 0,
|
||||
offset_x, offset_y, render_space);
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
}
|
||||
|
@ -345,6 +494,8 @@ gimp_canvas_set_selection_in_style (GtkWidget *canvas,
|
|||
gdouble offset_x,
|
||||
gdouble offset_y)
|
||||
{
|
||||
const Babl *render_space;
|
||||
GimpColorConfig *config;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
|
@ -353,10 +504,10 @@ gimp_canvas_set_selection_in_style (GtkWidget *canvas,
|
|||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
||||
|
||||
pattern = gimp_cairo_pattern_create_stipple (&selection_in_fg,
|
||||
&selection_in_bg,
|
||||
index,
|
||||
offset_x, offset_y);
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
render_space = gimp_widget_get_render_space (canvas, config);
|
||||
pattern = gimp_cairo_pattern_create_stipple (selection_in_fg, selection_in_bg, index,
|
||||
offset_x, offset_y, render_space);
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
}
|
||||
|
@ -366,15 +517,18 @@ gimp_canvas_set_vectors_bg_style (GtkWidget *canvas,
|
|||
cairo_t *cr,
|
||||
gboolean active)
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
cairo_set_line_width (cr, 3.0);
|
||||
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
if (active)
|
||||
gimp_cairo_set_source_rgba (cr, &vectors_active_bg);
|
||||
gimp_cairo_set_source_color (cr, vectors_active_bg, config, FALSE, canvas);
|
||||
else
|
||||
gimp_cairo_set_source_rgba (cr, &vectors_normal_bg);
|
||||
gimp_cairo_set_source_color (cr, vectors_normal_bg, config, FALSE, canvas);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -382,39 +536,47 @@ gimp_canvas_set_vectors_fg_style (GtkWidget *canvas,
|
|||
cairo_t *cr,
|
||||
gboolean active)
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
if (active)
|
||||
gimp_cairo_set_source_rgba (cr, &vectors_active_fg);
|
||||
gimp_cairo_set_source_color (cr, vectors_active_fg, config, FALSE, canvas);
|
||||
else
|
||||
gimp_cairo_set_source_rgba (cr, &vectors_normal_fg);
|
||||
gimp_cairo_set_source_color (cr, vectors_normal_fg, config, FALSE, canvas);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_canvas_set_outline_bg_style (GtkWidget *canvas,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
gimp_cairo_set_source_rgba (cr, &outline_bg);
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
gimp_cairo_set_source_color (cr, outline_bg, config, FALSE, canvas);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_canvas_set_outline_fg_style (GtkWidget *canvas,
|
||||
cairo_t *cr)
|
||||
{
|
||||
static const double dashes[] = { 4.0, 4.0 };
|
||||
static const double dashes[] = { 4.0, 4.0 };
|
||||
GimpColorConfig *config;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
gimp_cairo_set_source_rgba (cr, &outline_fg);
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
gimp_cairo_set_source_color (cr, outline_fg, config, FALSE, canvas);
|
||||
cairo_set_dash (cr, dashes, G_N_ELEMENTS (dashes), 0);
|
||||
}
|
||||
|
||||
|
@ -422,23 +584,29 @@ void
|
|||
gimp_canvas_set_passe_partout_style (GtkWidget *canvas,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
gimp_cairo_set_source_rgba (cr, &passe_partout);
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
gimp_cairo_set_source_color (cr, passe_partout, config, FALSE, canvas);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_canvas_set_tool_bg_style (GtkWidget *canvas,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (canvas));
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
cairo_set_line_width (cr, 3.0);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||
|
||||
gimp_cairo_set_source_rgba (cr, &tool_bg);
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
gimp_cairo_set_source_color (cr, tool_bg, config, FALSE, canvas);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -446,13 +614,16 @@ gimp_canvas_set_tool_fg_style (GtkWidget *canvas,
|
|||
cairo_t *cr,
|
||||
gboolean highlight)
|
||||
{
|
||||
GimpColorConfig *config;
|
||||
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||
|
||||
config = GIMP_CORE_CONFIG (GIMP_CANVAS (canvas)->config)->color_management;
|
||||
if (highlight)
|
||||
gimp_cairo_set_source_rgba (cr, &tool_fg_highlight);
|
||||
gimp_cairo_set_source_color (cr, tool_fg_highlight, config, FALSE, canvas);
|
||||
else
|
||||
gimp_cairo_set_source_rgba (cr, &tool_fg);
|
||||
gimp_cairo_set_source_color (cr, tool_fg, config, FALSE, canvas);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#define __GIMP_CANVAS_STYLE_H__
|
||||
|
||||
|
||||
void gimp_canvas_styles_init (void);
|
||||
void gimp_canvas_styles_exit (void);
|
||||
|
||||
void gimp_canvas_set_guide_style (GtkWidget *canvas,
|
||||
cairo_t *cr,
|
||||
GimpGuideStyle style,
|
||||
|
@ -38,7 +41,7 @@ void gimp_canvas_set_grid_style (GtkWidget *canvas,
|
|||
gdouble offset_y);
|
||||
void gimp_canvas_set_pen_style (GtkWidget *canvas,
|
||||
cairo_t *cr,
|
||||
const GimpRGB *color,
|
||||
GeglColor *color,
|
||||
gint width);
|
||||
void gimp_canvas_set_layer_style (GtkWidget *canvas,
|
||||
cairo_t *cr,
|
||||
|
|
|
@ -49,8 +49,8 @@ typedef struct _GimpCanvasPenPrivate GimpCanvasPenPrivate;
|
|||
|
||||
struct _GimpCanvasPenPrivate
|
||||
{
|
||||
GimpRGB color;
|
||||
gint width;
|
||||
GeglColor *color;
|
||||
gint width;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(pen) \
|
||||
|
@ -59,6 +59,7 @@ struct _GimpCanvasPenPrivate
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_canvas_pen_finalize (GObject *object);
|
||||
static void gimp_canvas_pen_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
|
@ -84,6 +85,7 @@ gimp_canvas_pen_class_init (GimpCanvasPenClass *klass)
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpCanvasItemClass *item_class = GIMP_CANVAS_ITEM_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_canvas_pen_finalize;
|
||||
object_class->set_property = gimp_canvas_pen_set_property;
|
||||
object_class->get_property = gimp_canvas_pen_get_property;
|
||||
|
||||
|
@ -91,9 +93,9 @@ gimp_canvas_pen_class_init (GimpCanvasPenClass *klass)
|
|||
item_class->stroke = gimp_canvas_pen_stroke;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_COLOR,
|
||||
gimp_param_spec_rgb ("color", NULL, NULL,
|
||||
FALSE, NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gegl_param_spec_color_from_string ("color", NULL, NULL,
|
||||
/*FALSE,*/ "black",
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_WIDTH,
|
||||
g_param_spec_int ("width", NULL, NULL,
|
||||
|
@ -104,6 +106,20 @@ gimp_canvas_pen_class_init (GimpCanvasPenClass *klass)
|
|||
static void
|
||||
gimp_canvas_pen_init (GimpCanvasPen *pen)
|
||||
{
|
||||
GimpCanvasPenPrivate *private = GET_PRIVATE (pen);
|
||||
|
||||
private->color = gegl_color_new ("black");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gimp_canvas_pen_finalize (GObject *object)
|
||||
{
|
||||
GimpCanvasPenPrivate *private = GET_PRIVATE (object);
|
||||
|
||||
g_clear_object (&private->color);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -117,7 +133,8 @@ gimp_canvas_pen_set_property (GObject *object,
|
|||
switch (property_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
gimp_value_get_rgb (value, &private->color);
|
||||
g_clear_object (&private->color);
|
||||
private->color = gegl_color_duplicate (g_value_get_object (value));
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
private->width = g_value_get_int (value);
|
||||
|
@ -140,7 +157,7 @@ gimp_canvas_pen_get_property (GObject *object,
|
|||
switch (property_id)
|
||||
{
|
||||
case PROP_COLOR:
|
||||
gimp_value_set_rgb (value, &private->color);
|
||||
g_value_set_object (value, private->color);
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
g_value_set_int (value, private->width);
|
||||
|
@ -184,7 +201,7 @@ gimp_canvas_pen_stroke (GimpCanvasItem *item,
|
|||
GimpCanvasPenPrivate *private = GET_PRIVATE (item);
|
||||
|
||||
gimp_canvas_set_pen_style (gimp_canvas_item_get_canvas (item), cr,
|
||||
&private->color, private->width);
|
||||
private->color, private->width);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
|
||||
|
@ -199,7 +216,6 @@ gimp_canvas_pen_new (GimpDisplayShell *shell,
|
|||
GimpCanvasItem *item;
|
||||
GimpArray *array;
|
||||
GeglColor *color = NULL;
|
||||
GimpRGB rgb;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
||||
g_return_val_if_fail (points != NULL && n_points > 1, NULL);
|
||||
|
@ -222,12 +238,10 @@ gimp_canvas_pen_new (GimpDisplayShell *shell,
|
|||
g_return_val_if_reached (NULL);
|
||||
}
|
||||
|
||||
gegl_color_get_rgba_with_space (color, &rgb.r, &rgb.g, &rgb.b, &rgb.a, NULL);
|
||||
|
||||
item = g_object_new (GIMP_TYPE_CANVAS_PEN,
|
||||
"shell", shell,
|
||||
"points", array,
|
||||
"color", &rgb,
|
||||
"color", color,
|
||||
"width", width,
|
||||
NULL);
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "plug-in/gimpenvirontable.h"
|
||||
#include "plug-in/gimppluginmanager.h"
|
||||
|
||||
#include "display/gimpcanvas-style.h"
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
@ -277,6 +278,7 @@ gui_init (Gimp *gimp,
|
|||
gimp_dnd_init (gimp);
|
||||
|
||||
themes_init (gimp);
|
||||
gimp_canvas_styles_init ();
|
||||
|
||||
initial_monitor = gimp_get_monitor_at_pointer ();
|
||||
|
||||
|
@ -755,6 +757,7 @@ gui_exit_after_callback (Gimp *gimp,
|
|||
gimp_devices_exit (gimp);
|
||||
dialogs_exit (gimp);
|
||||
themes_exit (gimp);
|
||||
gimp_canvas_styles_exit ();
|
||||
|
||||
g_type_class_unref (g_type_class_peek (GIMP_TYPE_COLOR_SELECT));
|
||||
|
||||
|
|
|
@ -21,14 +21,11 @@
|
|||
|
||||
#include "stamp-pdbgen.h"
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "libgimpbase/gimpbaseenums.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
|
@ -205,7 +202,7 @@ image_grid_get_foreground_color_invoker (GimpProcedure *procedure,
|
|||
gboolean success = TRUE;
|
||||
GimpValueArray *return_vals;
|
||||
GimpImage *image;
|
||||
GimpRGB fgcolor = { 0.0, 0.0, 0.0, 1.0 };
|
||||
GeglColor *fgcolor = NULL;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
|
||||
|
@ -214,7 +211,7 @@ image_grid_get_foreground_color_invoker (GimpProcedure *procedure,
|
|||
GimpGrid *grid = gimp_image_get_grid (image);
|
||||
|
||||
if (grid)
|
||||
fgcolor = grid->fgcolor;
|
||||
fgcolor = gegl_color_duplicate (grid->fgcolor);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -223,7 +220,7 @@ image_grid_get_foreground_color_invoker (GimpProcedure *procedure,
|
|||
error ? *error : NULL);
|
||||
|
||||
if (success)
|
||||
gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &fgcolor);
|
||||
g_value_take_object (gimp_value_array_index (return_vals, 1), fgcolor);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
@ -238,17 +235,17 @@ image_grid_set_foreground_color_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
GimpImage *image;
|
||||
GimpRGB fgcolor;
|
||||
GeglColor *fgcolor;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
gimp_value_get_rgb (gimp_value_array_index (args, 1), &fgcolor);
|
||||
fgcolor = g_value_get_object (gimp_value_array_index (args, 1));
|
||||
|
||||
if (success)
|
||||
{
|
||||
GimpGrid *grid = gimp_image_get_grid (image);
|
||||
|
||||
if (grid)
|
||||
g_object_set (grid, "fgcolor", &fgcolor, NULL);
|
||||
g_object_set (grid, "fgcolor", fgcolor, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -268,7 +265,7 @@ image_grid_get_background_color_invoker (GimpProcedure *procedure,
|
|||
gboolean success = TRUE;
|
||||
GimpValueArray *return_vals;
|
||||
GimpImage *image;
|
||||
GimpRGB bgcolor = { 0.0, 0.0, 0.0, 1.0 };
|
||||
GeglColor *bgcolor = NULL;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
|
||||
|
@ -277,7 +274,7 @@ image_grid_get_background_color_invoker (GimpProcedure *procedure,
|
|||
GimpGrid *grid = gimp_image_get_grid (image);
|
||||
|
||||
if (grid)
|
||||
bgcolor = grid->bgcolor;
|
||||
bgcolor = gegl_color_duplicate (grid->bgcolor);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -286,7 +283,7 @@ image_grid_get_background_color_invoker (GimpProcedure *procedure,
|
|||
error ? *error : NULL);
|
||||
|
||||
if (success)
|
||||
gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &bgcolor);
|
||||
g_value_take_object (gimp_value_array_index (return_vals, 1), bgcolor);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
@ -301,17 +298,17 @@ image_grid_set_background_color_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
GimpImage *image;
|
||||
GimpRGB bgcolor;
|
||||
GeglColor *bgcolor;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
gimp_value_get_rgb (gimp_value_array_index (args, 1), &bgcolor);
|
||||
bgcolor = g_value_get_object (gimp_value_array_index (args, 1));
|
||||
|
||||
if (success)
|
||||
{
|
||||
GimpGrid *grid = gimp_image_get_grid (image);
|
||||
|
||||
if (grid)
|
||||
g_object_set (grid, "bgcolor", &bgcolor, NULL);
|
||||
g_object_set (grid, "bgcolor", bgcolor, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -549,12 +546,11 @@ register_image_grid_procs (GimpPDB *pdb)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_rgb ("fgcolor",
|
||||
"fgcolor",
|
||||
"The image's grid foreground color",
|
||||
TRUE,
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gegl_param_spec_color ("fgcolor",
|
||||
"fgcolor",
|
||||
"The image's grid foreground color",
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
|
@ -579,12 +575,11 @@ register_image_grid_procs (GimpPDB *pdb)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_rgb ("fgcolor",
|
||||
"fgcolor",
|
||||
"The new foreground color",
|
||||
TRUE,
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gegl_param_spec_color ("fgcolor",
|
||||
"fgcolor",
|
||||
"The new foreground color",
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
|
@ -609,12 +604,11 @@ register_image_grid_procs (GimpPDB *pdb)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_rgb ("bgcolor",
|
||||
"bgcolor",
|
||||
"The image's grid background color",
|
||||
TRUE,
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gegl_param_spec_color ("bgcolor",
|
||||
"bgcolor",
|
||||
"The image's grid background color",
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
|
@ -639,12 +633,11 @@ register_image_grid_procs (GimpPDB *pdb)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_rgb ("bgcolor",
|
||||
"bgcolor",
|
||||
"The new background color",
|
||||
TRUE,
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gegl_param_spec_color ("bgcolor",
|
||||
"bgcolor",
|
||||
"The new background color",
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
|
|
|
@ -146,11 +146,11 @@ gimp_grid_editor_constructed (GObject *object)
|
|||
_("Line _style:"), 0.0, 0.5,
|
||||
style, 1);
|
||||
|
||||
color_button = gimp_prop_color_button_new (G_OBJECT (editor->grid), "fgcolor",
|
||||
_("Change grid foreground color"),
|
||||
GRID_EDITOR_COLOR_BUTTON_WIDTH,
|
||||
GRID_EDITOR_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
color_button = gimp_prop_gegl_color_button_new (G_OBJECT (editor->grid), "fgcolor",
|
||||
_("Change grid foreground color"),
|
||||
GRID_EDITOR_COLOR_BUTTON_WIDTH,
|
||||
GRID_EDITOR_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
gtk_widget_set_halign (color_button, GTK_ALIGN_START);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
|
||||
editor->context);
|
||||
|
@ -158,11 +158,11 @@ gimp_grid_editor_constructed (GObject *object)
|
|||
_("_Foreground color:"), 0.0, 0.5,
|
||||
color_button, 1);
|
||||
|
||||
color_button = gimp_prop_color_button_new (G_OBJECT (editor->grid), "bgcolor",
|
||||
_("Change grid background color"),
|
||||
GRID_EDITOR_COLOR_BUTTON_WIDTH,
|
||||
GRID_EDITOR_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
color_button = gimp_prop_gegl_color_button_new (G_OBJECT (editor->grid), "bgcolor",
|
||||
_("Change grid background color"),
|
||||
GRID_EDITOR_COLOR_BUTTON_WIDTH,
|
||||
GRID_EDITOR_COLOR_BUTTON_HEIGHT,
|
||||
GIMP_COLOR_AREA_FLAT);
|
||||
gtk_widget_set_halign (color_button, GTK_ALIGN_START);
|
||||
gimp_color_panel_set_context (GIMP_COLOR_PANEL (color_button),
|
||||
editor->context);
|
||||
|
|
|
@ -221,23 +221,21 @@ gimp_image_grid_set_offset (GimpImage *image,
|
|||
/**
|
||||
* gimp_image_grid_get_foreground_color:
|
||||
* @image: The image.
|
||||
* @fgcolor: (out caller-allocates): The image's grid foreground color.
|
||||
*
|
||||
* Sets the foreground color of an image's grid.
|
||||
*
|
||||
* This procedure gets the foreground color of an image's grid.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
* Returns: (transfer full): The image's grid foreground color.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
gboolean
|
||||
gimp_image_grid_get_foreground_color (GimpImage *image,
|
||||
GimpRGB *fgcolor)
|
||||
GeglColor *
|
||||
gimp_image_grid_get_foreground_color (GimpImage *image)
|
||||
{
|
||||
GimpValueArray *args;
|
||||
GimpValueArray *return_vals;
|
||||
gboolean success = TRUE;
|
||||
GeglColor *fgcolor = NULL;
|
||||
|
||||
args = gimp_value_array_new_from_types (NULL,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
|
@ -248,14 +246,12 @@ gimp_image_grid_get_foreground_color (GimpImage *image,
|
|||
args);
|
||||
gimp_value_array_unref (args);
|
||||
|
||||
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
||||
|
||||
if (success)
|
||||
GIMP_VALUES_GET_RGB (return_vals, 1, &*fgcolor);
|
||||
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
||||
fgcolor = g_value_dup_object (gimp_value_array_index (return_vals, 1));
|
||||
|
||||
gimp_value_array_unref (return_vals);
|
||||
|
||||
return success;
|
||||
return fgcolor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,8 +268,8 @@ gimp_image_grid_get_foreground_color (GimpImage *image,
|
|||
* Since: 2.4
|
||||
**/
|
||||
gboolean
|
||||
gimp_image_grid_set_foreground_color (GimpImage *image,
|
||||
const GimpRGB *fgcolor)
|
||||
gimp_image_grid_set_foreground_color (GimpImage *image,
|
||||
GeglColor *fgcolor)
|
||||
{
|
||||
GimpValueArray *args;
|
||||
GimpValueArray *return_vals;
|
||||
|
@ -281,7 +277,7 @@ gimp_image_grid_set_foreground_color (GimpImage *image,
|
|||
|
||||
args = gimp_value_array_new_from_types (NULL,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
GIMP_TYPE_RGB, fgcolor,
|
||||
GEGL_TYPE_COLOR, fgcolor,
|
||||
G_TYPE_NONE);
|
||||
|
||||
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
||||
|
@ -299,23 +295,21 @@ gimp_image_grid_set_foreground_color (GimpImage *image,
|
|||
/**
|
||||
* gimp_image_grid_get_background_color:
|
||||
* @image: The image.
|
||||
* @bgcolor: (out caller-allocates): The image's grid background color.
|
||||
*
|
||||
* Sets the background color of an image's grid.
|
||||
*
|
||||
* This procedure gets the background color of an image's grid.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
* Returns: (transfer full): The image's grid background color.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
gboolean
|
||||
gimp_image_grid_get_background_color (GimpImage *image,
|
||||
GimpRGB *bgcolor)
|
||||
GeglColor *
|
||||
gimp_image_grid_get_background_color (GimpImage *image)
|
||||
{
|
||||
GimpValueArray *args;
|
||||
GimpValueArray *return_vals;
|
||||
gboolean success = TRUE;
|
||||
GeglColor *bgcolor = NULL;
|
||||
|
||||
args = gimp_value_array_new_from_types (NULL,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
|
@ -326,14 +320,12 @@ gimp_image_grid_get_background_color (GimpImage *image,
|
|||
args);
|
||||
gimp_value_array_unref (args);
|
||||
|
||||
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
||||
|
||||
if (success)
|
||||
GIMP_VALUES_GET_RGB (return_vals, 1, &*bgcolor);
|
||||
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
||||
bgcolor = g_value_dup_object (gimp_value_array_index (return_vals, 1));
|
||||
|
||||
gimp_value_array_unref (return_vals);
|
||||
|
||||
return success;
|
||||
return bgcolor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -350,8 +342,8 @@ gimp_image_grid_get_background_color (GimpImage *image,
|
|||
* Since: 2.4
|
||||
**/
|
||||
gboolean
|
||||
gimp_image_grid_set_background_color (GimpImage *image,
|
||||
const GimpRGB *bgcolor)
|
||||
gimp_image_grid_set_background_color (GimpImage *image,
|
||||
GeglColor *bgcolor)
|
||||
{
|
||||
GimpValueArray *args;
|
||||
GimpValueArray *return_vals;
|
||||
|
@ -359,7 +351,7 @@ gimp_image_grid_set_background_color (GimpImage *image,
|
|||
|
||||
args = gimp_value_array_new_from_types (NULL,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
GIMP_TYPE_RGB, bgcolor,
|
||||
GEGL_TYPE_COLOR, bgcolor,
|
||||
G_TYPE_NONE);
|
||||
|
||||
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
||||
|
|
|
@ -44,14 +44,12 @@ gboolean gimp_image_grid_get_offset (GimpImage *image,
|
|||
gboolean gimp_image_grid_set_offset (GimpImage *image,
|
||||
gdouble xoffset,
|
||||
gdouble yoffset);
|
||||
gboolean gimp_image_grid_get_foreground_color (GimpImage *image,
|
||||
GimpRGB *fgcolor);
|
||||
GeglColor* gimp_image_grid_get_foreground_color (GimpImage *image);
|
||||
gboolean gimp_image_grid_set_foreground_color (GimpImage *image,
|
||||
const GimpRGB *fgcolor);
|
||||
gboolean gimp_image_grid_get_background_color (GimpImage *image,
|
||||
GimpRGB *bgcolor);
|
||||
GeglColor *fgcolor);
|
||||
GeglColor* gimp_image_grid_get_background_color (GimpImage *image);
|
||||
gboolean gimp_image_grid_set_background_color (GimpImage *image,
|
||||
const GimpRGB *bgcolor);
|
||||
GeglColor *bgcolor);
|
||||
GimpGridStyle gimp_image_grid_get_style (GimpImage *image);
|
||||
gboolean gimp_image_grid_set_style (GimpImage *image,
|
||||
GimpGridStyle style);
|
||||
|
|
|
@ -177,7 +177,7 @@ HELP
|
|||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'fgcolor', type => 'color', has_alpha => 1, void_ret => 1,
|
||||
{ name => 'fgcolor', type => 'geglcolor', has_alpha => 1,
|
||||
desc => "The image's grid foreground color" }
|
||||
);
|
||||
|
||||
|
@ -187,7 +187,7 @@ HELP
|
|||
GimpGrid *grid = gimp_image_get_grid (image);
|
||||
|
||||
if (grid)
|
||||
fgcolor = grid->fgcolor;
|
||||
fgcolor = gegl_color_duplicate (grid->fgcolor);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ HELP
|
|||
@inargs = (
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'The image' },
|
||||
{ name => 'fgcolor', type => 'color', has_alpha => 1,
|
||||
{ name => 'fgcolor', type => 'geglcolor', has_alpha => 1,
|
||||
desc => "The new foreground color" }
|
||||
);
|
||||
|
||||
|
@ -217,7 +217,7 @@ HELP
|
|||
GimpGrid *grid = gimp_image_get_grid (image);
|
||||
|
||||
if (grid)
|
||||
g_object_set (grid, "fgcolor", &fgcolor, NULL);
|
||||
g_object_set (grid, "fgcolor", fgcolor, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ HELP
|
|||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'bgcolor', type => 'color', has_alpha => 1, void_ret => 1,
|
||||
{ name => 'bgcolor', type => 'geglcolor', has_alpha => 1,
|
||||
desc => "The image's grid background color" }
|
||||
);
|
||||
|
||||
|
@ -250,7 +250,7 @@ HELP
|
|||
GimpGrid *grid = gimp_image_get_grid (image);
|
||||
|
||||
if (grid)
|
||||
bgcolor = grid->bgcolor;
|
||||
bgcolor = gegl_color_duplicate (grid->bgcolor);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ HELP
|
|||
@inargs = (
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'The image' },
|
||||
{ name => 'bgcolor', type => 'color', has_alpha => 1,
|
||||
{ name => 'bgcolor', type => 'geglcolor', has_alpha => 1,
|
||||
desc => "The new background color" }
|
||||
);
|
||||
|
||||
|
@ -280,7 +280,7 @@ HELP
|
|||
GimpGrid *grid = gimp_image_get_grid (image);
|
||||
|
||||
if (grid)
|
||||
g_object_set (grid, "bgcolor", &bgcolor, NULL);
|
||||
g_object_set (grid, "bgcolor", bgcolor, NULL);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -2466,11 +2466,11 @@ read_extended_block (FILE *f,
|
|||
{
|
||||
case PSP_XDATA_GRID:
|
||||
{
|
||||
GimpRGB color;
|
||||
guchar rgb[4];
|
||||
guint32 h_spacing;
|
||||
guint32 v_spacing;
|
||||
guint16 unit; /* Unused */
|
||||
GeglColor *color;
|
||||
guchar rgb[4];
|
||||
guint32 h_spacing;
|
||||
guint32 v_spacing;
|
||||
guint16 unit; /* Unused */
|
||||
|
||||
if (field_length != 14 ||
|
||||
fread (rgb, 4, 1, f) < 1 ||
|
||||
|
@ -2487,9 +2487,11 @@ read_extended_block (FILE *f,
|
|||
v_spacing = GUINT32_FROM_LE (v_spacing);
|
||||
gimp_image_grid_set_spacing (image, h_spacing, v_spacing);
|
||||
|
||||
gimp_rgba_set_uchar (&color, rgb[0], rgb[1], rgb[2], 255);
|
||||
gimp_image_grid_set_foreground_color (image, &color);
|
||||
gimp_image_grid_set_background_color (image, &color);
|
||||
color = gegl_color_new (NULL);
|
||||
gegl_color_set_pixel (color, babl_format ("R'G'B' u8"), rgb);
|
||||
gimp_image_grid_set_foreground_color (image, color);
|
||||
gimp_image_grid_set_background_color (image, color);
|
||||
g_object_unref (color);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue