[gimp] Issue #4484: Add reflection option for mandala symmetry
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #4484: Add reflection option for mandala symmetry
- Date: Sat, 11 Jan 2020 22:55:10 +0000 (UTC)
commit 36dd48aea64308d7a911c26d2faef69b1b880be4
Author: Elad Shahar <dawn ever gmail com>
Date: Sat Jan 11 07:51:27 2020 +0200
Issue #4484: Add reflection option for mandala symmetry
app/core/gimpsymmetry-mandala.c | 26 +++++++++++++++++++++++++-
app/core/gimpsymmetry-mandala.h | 1 +
2 files changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimpsymmetry-mandala.c b/app/core/gimpsymmetry-mandala.c
index b00366df82..653db9fe7f 100644
--- a/app/core/gimpsymmetry-mandala.c
+++ b/app/core/gimpsymmetry-mandala.c
@@ -52,6 +52,7 @@ enum
PROP_CENTER_Y,
PROP_SIZE,
PROP_DISABLE_TRANSFORMATION,
+ PROP_ENABLE_REFLECTION,
};
@@ -155,6 +156,14 @@ gimp_mandala_class_init (GimpMandalaClass *klass)
FALSE,
GIMP_PARAM_STATIC_STRINGS |
GIMP_SYMMETRY_PARAM_GUI);
+
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_ENABLE_REFLECTION,
+ "enable-reflection",
+ _("Enable reflection"),
+ _("Enable reflection"),
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS |
+ GIMP_SYMMETRY_PARAM_GUI);
}
static void
@@ -244,6 +253,10 @@ gimp_mandala_set_property (GObject *object,
mandala->disable_transformation = g_value_get_boolean (value);
break;
+ case PROP_ENABLE_REFLECTION:
+ mandala->enable_reflection = g_value_get_boolean (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -272,6 +285,9 @@ gimp_mandala_get_property (GObject *object,
case PROP_DISABLE_TRANSFORMATION:
g_value_set_boolean (value, mandala->disable_transformation);
break;
+ case PROP_ENABLE_REFLECTION:
+ g_value_set_boolean (value, mandala->enable_reflection);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -458,7 +474,15 @@ gimp_mandala_update_strokes (GimpSymmetry *sym,
gimp_matrix3_translate (&matrix,
- mandala->center_x,
- mandala->center_y);
- gimp_matrix3_rotate (&matrix, - i * 2.0 * G_PI / (gdouble) mandala->size);
+ if ( mandala->enable_reflection && i % 2 == 1 )
+ {
+ gimp_matrix3_scale (&matrix, -1, 1);
+ gimp_matrix3_rotate (&matrix, G_PI - (i+1) * 2.0 * G_PI / (gdouble) mandala->size);
+ }
+ else
+ {
+ gimp_matrix3_rotate (&matrix, - i * 2.0 * G_PI / (gdouble) mandala->size);
+ }
gimp_matrix3_translate (&matrix,
mandala->center_x,
mandala->center_y);
diff --git a/app/core/gimpsymmetry-mandala.h b/app/core/gimpsymmetry-mandala.h
index d7486f5b68..0978a40593 100644
--- a/app/core/gimpsymmetry-mandala.h
+++ b/app/core/gimpsymmetry-mandala.h
@@ -43,6 +43,7 @@ struct _GimpMandala
gdouble center_y;
gint size;
gboolean disable_transformation;
+ gboolean enable_reflection;
GimpGuide *horizontal_guide;
GimpGuide *vertical_guide;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]