Indeed. So where is the C API documentation for drawing lines? When I search, all that comes up is one C paintbrush function, the Scheme interface, and this email thread. I've spent a bunch of time at http://developer.gimp.org/api/2.0/libgimp/ to no avail... (That's a lot of how I produced the code snippet in the message which started this thread.) Ah, a grep search through /usr/include/gimp-2.0/libgimp turned up gimpvectors, with a bezier line method. Why didn't I see it earlier? Ah, on developer.gimp.org there's no text next to the object name, no Description, no Details, no indication that this is how one draws lines. So I guess I create a gimpvectors object somehow, then use gimp_vectors_bezier_stroke_new_moveto() and gimp_vectors_bezier_stroke_lineto()? Or should I gimp_vectors_stroke_new_from_points()? How do I "stroke" the resulting path? Sven, just got your replies, thanks. Still scratching my head. I'll bang on it for a bit longer, and go back to Gdk if I can't make it work. Thanks, Adam On Sat, 2009-05-30 at 21:56 -0400, Rob Antonishen wrote: > Sure, but the call process should be the same. Just use the equivalent > C API calls, no? > > -Rob A> > > On 5/30/09, Adam C Powell IV <hazelsct@xxxxxxxxxx> 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. > > > > Funny, a search for "gimp c api line" turns up this thread. :-) Going > > further, searching for "gimp plugin api draw line" and restricting to > > developer.gimp.org turns up GDK drawing primitives. > > > > So it sounds like the best way to proceed is to wrap the pixel data into > > a GdkPixbuf and use GDK to draw into it. Figured there might be a more > > straightforward way to go from a GimpDrawable to a GdkDrawable (since it > > is after all the "GIMP Drawing Kit"). Hmm, and there's a GimpCanvas > > object, but that doesn't seem to be a plugin thing. > > > > Thanks, > > Adam > > > > On Sat, 2009-05-30 at 19:20 -0400, Rob Antonishen wrote: > >> Here is the code to draw a single pixel line, black on white, on the > >> drawable "layer" and x1 y1 are one end and x2 y2 are the other. > >> > >> (gimp-context-set-brush "Circle (01)") > >> (gimp-context-set-foreground "Black") > >> (gimp-context-set-background "White") > >> (gimp-context-set-opacity 100) > >> (gimp-context-set-paint-mode NORMAL-MODE) > >> (gimp-pencil layer 4 (vector x1 y1 x2 x2)) > >> (gimp-displays-flush) > >> > >> 0,0 is upper left hand side. This is with the pencil tool. Replace > >> with any other tool as desired, for example: > >> (gimp-paintbrush-default layer 4 (vector x1 y1 x2 y2)) > >> > >> Hope that helps, > >> > >> -Rob A> > > -- > > GPG fingerprint: D54D 1AEE B11C CE9B A02B C5DD 526F 01E8 564E E4B6 > > > > Engineering consulting with open source tools > > http://www.opennovation.com/ > > > -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