mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-06 01:12:40 +02:00
Compare commits
1 Commits
142b79b728
...
alxsa-guid
Author | SHA1 | Date | |
---|---|---|---|
|
b6cfaf9477 |
@@ -20,11 +20,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <cairo.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gegl.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "gimpguide.h"
|
||||
@@ -35,6 +40,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_ORIENTATION,
|
||||
PROP_POSITION,
|
||||
PROP_COLOR,
|
||||
PROP_STYLE
|
||||
};
|
||||
|
||||
@@ -43,6 +49,7 @@ struct _GimpGuidePrivate
|
||||
{
|
||||
GimpOrientationType orientation;
|
||||
gint position;
|
||||
GimpRGB color;
|
||||
|
||||
GimpGuideStyle style;
|
||||
};
|
||||
@@ -65,10 +72,13 @@ static void
|
||||
gimp_guide_class_init (GimpGuideClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpRGB default_color;
|
||||
|
||||
object_class->get_property = gimp_guide_get_property;
|
||||
object_class->set_property = gimp_guide_set_property;
|
||||
|
||||
gimp_rgba_set (&default_color, 0.0, 0.8, 1.0, GIMP_OPACITY_OPAQUE);
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_ORIENTATION,
|
||||
"orientation",
|
||||
NULL, NULL,
|
||||
@@ -90,6 +100,12 @@ gimp_guide_class_init (GimpGuideClass *klass)
|
||||
GIMP_TYPE_GUIDE_STYLE,
|
||||
GIMP_GUIDE_STYLE_NONE,
|
||||
0);
|
||||
|
||||
GIMP_CONFIG_PROP_RGB (object_class, PROP_COLOR,
|
||||
"color",
|
||||
NULL, NULL,
|
||||
TRUE, &default_color,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -114,6 +130,9 @@ gimp_guide_get_property (GObject *object,
|
||||
case PROP_POSITION:
|
||||
g_value_set_int (value, guide->priv->position);
|
||||
break;
|
||||
case PROP_COLOR:
|
||||
gimp_value_set_rgb (value, &guide->priv->color);
|
||||
break;
|
||||
case PROP_STYLE:
|
||||
g_value_set_enum (value, guide->priv->style);
|
||||
break;
|
||||
@@ -139,6 +158,9 @@ gimp_guide_set_property (GObject *object,
|
||||
case PROP_POSITION:
|
||||
guide->priv->position = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_COLOR:
|
||||
gimp_value_get_rgb (value, &guide->priv->color);
|
||||
break;
|
||||
case PROP_STYLE:
|
||||
guide->priv->style = g_value_get_enum (value);
|
||||
break;
|
||||
@@ -150,11 +172,20 @@ gimp_guide_set_property (GObject *object,
|
||||
|
||||
GimpGuide *
|
||||
gimp_guide_new (GimpOrientationType orientation,
|
||||
guint32 guide_ID)
|
||||
guint32 guide_ID,
|
||||
GimpRGB *color)
|
||||
{
|
||||
GimpRGB guide_color;
|
||||
|
||||
if (! color)
|
||||
gimp_rgba_set (&guide_color, 0.0, 0.8, 1.0, 1.0);
|
||||
else
|
||||
gimp_rgba_set (&guide_color, color->r, color->g, color->b, 1.0);
|
||||
|
||||
return g_object_new (GIMP_TYPE_GUIDE,
|
||||
"id", guide_ID,
|
||||
"orientation", orientation,
|
||||
"color", &guide_color,
|
||||
"style", GIMP_GUIDE_STYLE_NORMAL,
|
||||
NULL);
|
||||
}
|
||||
@@ -225,6 +256,15 @@ gimp_guide_set_position (GimpGuide *guide,
|
||||
g_object_notify (G_OBJECT (guide), "position");
|
||||
}
|
||||
|
||||
void
|
||||
gimp_guide_get_color (GimpGuide *guide,
|
||||
GimpRGB *color)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GUIDE (guide));
|
||||
|
||||
*color = guide->priv->color;
|
||||
}
|
||||
|
||||
GimpGuideStyle
|
||||
gimp_guide_get_style (GimpGuide *guide)
|
||||
{
|
||||
|
@@ -55,7 +55,8 @@ struct _GimpGuideClass
|
||||
GType gimp_guide_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpGuide * gimp_guide_new (GimpOrientationType orientation,
|
||||
guint32 guide_ID);
|
||||
guint32 guide_ID,
|
||||
GimpRGB *color);
|
||||
GimpGuide * gimp_guide_custom_new (GimpOrientationType orientation,
|
||||
guint32 guide_ID,
|
||||
GimpGuideStyle guide_style);
|
||||
@@ -68,6 +69,9 @@ gint gimp_guide_get_position (GimpGuide *guide);
|
||||
void gimp_guide_set_position (GimpGuide *guide,
|
||||
gint position);
|
||||
|
||||
void gimp_guide_get_color (GimpGuide *guide,
|
||||
GimpRGB *color);
|
||||
|
||||
GimpGuideStyle gimp_guide_get_style (GimpGuide *guide);
|
||||
gboolean gimp_guide_is_custom (GimpGuide *guide);
|
||||
|
||||
|
@@ -457,15 +457,18 @@ gimp_image_duplicate_guides (GimpImage *image,
|
||||
{
|
||||
GimpGuide *guide = list->data;
|
||||
gint position = gimp_guide_get_position (guide);
|
||||
GimpRGB color;
|
||||
|
||||
gimp_guide_get_color (guide, &color);
|
||||
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_image_add_hguide (new_image, position, FALSE);
|
||||
gimp_image_add_hguide (new_image, position, &color, FALSE);
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_image_add_vguide (new_image, position, FALSE);
|
||||
gimp_image_add_vguide (new_image, position, &color, FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -37,6 +37,7 @@
|
||||
GimpGuide *
|
||||
gimp_image_add_hguide (GimpImage *image,
|
||||
gint position,
|
||||
GimpRGB *color,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpGuide *guide;
|
||||
@@ -44,7 +45,8 @@ gimp_image_add_hguide (GimpImage *image,
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
guide = gimp_guide_new (GIMP_ORIENTATION_HORIZONTAL,
|
||||
image->gimp->next_guide_id++);
|
||||
image->gimp->next_guide_id++,
|
||||
color);
|
||||
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_guide (image,
|
||||
@@ -59,6 +61,7 @@ gimp_image_add_hguide (GimpImage *image,
|
||||
GimpGuide *
|
||||
gimp_image_add_vguide (GimpImage *image,
|
||||
gint position,
|
||||
GimpRGB *color,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpGuide *guide;
|
||||
@@ -66,7 +69,8 @@ gimp_image_add_vguide (GimpImage *image,
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
guide = gimp_guide_new (GIMP_ORIENTATION_VERTICAL,
|
||||
image->gimp->next_guide_id++);
|
||||
image->gimp->next_guide_id++,
|
||||
color);
|
||||
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_guide (image,
|
||||
|
@@ -23,9 +23,11 @@
|
||||
*/
|
||||
GimpGuide * gimp_image_add_hguide (GimpImage *image,
|
||||
gint position,
|
||||
GimpRGB *color,
|
||||
gboolean push_undo);
|
||||
GimpGuide * gimp_image_add_vguide (GimpImage *image,
|
||||
gint position,
|
||||
GimpRGB *color,
|
||||
gboolean push_undo);
|
||||
|
||||
/* internal guide adding API, does not check the guide's position and
|
||||
|
@@ -98,6 +98,7 @@ static const GimpRGB tool_fg_highlight = { 1.0, 0.8, 0.2, 0.8 };
|
||||
void
|
||||
gimp_canvas_set_guide_style (GtkWidget *canvas,
|
||||
cairo_t *cr,
|
||||
GimpRGB *color,
|
||||
GimpGuideStyle style,
|
||||
gboolean active,
|
||||
gdouble offset_x,
|
||||
@@ -118,6 +119,8 @@ gimp_canvas_set_guide_style (GtkWidget *canvas,
|
||||
case GIMP_GUIDE_STYLE_NORMAL:
|
||||
normal_fg = guide_normal_fg;
|
||||
normal_bg = guide_normal_bg;
|
||||
if (color)
|
||||
gimp_rgba_set (&normal_bg, color->r, color->g, color->b, 1.0);
|
||||
active_fg = guide_active_fg;
|
||||
active_bg = guide_active_bg;
|
||||
line_width = 1.0;
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
void gimp_canvas_set_guide_style (GtkWidget *canvas,
|
||||
cairo_t *cr,
|
||||
GimpRGB *color,
|
||||
GimpGuideStyle style,
|
||||
gboolean active,
|
||||
gdouble offset_x,
|
||||
|
@@ -20,12 +20,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <cairo.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "display-types.h"
|
||||
|
||||
#include "gimpcanvas-style.h"
|
||||
@@ -38,6 +42,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_ORIENTATION,
|
||||
PROP_POSITION,
|
||||
PROP_COLOR,
|
||||
PROP_STYLE
|
||||
};
|
||||
|
||||
@@ -48,6 +53,7 @@ struct _GimpCanvasGuidePrivate
|
||||
{
|
||||
GimpOrientationType orientation;
|
||||
gint position;
|
||||
GimpRGB color;
|
||||
|
||||
GimpGuideStyle style;
|
||||
};
|
||||
@@ -84,6 +90,7 @@ gimp_canvas_guide_class_init (GimpCanvasGuideClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpCanvasItemClass *item_class = GIMP_CANVAS_ITEM_CLASS (klass);
|
||||
GimpRGB default_color;
|
||||
|
||||
object_class->set_property = gimp_canvas_guide_set_property;
|
||||
object_class->get_property = gimp_canvas_guide_get_property;
|
||||
@@ -92,6 +99,8 @@ gimp_canvas_guide_class_init (GimpCanvasGuideClass *klass)
|
||||
item_class->get_extents = gimp_canvas_guide_get_extents;
|
||||
item_class->stroke = gimp_canvas_guide_stroke;
|
||||
|
||||
gimp_rgba_set (&default_color, 0.0, 0.8, 1.0, GIMP_OPACITY_OPAQUE);
|
||||
|
||||
g_object_class_install_property (object_class, PROP_ORIENTATION,
|
||||
g_param_spec_enum ("orientation", NULL, NULL,
|
||||
GIMP_TYPE_ORIENTATION_TYPE,
|
||||
@@ -104,6 +113,12 @@ gimp_canvas_guide_class_init (GimpCanvasGuideClass *klass)
|
||||
GIMP_MAX_IMAGE_SIZE, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_COLOR,
|
||||
gimp_param_spec_rgb ("color", NULL, NULL,
|
||||
TRUE, &default_color,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_STYLE,
|
||||
g_param_spec_enum ("style", NULL, NULL,
|
||||
GIMP_TYPE_GUIDE_STYLE,
|
||||
@@ -132,6 +147,9 @@ gimp_canvas_guide_set_property (GObject *object,
|
||||
case PROP_POSITION:
|
||||
private->position = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_COLOR:
|
||||
gimp_value_get_rgb (value, &private->color);
|
||||
break;
|
||||
case PROP_STYLE:
|
||||
private->style = g_value_get_enum (value);
|
||||
break;
|
||||
@@ -158,6 +176,9 @@ gimp_canvas_guide_get_property (GObject *object,
|
||||
case PROP_POSITION:
|
||||
g_value_set_int (value, private->position);
|
||||
break;
|
||||
case PROP_COLOR:
|
||||
gimp_value_set_rgb (value, &private->color);
|
||||
break;
|
||||
case PROP_STYLE:
|
||||
g_value_set_enum (value, private->style);
|
||||
break;
|
||||
@@ -247,10 +268,10 @@ gimp_canvas_guide_stroke (GimpCanvasItem *item,
|
||||
|
||||
if (private->style != GIMP_GUIDE_STYLE_NONE)
|
||||
{
|
||||
GimpDisplayShell *shell = gimp_canvas_item_get_shell (item);
|
||||
GimpDisplayShell *shell = gimp_canvas_item_get_shell (item);
|
||||
|
||||
gimp_canvas_set_guide_style (gimp_canvas_item_get_canvas (item), cr,
|
||||
private->style,
|
||||
&private->color, private->style,
|
||||
gimp_canvas_item_get_highlight (item),
|
||||
shell->offset_x, shell->offset_y);
|
||||
cairo_stroke (cr);
|
||||
@@ -265,6 +286,7 @@ GimpCanvasItem *
|
||||
gimp_canvas_guide_new (GimpDisplayShell *shell,
|
||||
GimpOrientationType orientation,
|
||||
gint position,
|
||||
GimpRGB *color,
|
||||
GimpGuideStyle style)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
||||
@@ -273,6 +295,7 @@ gimp_canvas_guide_new (GimpDisplayShell *shell,
|
||||
"shell", shell,
|
||||
"orientation", orientation,
|
||||
"position", position,
|
||||
"color", color,
|
||||
"style", style,
|
||||
NULL);
|
||||
}
|
||||
|
@@ -52,6 +52,7 @@ GType gimp_canvas_guide_get_type (void) G_GNUC_CONST;
|
||||
GimpCanvasItem * gimp_canvas_guide_new (GimpDisplayShell *shell,
|
||||
GimpOrientationType orientation,
|
||||
gint position,
|
||||
GimpRGB *color,
|
||||
GimpGuideStyle style);
|
||||
|
||||
void gimp_canvas_guide_set (GimpCanvasItem *guide,
|
||||
|
@@ -722,11 +722,14 @@ gimp_display_shell_guide_add_handler (GimpImage *image,
|
||||
GimpCanvasProxyGroup *group = GIMP_CANVAS_PROXY_GROUP (shell->guides);
|
||||
GimpCanvasItem *item;
|
||||
GimpGuideStyle style;
|
||||
GimpRGB color;
|
||||
|
||||
gimp_guide_get_color (guide, &color);
|
||||
style = gimp_guide_get_style (guide);
|
||||
item = gimp_canvas_guide_new (shell,
|
||||
gimp_guide_get_orientation (guide),
|
||||
gimp_guide_get_position (guide),
|
||||
&color,
|
||||
style);
|
||||
|
||||
gimp_canvas_proxy_group_add_item (group, guide, item);
|
||||
|
@@ -21,10 +21,14 @@
|
||||
|
||||
#include "stamp-pdbgen.h"
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
#include "pdb-types.h"
|
||||
@@ -57,10 +61,12 @@ image_add_hguide_invoker (GimpProcedure *procedure,
|
||||
GimpValueArray *return_vals;
|
||||
GimpImage *image;
|
||||
gint yposition;
|
||||
GimpRGB color;
|
||||
guint guide = 0;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
yposition = g_value_get_int (gimp_value_array_index (args, 1));
|
||||
gimp_value_get_rgb (gimp_value_array_index (args, 2), &color);
|
||||
|
||||
if (success)
|
||||
{
|
||||
@@ -68,7 +74,7 @@ image_add_hguide_invoker (GimpProcedure *procedure,
|
||||
{
|
||||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_hguide (image, yposition, TRUE);
|
||||
g = gimp_image_add_hguide (image, yposition, &color, TRUE);
|
||||
guide = gimp_aux_item_get_id (GIMP_AUX_ITEM (g));
|
||||
}
|
||||
else
|
||||
@@ -96,10 +102,12 @@ image_add_vguide_invoker (GimpProcedure *procedure,
|
||||
GimpValueArray *return_vals;
|
||||
GimpImage *image;
|
||||
gint xposition;
|
||||
GimpRGB color;
|
||||
guint guide = 0;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
xposition = g_value_get_int (gimp_value_array_index (args, 1));
|
||||
gimp_value_get_rgb (gimp_value_array_index (args, 2), &color);
|
||||
|
||||
if (success)
|
||||
{
|
||||
@@ -107,7 +115,7 @@ image_add_vguide_invoker (GimpProcedure *procedure,
|
||||
{
|
||||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_vguide (image, xposition, TRUE);
|
||||
g = gimp_image_add_vguide (image, xposition, &color, TRUE);
|
||||
guide = gimp_aux_item_get_id (GIMP_AUX_ITEM (g));
|
||||
}
|
||||
else
|
||||
@@ -296,6 +304,13 @@ register_image_guides_procs (GimpPDB *pdb)
|
||||
"The guide's y-offset from top of image",
|
||||
0, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_rgb ("color",
|
||||
"color",
|
||||
"The main guide color",
|
||||
TRUE,
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_uint ("guide",
|
||||
"guide",
|
||||
@@ -331,6 +346,13 @@ register_image_guides_procs (GimpPDB *pdb)
|
||||
"The guide's x-offset from left of image",
|
||||
0, G_MAXINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_rgb ("color",
|
||||
"color",
|
||||
"The main guide color",
|
||||
TRUE,
|
||||
NULL,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_uint ("guide",
|
||||
"guide",
|
||||
|
@@ -437,15 +437,19 @@ gimp_create_mainimage (Gimp *gimp,
|
||||
/* Guides, note we add them in reversed order */
|
||||
gimp_image_add_hguide (image,
|
||||
GIMP_MAINIMAGE_HGUIDE2_POS,
|
||||
NULL,
|
||||
FALSE /*push_undo*/);
|
||||
gimp_image_add_hguide (image,
|
||||
GIMP_MAINIMAGE_HGUIDE1_POS,
|
||||
NULL,
|
||||
FALSE /*push_undo*/);
|
||||
gimp_image_add_vguide (image,
|
||||
GIMP_MAINIMAGE_VGUIDE2_POS,
|
||||
NULL,
|
||||
FALSE /*push_undo*/);
|
||||
gimp_image_add_vguide (image,
|
||||
GIMP_MAINIMAGE_VGUIDE1_POS,
|
||||
NULL,
|
||||
FALSE /*push_undo*/);
|
||||
|
||||
|
||||
|
@@ -940,7 +940,7 @@ gimp_draw_tool_add_guide (GimpDrawTool *draw_tool,
|
||||
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), NULL);
|
||||
|
||||
item = gimp_canvas_guide_new (gimp_display_get_shell (draw_tool->display),
|
||||
orientation, position,
|
||||
orientation, position, NULL,
|
||||
style);
|
||||
|
||||
gimp_draw_tool_add_item (draw_tool, item);
|
||||
|
@@ -216,12 +216,14 @@ gimp_guide_tool_button_release (GimpTool *tool,
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_image_add_hguide (image,
|
||||
guide->position,
|
||||
NULL,
|
||||
TRUE);
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_image_add_vguide (image,
|
||||
guide->position,
|
||||
NULL,
|
||||
TRUE);
|
||||
break;
|
||||
|
||||
|
@@ -452,10 +452,10 @@ gimp_measure_tool_compass_create_guides (GimpToolWidget *widget,
|
||||
_("Add Guides"));
|
||||
|
||||
if (horizontal)
|
||||
gimp_image_add_hguide (image, y, TRUE);
|
||||
gimp_image_add_hguide (image, y, NULL, TRUE);
|
||||
|
||||
if (vertical)
|
||||
gimp_image_add_vguide (image, x, TRUE);
|
||||
gimp_image_add_vguide (image, x, NULL, TRUE);
|
||||
|
||||
if (horizontal && vertical)
|
||||
gimp_image_undo_group_end (image);
|
||||
|
@@ -1146,7 +1146,7 @@ xcf_load_image_props (XcfInfo *info,
|
||||
"Ignoring off-canvas horizontal guide (position %d) in XCF %d file",
|
||||
position, info->file_version);
|
||||
else
|
||||
gimp_image_add_hguide (image, position, FALSE);
|
||||
gimp_image_add_hguide (image, position, NULL, FALSE);
|
||||
break;
|
||||
|
||||
case XCF_ORIENTATION_VERTICAL:
|
||||
@@ -1156,7 +1156,7 @@ xcf_load_image_props (XcfInfo *info,
|
||||
"Ignoring off-canvas vertical guide (position %d) in XCF %d file",
|
||||
position, info->file_version);
|
||||
else
|
||||
gimp_image_add_vguide (image, position, FALSE);
|
||||
gimp_image_add_vguide (image, position, NULL, FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -31,7 +31,9 @@ HELP
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'The image' },
|
||||
{ name => 'yposition', type => '0 <= int32',
|
||||
desc => "The guide's y-offset from top of image" }
|
||||
desc => "The guide's y-offset from top of image" },
|
||||
{ name => 'color', type => 'color', has_alpha => 1,
|
||||
desc => "The main guide color" }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
@@ -46,7 +48,7 @@ HELP
|
||||
{
|
||||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_hguide (image, yposition, TRUE);
|
||||
g = gimp_image_add_hguide (image, yposition, &color, TRUE);
|
||||
guide = gimp_aux_item_get_id (GIMP_AUX_ITEM (g));
|
||||
}
|
||||
else
|
||||
@@ -71,7 +73,9 @@ HELP
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'The image' },
|
||||
{ name => 'xposition', type => '0 <= int32',
|
||||
desc => "The guide's x-offset from left of image" }
|
||||
desc => "The guide's x-offset from left of image" },
|
||||
{ name => 'color', type => 'color', has_alpha => 1,
|
||||
desc => "The main guide color" }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
@@ -86,7 +90,7 @@ HELP
|
||||
{
|
||||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_vguide (image, xposition, TRUE);
|
||||
g = gimp_image_add_vguide (image, xposition, &color, TRUE);
|
||||
guide = gimp_aux_item_get_id (GIMP_AUX_ITEM (g));
|
||||
}
|
||||
else
|
||||
|
@@ -550,7 +550,8 @@ size_adjustment_callback (GtkAdjustment *adjustment,
|
||||
adj->guides = g_new (gint32, adj->nguides);
|
||||
for (i = 0; i < adj->nguides; i++)
|
||||
adj->guides[i] = gimp_image_add_vguide (adj->image,
|
||||
*(adj->value) * (i+1));
|
||||
*(adj->value) * (i+1),
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -560,7 +561,8 @@ size_adjustment_callback (GtkAdjustment *adjustment,
|
||||
adj->guides = g_new (gint32, adj->nguides);
|
||||
for (i = 0; i < adj->nguides; i++)
|
||||
adj->guides[i] = gimp_image_add_hguide (adj->image,
|
||||
*(adj->value) * (i+1));
|
||||
*(adj->value) * (i+1),
|
||||
NULL);
|
||||
}
|
||||
gimp_displays_flush ();
|
||||
g_snprintf (buf, sizeof (buf), "%2d", newn);
|
||||
|
@@ -2300,9 +2300,9 @@ read_tube_block (FILE *f,
|
||||
selection_mode = GUINT32_FROM_LE (selection_mode);
|
||||
|
||||
for (i = 1; i < params.cols; i++)
|
||||
gimp_image_add_vguide (image, (ia->width * i)/params.cols);
|
||||
gimp_image_add_vguide (image, (ia->width * i)/params.cols, NULL);
|
||||
for (i = 1; i < params.rows; i++)
|
||||
gimp_image_add_hguide (image, (ia->height * i)/params.rows);
|
||||
gimp_image_add_hguide (image, (ia->height * i)/params.rows, NULL);
|
||||
|
||||
/* We use a parasite to pass in the tube (pipe) parameters in
|
||||
* case we will have any use of those, for instance in the gpb
|
||||
|
@@ -970,9 +970,9 @@ load_resource_1032 (const PSDimageres *res_a,
|
||||
guide.fDirection);
|
||||
|
||||
if (guide.fDirection == PSD_VERTICAL)
|
||||
gimp_image_add_vguide (image, guide.fLocation);
|
||||
gimp_image_add_vguide (image, guide.fLocation, NULL);
|
||||
else
|
||||
gimp_image_add_hguide (image, guide.fLocation);
|
||||
gimp_image_add_hguide (image, guide.fLocation, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
;; -*-scheme-*-
|
||||
|
||||
(define (script-fu-guides-from-selection image drawable)
|
||||
(define (script-fu-guides-from-selection image drawable color)
|
||||
(let* (
|
||||
(boundaries (gimp-selection-bounds image))
|
||||
;; non-empty INT32 TRUE if there is a selection
|
||||
@@ -16,10 +16,10 @@
|
||||
(begin
|
||||
(gimp-image-undo-group-start image)
|
||||
|
||||
(gimp-image-add-vguide image x1)
|
||||
(gimp-image-add-hguide image y1)
|
||||
(gimp-image-add-vguide image x2)
|
||||
(gimp-image-add-hguide image y2)
|
||||
(gimp-image-add-vguide image x1 color)
|
||||
(gimp-image-add-hguide image y1 color)
|
||||
(gimp-image-add-vguide image x2 color)
|
||||
(gimp-image-add-hguide image y2 color)
|
||||
|
||||
(gimp-image-undo-group-end image)
|
||||
(gimp-displays-flush)
|
||||
@@ -37,6 +37,7 @@
|
||||
"*"
|
||||
SF-IMAGE "Image" 0
|
||||
SF-DRAWABLE "Drawable" 0
|
||||
SF-COLOR _"_Guide Color" '(0 204 255)
|
||||
)
|
||||
|
||||
(script-fu-menu-register "script-fu-guides-from-selection"
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
;; Alan Horkan 2004. No copyright. Public Domain.
|
||||
|
||||
(define (script-fu-guide-new-percent image drawable direction position)
|
||||
(define (script-fu-guide-new-percent image drawable direction position color)
|
||||
(let* (
|
||||
(width (car (gimp-image-get-width image)))
|
||||
(height (car (gimp-image-get-height image)))
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
(if (= direction 0)
|
||||
;; convert position to pixel
|
||||
(if (<= position height) (gimp-image-add-hguide image position))
|
||||
(if (<= position width) (gimp-image-add-vguide image position))
|
||||
(if (<= position height) (gimp-image-add-hguide image position color))
|
||||
(if (<= position width) (gimp-image-add-vguide image position color))
|
||||
)
|
||||
|
||||
(gimp-displays-flush)
|
||||
@@ -35,6 +35,7 @@
|
||||
SF-OPTION _"_Direction" '(_"Horizontal"
|
||||
_"Vertical")
|
||||
SF-ADJUSTMENT _"_Position (in %)" '(50 0 100 1 10 2 1)
|
||||
SF-COLOR _"_Guide Color" '(0 204 255)
|
||||
)
|
||||
|
||||
(script-fu-menu-register "script-fu-guide-new-percent"
|
||||
|
@@ -7,7 +7,8 @@
|
||||
(define (script-fu-guide-new image
|
||||
drawable
|
||||
direction
|
||||
position)
|
||||
position
|
||||
color)
|
||||
(let* (
|
||||
(width (car (gimp-image-get-width image)))
|
||||
(height (car (gimp-image-get-height image)))
|
||||
@@ -15,8 +16,8 @@
|
||||
|
||||
(if (= direction 0)
|
||||
;; check position is inside the image boundaries
|
||||
(if (<= position height) (gimp-image-add-hguide image position))
|
||||
(if (<= position width) (gimp-image-add-vguide image position))
|
||||
(if (<= position height) (gimp-image-add-hguide image position color))
|
||||
(if (<= position width) (gimp-image-add-vguide image position color))
|
||||
)
|
||||
|
||||
(gimp-displays-flush)
|
||||
@@ -34,6 +35,7 @@
|
||||
SF-DRAWABLE "Drawable" 0
|
||||
SF-OPTION _"_Direction" '(_"Horizontal" _"Vertical")
|
||||
SF-ADJUSTMENT _"_Position" (list 0 0 MAX-IMAGE-SIZE 1 10 0 1)
|
||||
SF-COLOR _"_Guide Color"'(0 204 255)
|
||||
)
|
||||
|
||||
(script-fu-menu-register "script-fu-guide-new"
|
||||
|
Reference in New Issue
Block a user