On Fri, Sep 11, 2009 at 3:39 AM, Ilya Zakharevich
<nospam-ab...@ilyaz.org> wrote:
> I want to stroke the path with the current tool, with all the
> parameters as selected in the tool options.  I do not think I can do
> it with the PATHs right-mouse-click menu, can I?
> (What I see are only choices of "Paint" tools.  What I want is "Select
> tools", like color select and/or magic wand.)
> =======================================================
> An alternative would be to use Script-Fu API to "walk along a path";
> but I would need to "invoke the current tool at the specified point"
> from Script-Fu, and I can't guess how to find this with the Script-Fu
> procedure browser...
> Any help would be appreciated,
> Ilya

Hmm - I can't find a way to access the current tool through the PDB.
Am I mistaken?

I was playing with this idea a bit (in Python), and
vector.stroke.interpolate will give a list of points along a path - I
assume this function is also available in script-fu.  I've pasted what
I was messing around with below, but w/o access to the current tool,
it's a bit useless as a plug-in ;)


#!/usr/bin/env python
# Author: Chris Mohler
# Copyright 2009 Chris Mohler
# License: GPL v3
# Version 0.1
# GIMP plugin to use arbitrary tool along a path

from gimpfu import *

gettext.install("gimp20-python", gimp.locale_directory, unicode=True)

def tool_on_path(img, paths):
        # get active path
        path = pdb.gimp_image_get_active_vectors(img)

        # get points on the path
        points = path.strokes[0].interpolate(0.1)[0]

        # empty return message
        ret = ""

        # process points
        for i in range(len(points)/2):

                x = points.pop(0)
                y = points.pop(0)

                # collect points for message
                ret = ret + str(i) + ": " + str(x) + "," + str(y) + "\n"

                # don't see any way to grab the active tool, so...
                # just do a ellipse select, 20 px wide
                pdb.gimp_ellipse_select(img, x-10.0, y-10.0, 20, 20, 0, 1, 0, 0)
        # output message to error console
        # gimp.message(ret)

    blurb=("Tool on Path"),
    help=("Use arbitrary tool along a path."),
    author=("Chris Mohler"),
    copyright=("Chris Mohler"),
    label=("Tool on Path"),
        (PF_IMAGE, "img", "Image", None),
        (PF_VECTORS, "paths", "Paths", None)
    domain=("gimp20-python", gimp.locale_directory)

Gimp-user mailing list

Reply via email to