Hello, I am Shivani and have ported the gimp plugin 'semi-flatten' to Gegl op. This is in addition to the task( posted earlier to the list ) - giving the code review and algorithm description as mentioned in Gsoc tasks<http://wiki.gimp.org/index.php?title=Hacking:GSoC_2011/Ideas> list.
Kindly review the patch - diff --git a/semi-flatten.c b/semi-flatten.c index e69de29..ff18455 100644 --- a/semi-flatten.c +++ b/semi-flatten.c @@ -0,0 +1,70 @@ +/* Semi-flatten plugin using gegl op + * + * Shivani Maheshwari + * + */ + +#include "config.h" +#include <glib/gi18n-lib.h> + +#ifdef GEGL_CHANT_PROPERTIES + +#else + +#define GEGL_CHANT_TYPE_POINT_FILTER + +#define GEGL_CHANT_C_FILE "semi-flatten.c" + +#include "gegl-chant.h" + +static void prepare (GeglOperation *operation) +{ + gegl_operation_set_format (operation, "input", babl_format ("RGBA float")); + gegl_operation_set_format (operation, "output", babl_format ("RGBA float")); +} + +static gboolean +process (GeglOperation *op, + void *in_buf, + void *out_buf, + glong n_pixels, + const GeglRectangle *roi) +{ + GeglChantO *o = GEGL_CHANT_PROPERTIES (operation); + gfloat *GEGL_ALIGNED in_pixel; + gfloat *GEGL_ALIGNED out_pixel; + glong i; + + in_pixel = in_buf; + out_pixel = out_buf; + + for (i=0; i<n_pixels; i++) + { + out_pixel[0] = (in_pixel[0] * in_pixel[3]) / 255 + (in_pixel[0] * (255-in_pixel[3])) / 255; + out_pixel[1] = (in_pixel[1] * in_pixel[3]) / 255 + (in_pixel[1] * (255-in_pixel[3])) / 255; + out_pixel[2] = (in_pixel[2] * in_pixel[3]) / 255 + (in_pixel[2] * (255-in_pixel[3])) / 255; + out_pixel[3] = (in_pixel[3] == 0) ? 0 : inpixel[3]; + in_pixel += 4; + out_pixel += 4; + } + return TRUE; +} + +static void +gegl_chant_class_init (GeglChantClass *klass) +{ + GeglOperationClass *operation_class; + GeglOperationPointFilterClass *point_filter_class; + + operation_class = GEGL_OPERATION_CLASS (klass); + point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass); + + operation_class->prepare = prepare; + point_filter_class->process = process; + + operation_class->name = "gegl:semi-flatten"; + operation_class->categories = "color"; + operation_class->description = _("Semi flattens the image"); +} + +#endif -- Shivani Maheshwari Under Graduation( BTech.) Indian Institute of Information Technology, Allahabad (Amethi Campus) India
_______________________________________________ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer