On 9/12/07, Sven Neumann <[EMAIL PROTECTED]> wrote:

> Hi Simon,
>
> what about the other issue that Barton reported?
>
>   Apparently the stroke is being made with the background color though
>   the pdb for gimp-edit-stroke-vectors says:
>
>   "This procedure strokes the specified vectors object, painting along
>    the path with the active brush and foreground color"

David Gowers wrote:
I converted the script to python (useful script, btw -- thanks
Simon.), and I cannot reproduce this.

Going back and repeating my earlier tests I find that I cannot reproduce the background color issue I reported either. I believe that I have identified the problem however: my installation of 2.3.18 is defaulting to the erase tool at start-up. When I open 2.3.18 and run Simon's draw_circle script (in scheme or python) without first selecting the paintbrush tool from the toolbox the path is stroked with the erase tool. Surely this is the intended behavior, but it wasn't obvious to me that the erase tool is considered a paint brush. Would it be helpful to note this in the pdb blurb, or would that amount to clutter?

Long story short, I ran my tests on an image with no alpha channel and a white background color and probably jumped to the incorrect conclusion with regard to the cause of the missing circle. FWIW my adaptation to Python of Simon's script-fu is attached.


Thanks all,

Barton
#!/usr/bin/env python

# Draws a 150 px radius circle centered in an 800x600 px image
# Adapted from a scheme script-fu contributed by Simon Budig

from gimpfu import *

def draw_circle(img, layer):
  gimp.set_foreground(0, 0, 0)
  pdb.gimp_context_set_brush("Circle (03)")  
  
  vectors = pdb.gimp_vectors_new(img, "circle")
  pdb.gimp_image_add_vectors(img, vectors, -1)
  pdb.gimp_vectors_bezier_stroke_new_ellipse(vectors, 400, 300, 150, 150, 0)
  pdb.gimp_image_set_active_vectors(img, vectors)
  pdb.gimp_edit_stroke_vectors(layer, vectors)
  pdb.gimp_displays_flush()
  
register(
    "python-fu-draw-circle",
    N_("Draw a circle"),
    "Simple example of stroking a circular path",
    "Simon Budig",
    "Simon Budig",
    "2007",
    N_("_Draw Circle"),
    "RGB*, GRAY*",
    [
        (PF_IMAGE, "image",       "Input image", None),
        (PF_DRAWABLE, "drawable", "Input drawable", None)
    ],
    [],
    draw_circle,
    menu="<Image>/Python-fu"
    )

main()
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to