[gimp] app: add totally evil "heuristic" for picking coords to GimpOperationTool
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add totally evil "heuristic" for picking coords to GimpOperationTool
- Date: Fri, 31 May 2013 20:58:22 +0000 (UTC)
commit 01ada21ae6a84202a283e694488fdf781cdc8f65
Author: Michael Natterer <mitch gimp org>
Date: Fri May 31 22:56:27 2013 +0200
app: add totally evil "heuristic" for picking coords to GimpOperationTool
This can't continue like that, GEGL properties need to be tagged
somehow using gegl_operation_class_set_keys(), as planned.
app/tools/gimpoperationtool.c | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimpoperationtool.c b/app/tools/gimpoperationtool.c
index 2a70cc7..822cfed 100644
--- a/app/tools/gimpoperationtool.c
+++ b/app/tools/gimpoperationtool.c
@@ -282,6 +282,8 @@ gimp_operation_tool_color_picked (GimpImageMapTool *im_tool,
GObjectClass *object_class = G_OBJECT_GET_CLASS (tool->config);
GParamSpec *pspec_x;
GParamSpec *pspec_y;
+ gint width = 1;
+ gint height = 1;
/* the operation's coordinate system is the selection bounds of
* the drawable
@@ -296,7 +298,7 @@ gimp_operation_tool_color_picked (GimpImageMapTool *im_tool,
y -= off_y;
if (gimp_item_mask_intersect (GIMP_ITEM (drawable),
- &off_x, &off_y, NULL, NULL))
+ &off_x, &off_y, &width, &height))
{
x -= off_x;
y -= off_y;
@@ -330,6 +332,31 @@ gimp_operation_tool_color_picked (GimpImageMapTool *im_tool,
}
else if (G_IS_PARAM_SPEC_DOUBLE (pspec_x))
{
+ GParamSpecDouble *dspec_x = G_PARAM_SPEC_DOUBLE (pspec_x);
+ GParamSpecDouble *dspec_y = G_PARAM_SPEC_DOUBLE (pspec_y);
+
+ /* handle what certain well known ops use as extent,
+ * this is by no measure proper code...
+ */
+ if (dspec_x->minimum == 0.0 && dspec_x->maximum == 1.0 &&
+ dspec_y->minimum == 0.0 && dspec_y->maximum == 1.0)
+ {
+ x /= width;
+ y /= height;
+ }
+ else if (dspec_x->minimum == -1.0 && dspec_x->maximum == 2.0 &&
+ dspec_y->minimum == -1.0 && dspec_y->maximum == 2.0)
+ {
+ x /= width;
+ y /= height;
+ }
+ else if (dspec_x->minimum == -1.0 && dspec_x->maximum == 1.0 &&
+ dspec_y->minimum == -1.0 && dspec_y->maximum == 1.0)
+ {
+ x = x * 2.0 / width - 1.0;
+ y = y * 2.0 / height - 1.0;
+ }
+
g_value_set_double (&value_x, x);
g_value_set_double (&value_y, y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]