Okay, one more bit of help should finish this. :-) On Sun, 2009-05-31 at 11:50 +1000, David Hodson wrote: > On Sat, 2009-05-30 at 20:47 -0400, Adam C Powell IV wrote: > > I'm sorry, I'm developing a C plugin (tried Scheme first and it was DOG > > slow). Is there a C equivalent? All I'm seeing is > > gimp-paintbrush-register. > > Open Gimp > Select Help > Procedure Browser > In the search box, type "brush" > Click on "gimp-context-set-brush" > Read the documentation > In your plugin, add the line: > > gboolean result = gimp_context_set_brush("Circle (01)"); > > Rinse, lather, repeat. > > (The hardest part is changing the dashes in the name to underscores.) Thanks very much, this and Rob's sequence got me almost there. And apologies to Rob, Liam and Sven for missing this post on Scheme -> C procedure names until after my Sunday replies. But using gimp_pencil (drawable_ID, etc.) in C only draws on the main window. I want it to draw on the preview or window as appropriate. Here's my function in a nutshell: if (!(drawable = (GimpDrawable *) gimp_drawable_get (drawable_ID))) return FALSE; has_selection = gimp_drawable_mask_bounds (drawable_ID, &x1, &y1, &x2, &y2); if (!(source_data = g_new (guchar, drawable->bpp * (x2-x1) * (y2-y1)))) return FALSE; gimp_pixel_rgn_init (&source_region, drawable, x1, y1, x2-x1, y2-y1, FALSE, FALSE); gimp_pixel_rgn_get_rect (&source_region, source_data, x1, y1, x2-x1, y2-y1); // Do some stuff to source_data gimp_pixel_rgn_init (&output_region, drawable, x1, y1, x2-x1, y2-y1, (preview == NULL), TRUE); gimp_pixel_rgn_set_rect (&output_region, source_data + y1*rowskip, 0, y1, full_width, y2-y1); // I want to draw the lines here if (preview) gimp_drawable_preview_draw_region (GIMP_DRAWABLE_PREVIEW (preview), &output_region); else { gimp_drawable_flush (drawable); gimp_drawable_merge_shadow (bs_param->drawable_ID, TRUE); gimp_drawable_update (bs_param->drawable_ID, x1, y1, win_width, win_height); } This is called by both the "invalidated" callback of the preview in the dialog, and also the run() method of the plugin after "OK". The first non-lines part works fine: the changes to source_data get merged into the preview when it's running, and into the original image when I click "OK". However, it draws the lines on the original image when the preview is running in the dialog. So that messes up the image analysis (Do some stuff... above) when that runs at the end of run(). And gimp_pixel_rgn_set_rect overwrites the lines, so they're all gone. How can I get this to behave like gimp_pixel_rgn_set_rect , i.e. draw on the preview in preview mode, and draw on the original window in run() ? Can I draw the lines into the output_region somehow? -Adam -- GPG fingerprint: D54D 1AEE B11C CE9B A02B C5DD 526F 01E8 564E E4B6 Engineering consulting with open source tools http://www.opennovation.com/
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Gimp-developer mailing list Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer