1

I am trying to use GEGL in a Gimp C-plugin. What I want is to scale the R, G, and B values individually for a certain rectangle.

I tried the snippet of code below, but it doesn't update any pixels (drawable_id, x1, y1, width, height are defined outside this code

GeglBuffer *img_buffer = gimp_drawable_get_buffer(drawable_id);
GeglBuffer *shadow_buffer = gimp_drawable_get_shadow_buffer(drawable_id);

GeglRectangle sub_img;
gegl_rectangle_set(&sub_img, x1, y1, width, height);
GeglColor *col = gegl_color_new("");  // TODO: use free to free or g_object_unref?
gegl_color_set_rgba(col, 0.1, 0.5, 0.7, 1);
gegl_buffer_set_color(shadow_buffer, &sub_img, col);

gegl_render_op(img_buffer, shadow_buffer, "gegl:multiply", NULL);
    
g_object_unref(img_buffer);
g_object_unref(shadow_buffer);
gimp_drawable_merge_shadow(drawable_id, TRUE);  // what kind of merge is this
anyway?

gimp_drawable_update(drawable_id, x1, y1, width, height);
gimp_displays_flush();
gegl_exit();

What is it I am doing wrong?

The documentatio at enter link description here states "..using either the constant provided in 'value' or the corresponding pixel from the buffer on aux as operands." but perhaps it is not possible to multiply each colour channel with an individual value with gegl:multiply? In that case I would like to know what function to use instead.

marcelteun
  • 11
  • 4

0 Answers0