[Gimp-developer] Sample implementation of a new GEGL op
I tried to implement the blur operation in GEGL. The algorithm is same as of the blur plug-in in GIMP. The patch file for GEGL operation and the blur.c file for the plug-in are attached below. Kindly let me know if there is any mistake in my implementation. -- Sourav De 2nd Year Student Department of Computer Science and Engineering IIT KHARAGPUR From 56ce24982d5ec4384ed4eb912d24b4018e9fff4d Mon Sep 17 00:00:00 2001 From: Sourav De souravde1...@gmail.com Date: Wed, 6 Apr 2011 20:34:15 +0530 Subject: [PATCH] first commit in the branch --- blur.c | 122 1 files changed, 122 insertions(+), 0 deletions(-) create mode 100644 blur.c diff --git a/blur.c b/blur.c new file mode 100644 index 000..e82109a --- /dev/null +++ b/blur.c @@ -0,0 +1,122 @@ +#include config.h +#include string.h + +#ifdef GEGL_CHANT_PROPERTIES + +#else + +#define GEGL_CHANT_TYPE_AREA_FILTER +#define GEGL_CHANT_C_FILE blur.c + +#include gegl-chant.h +#include math.h +#include stdio.h + +#define BLUR_RADIUS 1; + +static void blur(GeglBuffer *src,const GeglRectangle *src_rect,GeglBuffer *dst,const GeglRectangle *dst_rect); + +static inline void blur_prepare(GeglOperation *operation) +{ +GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation); +area-left = area-right = area-top = area-bottom=BLUR_RADIUS; +gegl_operation_set_format (operation, input, babl_format (RGBA float)); +gegl_operation_set_format (operation, output, babl_format (RGBA float)); +} + +static gboolean process (GeglOperation *operation, GeglBuffer *input, GeglBuffer *output, const GeglRectangle *result) +{ +GeglChantO *o = GEGL_CHANT_PROPERTIES (operation); +GeglRectangle compute; +compute = gegl_operation_get_required_for_output (operation, input,result); +blur(input, compute, output, result); +return TRUE; +} + + +static void blur (GeglBuffer *src,const GeglRectangle *src_rect,GeglBuffer *dst,const GeglRectangle *dst_rect) +{ +gint x,y; +gfloat *src_buf,*dst_buf; +guchar *prev_row, *pr; + guchar *cur_row, *cr; + guchar *next_row, *nr; +gint ind,offset; + +gint width = src_rect-width; +gint height = src_rect-height; + +src_buf = g_new0 (gfloat, src_rect-width * src_rect-height * 4); +dst_buf = g_new0 (gfloat, dst_rect-width * dst_rect-height * 4); + +offset=0; +for(y=0; ydst_rect-height; y++) +{ +for (x=0; xdst_rect-width; x++) +{ + +gint c; +gint i=x+BLUR_RADIUS, j=y+BLUR_RADIUS; +gfloat *src_pix = src_buf + (i + j * src_width) * 4; + +for (c=0;c3;c++) +{ +dst_buf[offset*4+c]=ROUND( + ((gdouble) (src_pix[c-src_width*4 - 4] * src_pix[c-src_width*4 - c]) ++ (gdouble) (src_pix[c-src_width*4] * src_pix[c-src_width*4 + 4 - c]) ++ (gdouble) (src_pix[c-src_width*4 + 4] * src_pix[c-src_width*4 + 2*4 - c]) ++ (gdouble) (src_pix[c - bytes] * src_pix[c - c]) ++ (gdouble) (src_pix[c] * src_pix[c + 4 - c]) ++ (gdouble) (src_pix[c + 4] * src_pix[c + 2*4 - c]) ++ (gdouble) (src_pix[c+src_width*4 - 4] * src_pix[c+src_width*4 - c]) ++ (gdouble) (src_pix[c+src_width*4] * src_pix[c+src_width*4 + 4 - c]) ++ (gdouble) (src_pix[c+src_width*4 + 4] * src_pix[c+src_width*4 + 2*4 - c])) + / ((gdouble) src_pix[c-src_width*4 - c] + + (gdouble) src_pix[c-src_width*4 + 4 - c] + + (gdouble) src_pix[c-src_width*4 + 2*4 - c] + + (gdouble) src_pix[c -c] + + (gdouble) src_pix[c + 4 - c] + + (gdouble) src_pix[c + 2*4 - c] + + (gdouble) src_pix[c+src_width*4 - c] + + (gdouble) src_pix[c+src_width*4 + 4 - c] + + (gdouble) src_pix[c+src_width*4 + 2*4 - c])); + +} + +dst_buf[offset*4+3]= ((gint)src_pix[c-4-src_width*4]+(gint)src_pix[c-src_width*4]+(gint)src_pix[c+4-src_width*4] + + (gint)src_pix[c-4]+(gint)src_pix[c]+(gint)src_pix[c+4]+ + (gint)src_pix[c-4+src_width*4]+(gint)src_pix[c+src_width*4]+(gint)src_pix[c+4+src_width*4]+4)/9; + + + +offset++; +} + +} + +gegl_buffer_set (dst, dst_rect, babl_format (RGBA float), dst_buf,GEGL_AUTO_ROWSTRIDE); + +g_free (src_buf); +g_free (dst_buf); + +} + +static void +gegl_chant_class_init (GeglChantClass *klass) +{ + GeglOperationClass *operation_class; + GeglOperationFilterClass *filter_class; + + operation_class = GEGL_OPERATION_CLASS (klass); + filter_class= GEGL_OPERATION_FILTER_CLASS (klass); + + filter_class-process= process; + operation_class-prepare = prepare; + + operation_class-categories = blur; + operation_class-name= gegl:blur; + operation_class-description = + _(Performs an averaging of pixels.); +} + +#endif --
[Gimp-developer] dynamic text plugin
ok i'm not actually a developer or programme writer but i really need some = help and was hoping someone here might be able to help. I'm using ubuntu 10:10 maverick meerkat with gimp 2.6, i want to install th= e dynamic text plugin, if i move the script file(.scm) into the gimp2.6 scr= ipt folder i get the option in gimp but when i try and use it i get the fol= lowing message Execution error for 'Dynamic Text': Error: set!: unbound variable: image i have been told that the plug in is written in C and i have to install it = using the essential package builder i was told to enter the code sudo apt-get install libgimp2.0-dev libgtk2.0-dev then to enter the command - make when i try 'make' i get the following make: /usr/bin/gimptool: Command not found gcc -o .obj/charmap.o -Wall -Wstrict-prototypes -Wmissing-declarations -I. = -DGTK_DISABLE_COMPAT_H -g -c charmap.c In file included from charmap.c:23: config.h:2: fatal error: gdk/gdkx.h: No such file or directory compilation terminated. make: *** [.obj/charmap.o] Error 1 someone has suggested the makefile could be modified to sort this out but they didn't know how to modify it so i ended up here. Does anyone know how i can get this plugin to work? i really want to be able to use it because it sounds like it has features i could really do with. I'm not sure if would help at all but this is everything i have tried and results so far. http://ubuntuforums.org/showthread.php?t=1721181 any help would be gratefully appreciated many thanks -- View this message in context: http://old.nabble.com/dynamic-text-plugin-tp31335977p31335977.html Sent from the Gimp Developer mailing list archive at Nabble.com. ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] dynamic text plugin
Try: sudo apt-get build-dep gimp Then try running 'make' again. Chris ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] dynamic text plugin
The dynamic text plugin is many years out of date. It was created as a way of allowing text to be changeable before Gimp's text tool supported that. For the past ten years or so the plugin has been completely useless and therefore hasn't been maintained. I'm not sure whether that explains the errors you see, but whether it does or not you are wasting your time: this plugin doesn't do anything more than Gimp's text tool already does much better. -- Bill ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Sample implementation of a new GEGL op
On 04/06/2011 06:14 PM, sourav de wrote: I tried to implement the blur operation in GEGL. The algorithm is same as of the blur plug-in in GIMP. The patch file for GEGL operation and the blur.c file for the plug-in are attached below. Kindly let me know if there is any mistake in my implementation. Please attach the patch to GIMP bugzilla and reference the patch in your application. Regards, Martin -- My GIMP Blog: http://www.chromecode.com/ Why GIMP 2.8 is not released yet ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] [Gimp-user] automating tasks
Gergely Buday wrote: I would like to glue a logo and some dozen of pictures automatically, ie. the logo and the picture has the same height and to glue them at the common edge. How can I do that? Should I use script-fu? You could write a script using Script-Fu (or one of the other language bindings). If I'm reading your message correctly, you want to add a logo to a number of pictures. You might find it easier to do what you want using the -coalesce option to the montage program which comes with ImageMagick. ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] [Gimp-user] automating tasks
http://www.imagemagick.org/Usage/anim_basics/#coalesce ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] Proposal of GSoc 2011: Replace the GimpSizeEntry widget
Hi, I have submitted a proposal for Gsoc on line - Proposal: Replace the GimpSizeEntry widget http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/jake007/1#http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/jake007/1 Last year, I have talked with Martin about this project and learned many details. This year, I am applying as a second time to the project. The proposal content is in the following. Comments will be appreciated, and may be easily to be inserted for this email. Thank you very much. * *Objective* This project is to implement a simple and intuitive design for the GUI and interaction for GimpSizeEntry. The source code will be cleaned and refactored based on the requirements/specs and instruction of the mentor. It is to add some intelligence to the widget, modify its code structure, and create a new approach for text entry with values and units. The outcome will be a better GUI for entering image/canvas size that will be meaningful, user-friendly and extensible in long-term. *Relevant experiences* My name is Jake Zhang, a 25 years old undergraduate student, majoring in Computer Information System, in Saint Mary’s University. My email address is jake.zhang@gmail.com. I think that Gsoc is a great opportunity for me to learn and produce some improvements for Gimp, a large and well-known image manipulation application. I am highly motivated to open source software development, particularly graphics editors. * * My skills and work experiences are in software development and mostly in graphics area. I have developed graphics editors in C, C++, Java and Python (for image processing and manipulation). I am familiar with the work to deal with dimensions, DPI, the ratio between pixels displayed and physical sizes of the object or image. I have done similar architecture design and rewrite tasks for about three years in the software industry, including for every large software applications. My coop and work experiences are 80% GUI-based image processing software development. They are widely applied in multimedia, advertising and security industries. Once I have done it for a few times, I know that I can make it work. In image manipulation, I have experiences in both graphics design and algorithm development. I used Gimp to edit images for many years. I have written many image processing algorithms, e.g. image filtering in spatial domain and frequency domain, image enhancement, image segmentation, and image compression. I have experiences in C, GTK+, GObject, Git, and Linux. A brief review for these techniques and comparison with some other ones: C: Perfect for image processing in speed, especially for complex algorithms, anything with loops and large matrix. More work for programmers, compared to Java and C#. More debugging work too, e.g. segmentation faults are annoy, which I only saw using C, not in Java, Python and C#. However, good programmers should not complain this. Some experienced programmers (10+ year) that I worked with do not use debuggers often, since they started programming before debuggers exist. They print. GTK+: signals. Longer code than other GUI widgets. Java Swing and C# .NET has drag and drop toolboxes, designing visually. I found working with GTK+ is similar to Python and pywidget, and wxWidget. wxWidget is so widely used. GObject: Very interestingly, C can be OOP. Someone asked me if it is similar to Objective C. It is still quite different. A decent OOP knowledge will help on its dev. Git, bazaar, and SVN: These are very similar, but use different and same terms, e.g. pull, push, checkout, clone, commit, update, log, add, rebase, branch, merge, fetch, and so on. I know which is for which, but just listed a few of them. Linux: It is great platform for daily use and developing software. It has a great deal of features that Windows does not have. There are so many useful open source applications to use in Linux. Mac OS is good too. Basically, I am confident to develop a better GimpSizeEntry widget than the existing one. *Project Analysis* In order to deepen my understanding of the nature of this new technology, I have read lots of papers and books in this field. I find that this project is relevant to my experiences and suitable for me. With a quick search for GimpSizeEntry, I found and read its docs: http://developer.gimp.org/api/2.0/libgimpwidgets/GimpSizeEntry.html When creating a new image, there are some fields to set the size, resolution, and units for the image, and printing. It is an important element, because almost every user will use it. I have checked out the source code and reviewed it. It was said that code is rather messy. I have reviewed gimpsizeentry.c and gimpsizeentry.h in libgimpwidgets, agreed with the fact. After 2005, there are around five commits for this code. The most recent large change was done near a year ago