Example #1
0
static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         GeglBuffer          *output,
         const GeglRectangle *result,
         gint                 level)
{
  GeglProperties    *o = GEGL_PROPERTIES (operation);
  GeglRectangle  boundary;
  const Babl    *format;
  GeglSampler   *sampler;
  gfloat        *dst_buf;
  gint           y;

  boundary = gegl_operation_get_bounding_box (operation);

  format = babl_format ("RGBA float");
  dst_buf = g_new0 (gfloat, result->width * result->height * 4);
  sampler = gegl_buffer_sampler_new_at_level (input, format, GEGL_SAMPLER_CUBIC, level);

  for (y = result->y; y < result->y + result->height; y++)
    fractaltrace (input, sampler, &boundary, dst_buf, result, o, y, o->fractal, format, level);

  gegl_buffer_set (output, result, 0, format, dst_buf, GEGL_AUTO_ROWSTRIDE);
  g_object_unref (sampler);

  g_free (dst_buf);

  gegl_buffer_sample_cleanup (input);

  return TRUE;
}
Example #2
0
static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         GeglBuffer          *output,
         const GeglRectangle *result,
         gint                 level)
{
  GeglChantO    *o = GEGL_CHANT_PROPERTIES (operation);
  GeglRectangle  boundary;
  const Babl    *format;
  gfloat        *dst_buf;
  gint           y;

  boundary = gegl_operation_get_bounding_box (operation);

  format = babl_format ("RGBA float");
  dst_buf = g_new0 (gfloat, result->width * result->height * 4);

  for (y = result->y; y < result->y + result->height; y++)
    fractaltrace (input, &boundary, dst_buf, result, o, y, o->fractal, format);

  gegl_buffer_set (output, result, 0, format, dst_buf, GEGL_AUTO_ROWSTRIDE);

  g_free (dst_buf);

  gegl_buffer_sample_cleanup (input);

  return TRUE;
}
Example #3
0
static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *input,
         GeglBuffer          *output,
         const GeglRectangle *result,
         gint                 level)
{
  GeglChantO    *o;
  GeglRectangle  boundary;
  const Babl    *format;
  FractalType    fractal_type;
  gfloat        *dst_buf;
  gint           y;

  o = GEGL_CHANT_PROPERTIES (operation);
  boundary = gegl_operation_get_bounding_box (operation);

  fractal_type = FRACTAL_TYPE_MANDELBROT;
  if (!strcmp (o->fractal, "mandelbrot"))
    fractal_type = FRACTAL_TYPE_MANDELBROT;
  else if (!strcmp(o->fractal, "julia"))
    fractal_type = FRACTAL_TYPE_JULIA;

  format = babl_format ("RGBA float");
  dst_buf = g_new0 (gfloat, result->width * result->height * 4);

  for (y = result->y; y < result->y + result->height; y++)
    fractaltrace (input, &boundary, dst_buf, result, o, y, fractal_type, format);

  gegl_buffer_set (output, result, 0, format, dst_buf, GEGL_AUTO_ROWSTRIDE);

  g_free (dst_buf);

  gegl_buffer_sample_cleanup (input);

  return TRUE;
}