[Gimp-developer] Drawing a line in a GIMP plugin
Rob Antonishen
rob.antonishen at gmail.com
Sat May 30 18:56:21 PDT 2009
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 at debian.org> 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/
>
--
Sent from my mobile device
More information about the Gimp-developer
mailing list