reflect: use gegl-op.h instead of custom chant

parent fc27f6f1
......@@ -41,12 +41,12 @@ gegl_module_query (GTypeModule *module)
GType gegl_op_rotate_register_type (GTypeModule *module);
GType gegl_op_rotate_on_center_register_type (GTypeModule *module);
GType gegl_op_reflect_register_type (GTypeModule *module);
GType scale_ratio_get_type (void);
GType scale_size_get_type (void);
GType scale_size_keepaspect_get_type (void);
GType shear_get_type (void);
GType translate_get_type (void);
GType reflect_get_type (void);
GType transform_get_type (void);
#include <stdio.h>
......@@ -63,9 +63,9 @@ gegl_module_register (GTypeModule *module)
dummy = scale_size_keepaspect_get_type ();
dummy = shear_get_type ();
dummy = translate_get_type ();
dummy = reflect_get_type ();
dummy = transform_get_type ();
dummy = gegl_op_rotate_register_type (module);
dummy = gegl_op_reflect_register_type (module);
dummy = gegl_op_rotate_on_center_register_type (module);
dummy ++; /* silence gcc, having it is required to avoid optimizing
......@@ -15,35 +15,45 @@
* Copyright 2006 Dominik Ernst
* 2012 Nicolas Robidoux
* Reflect an image about a line, whose direction is specified by the
* vector that is defined by the x and y properties.
* 2017 Øyvind Kolås
#include "config.h"
#include <glib/gi18n-lib.h>
property_double (x, _("X"), 0.0)
description (_("Direction vector's X component"))
ui_range (-100.0, 100.0)
property_double (y, _("Y"), 0.0)
description (_("Direction vector's Y component"))
ui_range (-100.0, 100.0)
gegl_chant_double (x, -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
_("Direction vector's X component"))
gegl_chant_double (y, -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
_("Direction vector's Y component"))
#define GEGL_CHANT_NAME reflect
#define GEGL_CHANT_SELF "reflect.c"
#include "chant.h"
#include "gegl-operation-filter.h"
#include "transform-core.h"
#define GEGL_OP_Parent OpTransform
#define GEGL_OP_NAME reflect
#define GEGL_OP_C_FILE "reflect.c"
#include "gegl-op.h"
#include <math.h>
static void
create_matrix (OpTransform *op,
GeglMatrix3 *matrix)
GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
const gdouble ux = chant->x;
const gdouble uy = chant->y;
GeglProperties *o = GEGL_PROPERTIES (op);
const gdouble ux = o->x;
const gdouble uy = o->y;
* There probably should be an assertion or check+fix that
......@@ -57,4 +67,26 @@ create_matrix (OpTransform *op,
matrix->coeff [0][1] = matrix->coeff [1][0] = ux*uy * two_over_length_squared;
#include <stdio.h>
static void
gegl_op_class_init (GeglOpClass *klass)
GeglOperationClass *operation_class;
OpTransformClass *transform_class;
operation_class = GEGL_OPERATION_CLASS (klass);
transform_class = OP_TRANSFORM_CLASS (klass);
transform_class->create_matrix = create_matrix;
gegl_operation_class_set_keys (operation_class,
"name", "gegl:reflect",
"title", _("Reflect"),
"categories", "transform",
"description", _("Reflect an image about a line, whose direction is "
"specified by the vector that is defined by the "
"x and y properties. "),
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment