[gegl] Revert "operations: use enums instead of ints in fractal-explorer"
- From: Michael Muré <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Revert "operations: use enums instead of ints in fractal-explorer"
- Date: Tue, 4 Jun 2013 18:02:37 +0000 (UTC)
commit 887912fdea34941d136f9d44dce454d70d85ee2e
Author: Michael Muré <batolettre gmail com>
Date: Tue Jun 4 19:47:58 2013 +0200
Revert "operations: use enums instead of ints in fractal-explorer"
This reverts commit 57f5a38417bdfecc44e3e5c8692a5fc998fb1403.
Revert because of duplicate work in the next-API branch.
Rebasing this branch on top of master is much easier this way.
operations/common/fractal-explorer.c | 101 ++++++++++++++++-----------------
1 files changed, 49 insertions(+), 52 deletions(-)
---
diff --git a/operations/common/fractal-explorer.c b/operations/common/fractal-explorer.c
index 071e4a5..fd1768d 100644
--- a/operations/common/fractal-explorer.c
+++ b/operations/common/fractal-explorer.c
@@ -32,21 +32,7 @@ gegl_chant_int_ui (width, _("Width"), 1, 10000000, 400, 1, 2000, 1.5,
gegl_chant_int_ui (height, _("Height"), 1, 10000000, 400, 1, 2000, 1.5,
_("Height"))
-gegl_chant_register_enum (gegl_fractal_type)
- enum_value (GEGL_FRACTAL_TYPE_MANDELBROT, "Mandelbrot")
- enum_value (GEGL_FRACTAL_TYPE_JULIA, "Julia")
- enum_value (GEGL_FRACTAL_TYPE_BARNSLEY_1, "Barnsley 1")
- enum_value (GEGL_FRACTAL_TYPE_BARNSLEY_2, "Barnsley 2")
- enum_value (GEGL_FRACTAL_TYPE_BARNSLEY_3, "Barnsley 3")
- enum_value (GEGL_FRACTAL_TYPE_SPIDER, "Spider")
- enum_value (GEGL_FRACTAL_TYPE_MAN_O_WAR, "Man'o'war")
- enum_value (GEGL_FRACTAL_TYPE_LAMBDA, "Lambda")
- enum_value (GEGL_FRACTAL_TYPE_SIERPINSKI, "Sierpinski")
-gegl_chant_register_enum_end (GeglFractalType)
-
-gegl_chant_enum (fractaltype, _("Fractal type"),
- GeglFractalType, gegl_fractal_type,
- GEGL_FRACTAL_TYPE_MANDELBROT, _("Type of a fractal"))
+gegl_chant_int (fractaltype, _("Fractal type"), 0, 8, 0, _("Type of a fractal"))
gegl_chant_double (xmin, _("Left"), -3.0, 3.0, -2.0, _("Left"))
gegl_chant_double (xmax, _("Right"), -3.0, 3.0, 2.0, _("Right"))
@@ -65,21 +51,12 @@ gegl_chant_double (greenstretch, _("Green stretch"), 0.0, 1.0, 1.0,
gegl_chant_double (bluestretch, _("Blue stretch"), 0.0, 1.0, 1.0,
_("Blue stretching factor"))
-gegl_chant_register_enum (gegl_fractal_color_mode)
- enum_value (GEGL_FRACTAL_COLOR_MODE_SINE, "Sine")
- enum_value (GEGL_FRACTAL_COLOR_MODE_COSINE, "Cosine")
- enum_value (GEGL_FRACTAL_COLOR_MODE_NONE, "None")
-gegl_chant_register_enum_end (GeglFractalColorMode)
-
-gegl_chant_enum (redmode, _("Red mode"),
- GeglFractalColorMode, gegl_fractal_color_mode,
- GEGL_FRACTAL_COLOR_MODE_COSINE, _("Red application mode"))
-gegl_chant_enum (greenmode, _("Green mode"),
- GeglFractalColorMode, gegl_fractal_color_mode,
- GEGL_FRACTAL_COLOR_MODE_COSINE, _("Green application mode"))
-gegl_chant_enum (bluemode, _("Blue mode"),
- GeglFractalColorMode, gegl_fractal_color_mode,
- GEGL_FRACTAL_COLOR_MODE_SINE, _("Blue application mode"))
+gegl_chant_int (redmode, _("Red mode"), 0, 2, 1,
+ _("Red application mode (0:SIN; 1:COS; 2:NONE)"))
+gegl_chant_int (greenmode, _("Green mode"), 0, 2, 1,
+ _("Green application mode (0:SIN; 1:COS; 2:NONE)"))
+gegl_chant_int (bluemode, _("Blue mode"), 0, 2, 0,
+ _("Blue application mode (0:SIN; 1:COS; 2:NONE)"))
gegl_chant_boolean (redinvert, _("Red inversion"), FALSE,
_("Red inversion"))
@@ -103,6 +80,27 @@ gegl_chant_boolean (useloglog, _("Loglog smoothing"), FALSE,
#include <math.h>
#include <stdio.h>
+enum
+{
+ SINUS,
+ COSINUS,
+ NONE
+};
+
+enum
+{
+ TYPE_MANDELBROT,
+ TYPE_JULIA,
+ TYPE_BARNSLEY_1,
+ TYPE_BARNSLEY_2,
+ TYPE_BARNSLEY_3,
+ TYPE_SPIDER,
+ TYPE_MAN_O_WAR,
+ TYPE_LAMBDA,
+ TYPE_SIERPINSKI,
+ NUM_TYPES
+};
+
typedef struct
{
guchar r, g, b;
@@ -119,7 +117,7 @@ explorer_render_row (GeglChantO *o,
clrmap colormap,
guchar **dest_row)
{
- GeglFractalType fractaltype;
+ gint fractaltype;
gint col;
gdouble xmin;
gdouble ymin;
@@ -167,7 +165,7 @@ explorer_render_row (GeglChantO *o,
{
a = xmin + (gdouble) col * xdiff;
b = ymin + (gdouble) row * ydiff;
- if (fractaltype != GEGL_FRACTAL_TYPE_MANDELBROT)
+ if (fractaltype != 0)
{
tmpx = x = a;
tmpy = y = b;
@@ -185,17 +183,17 @@ explorer_render_row (GeglChantO *o,
switch (fractaltype)
{
- case GEGL_FRACTAL_TYPE_MANDELBROT:
+ case TYPE_MANDELBROT:
xx = x * x - y * y + a;
y = 2.0 * x * y + b;
break;
- case GEGL_FRACTAL_TYPE_JULIA:
+ case TYPE_JULIA:
xx = x * x - y * y + cx;
y = 2.0 * x * y + cy;
break;
- case GEGL_FRACTAL_TYPE_BARNSLEY_1:
+ case TYPE_BARNSLEY_1:
foldxinitx = oldx * cx;
foldyinity = oldy * cy;
foldxinity = oldx * cy;
@@ -213,7 +211,7 @@ explorer_render_row (GeglChantO *o,
}
break;
- case GEGL_FRACTAL_TYPE_BARNSLEY_2:
+ case TYPE_BARNSLEY_2:
foldxinitx = oldx * cx;
foldyinity = oldy * cy;
foldxinity = oldx * cy;
@@ -231,7 +229,7 @@ explorer_render_row (GeglChantO *o,
}
break;
- case GEGL_FRACTAL_TYPE_BARNSLEY_3:
+ case TYPE_BARNSLEY_3:
foldxinitx = oldx * oldx;
foldyinity = oldy * oldy;
foldxinity = oldx * oldy;
@@ -249,7 +247,7 @@ explorer_render_row (GeglChantO *o,
}
break;
- case GEGL_FRACTAL_TYPE_SPIDER:
+ case TYPE_SPIDER:
/* { c=z=pixel: z=z*z+c; c=c/2+z, |z|<=4 } */
xx = x*x - y*y + tmpx + cx;
y = 2 * oldx * oldy + tmpy +cy;
@@ -257,14 +255,14 @@ explorer_render_row (GeglChantO *o,
tmpy = tmpy/2 + y;
break;
- case GEGL_FRACTAL_TYPE_MAN_O_WAR:
+ case TYPE_MAN_O_WAR:
xx = x*x - y*y + tmpx + cx;
y = 2.0 * x * y + tmpy + cy;
tmpx = oldx;
tmpy = oldy;
break;
- case GEGL_FRACTAL_TYPE_LAMBDA:
+ case TYPE_LAMBDA:
tempsqrx = x * x;
tempsqry = y * y;
tempsqrx = oldx - tempsqrx + tempsqry;
@@ -274,7 +272,7 @@ explorer_render_row (GeglChantO *o,
y = cx * tempsqry + cy * tempsqrx;
break;
- case GEGL_FRACTAL_TYPE_SIERPINSKI:
+ case TYPE_SIERPINSKI:
xx = oldx + oldx;
y = oldy + oldy;
if (oldy > .5)
@@ -317,8 +315,7 @@ explorer_render_row (GeglChantO *o,
}
static void
-make_color_map (GeglChantO *o,
- clrmap colormap)
+make_color_map (GeglChantO *o, clrmap colormap)
{
gint i;
gint r;
@@ -340,13 +337,13 @@ make_color_map (GeglChantO *o,
switch (o->redmode)
{
- case GEGL_FRACTAL_COLOR_MODE_SINE:
+ case SINUS:
r = (int) redstretch *(1.0 + sin((x - 1) * pi));
break;
- case GEGL_FRACTAL_COLOR_MODE_COSINE:
+ case COSINUS:
r = (int) redstretch *(1.0 + cos((x - 1) * pi));
break;
- case GEGL_FRACTAL_COLOR_MODE_NONE:
+ case NONE:
r = (int)(redstretch *(x));
break;
default:
@@ -355,13 +352,13 @@ make_color_map (GeglChantO *o,
switch (o->greenmode)
{
- case GEGL_FRACTAL_COLOR_MODE_SINE:
+ case SINUS:
gr = (int) greenstretch *(1.0 + sin((x - 1) * pi));
break;
- case GEGL_FRACTAL_COLOR_MODE_COSINE:
+ case COSINUS:
gr = (int) greenstretch *(1.0 + cos((x - 1) * pi));
break;
- case GEGL_FRACTAL_COLOR_MODE_NONE:
+ case NONE:
gr = (int)(greenstretch *(x));
break;
default:
@@ -370,13 +367,13 @@ make_color_map (GeglChantO *o,
switch (o->bluemode)
{
- case GEGL_FRACTAL_COLOR_MODE_SINE:
+ case SINUS:
bl = (int) bluestretch * (1.0 + sin ((x - 1) * pi));
break;
- case GEGL_FRACTAL_COLOR_MODE_COSINE:
+ case COSINUS:
bl = (int) bluestretch * (1.0 + cos ((x - 1) * pi));
break;
- case GEGL_FRACTAL_COLOR_MODE_NONE:
+ case NONE:
bl = (int) (bluestretch * x);
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]