[gegl/soc-2011-ops] Added the cubism op
- From: Robert Sasu <sasurobert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2011-ops] Added the cubism op
- Date: Tue, 12 Jul 2011 11:45:04 +0000 (UTC)
commit db4ed5c31aaaa4cc9a5db5174ba9ab3efb5ba16f
Author: Robert Sasu <sasu robert gmail com>
Date: Tue Jul 12 14:44:36 2011 +0300
Added the cubism op
operations/workshop/cubism.c | 50 ++++++-----------------------------------
1 files changed, 8 insertions(+), 42 deletions(-)
---
diff --git a/operations/workshop/cubism.c b/operations/workshop/cubism.c
index e301218..3697c8a 100644
--- a/operations/workshop/cubism.c
+++ b/operations/workshop/cubism.c
@@ -31,8 +31,6 @@ gegl_chant_double (tile_size, _("Tile size"), 0.0, 256.0, 10.0,
_("Tile size"))
gegl_chant_double (tile_saturation, _("Tile saturation"), 0.0, 10.0, 2.5,
_("Tile saturation"))
-gegl_chant_boolean (background, _("Background"), FALSE,
- _("Use background color"))
gegl_chant_int (seed, _("Seed"), 0 , G_MAXINT, 1,
_("Random seed"))
@@ -247,8 +245,6 @@ polygon_reset (Polygon *poly)
static void
fill_poly_color (Polygon *poly,
- GeglBuffer *input,
- GeglBuffer *output,
const GeglRectangle *extended,
const GeglRectangle *boundary,
gfloat *dst_buf,
@@ -277,8 +273,6 @@ fill_poly_color (Polygon *poly,
gint x1, y1, x2, y2;
gint *vals, *vals_iter, *vals_end;
gint b;
-
- /* GeglRectangle rect; */
sx = poly->pts[0].x;
sy = poly->pts[0].y;
@@ -389,7 +383,7 @@ fill_poly_color (Polygon *poly,
if (x >= x1 && x < x2)
{
for (val = 0, vals_iter = &vals[j],
- vals_end = &vals_iter[SUPERSAMPLE];
+ vals_end = &vals_iter[SUPERSAMPLE];
vals_iter < vals_end;
vals_iter++)
val += *vals_iter;
@@ -398,16 +392,11 @@ fill_poly_color (Polygon *poly,
if (val > 0)
{
- xx = (gdouble) j / (gdouble) SUPERSAMPLE + min_x;
- alpha = (gfloat) (val * calc_alpha_blend (vec,
- one_over_dist,
- xx - sx,
- yy - sy));
- /*
- gegl_buffer_sample (output, x, y, 1.0, buf,
- babl_format ("RGBA float"),
- GEGL_INTERPOLATION_NEAREST);
- */
+ xx = (gdouble) j / (gdouble) SUPERSAMPLE + min_x;
+ alpha = (gfloat) (val * calc_alpha_blend (vec,
+ one_over_dist,
+ xx - sx,
+ yy - sy));
for (b = 0; b < 4; b++)
buf[b] = dst_buf[( (y-extended->y) * extended->width
@@ -420,16 +409,6 @@ fill_poly_color (Polygon *poly,
dst_buf[((y-extended->y) * extended->width +
(x - extended->x)) * 4 + b] = buf[b];
- /*
- rect.x = x;
- rect.y = y;
- rect.width = 1;
- rect.height = 1;
-
- gegl_buffer_set (output, &rect,
- babl_format ("RGBA float"), buf,
- GEGL_AUTO_ROWSTRIDE);
- */
}
}
}
@@ -468,7 +447,7 @@ process (GeglOperation *operation,
Babl *format = babl_format ("RGBA float");
GRand *gr = g_rand_new_with_seed (o->seed);
- gfloat bg_col[4], color[4];
+ gfloat color[4];
gint cols, rows, num_tiles, count;
gint *random_indices;
gfloat *dst_buf;
@@ -487,21 +466,9 @@ process (GeglOperation *operation,
dst_buf = g_new0 (gfloat, extended.width * extended.height * 4);
- if (!o->background)
- {
- bg_col[0] = bg_col[1] = bg_col[2] = bg_col[3] = 0.0;
- }
- else
- {
- /*gegl get background color*/
- bg_col[0] = bg_col[1] = bg_col[2] = bg_col[3] = 0.0;
- }
-
cols = (result->width + o->tile_size - 1) / o->tile_size;
rows = (result->height + o->tile_size - 1) / o->tile_size;
- /*here to set background color*/
-
num_tiles = (rows + 1) * (cols + 1);
random_indices = g_new0 (gint, num_tiles);
@@ -549,8 +516,7 @@ process (GeglOperation *operation,
gegl_buffer_sample (input, ix, iy, 1.0, color, format,
GEGL_INTERPOLATION_NEAREST);
- fill_poly_color (&poly, input, output, &extended, &boundary,
- dst_buf, color);
+ fill_poly_color (&poly, &extended, &boundary, dst_buf, color);
}
gegl_buffer_set (output, &extended, format, dst_buf, GEGL_AUTO_ROWSTRIDE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]