[gimp/gimp-2-10] Issue #4484: Add reflection option for mandala symmetry
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #4484: Add reflection option for mandala symmetry
- Date: Sat, 11 Jan 2020 23:04:59 +0000 (UTC)
commit ec10b374219fa474049eec92e37c77658448c3ee
Author: Elad Shahar <dawn ever gmail com>
Date: Sat Jan 11 07:51:27 2020 +0200
Issue #4484: Add reflection option for mandala symmetry
(cherry picked from commit 36dd48aea64308d7a911c26d2faef69b1b880be4)
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 c8c4b0e2ea..6c575b02ce 100644
--- a/app/core/gimpsymmetry-mandala.c
+++ b/app/core/gimpsymmetry-mandala.c
@@ -51,6 +51,7 @@ enum
PROP_CENTER_Y,
PROP_SIZE,
PROP_DISABLE_TRANSFORMATION,
+ PROP_ENABLE_REFLECTION,
};
@@ -154,6 +155,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
@@ -243,6 +252,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;
@@ -271,6 +284,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;
@@ -457,7 +473,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]