1. Create an empty Vector (is that the right term?) with gimp_vectors_new().
2. Add it to the image using gimp_image_insert_vectors().
3. Fill it with two points (four values) using gimp_vectors_stroke_new_from_points().
4. Select it with gimp_vectors_to_selection() followed by gimp_selection_border().
5. Colour it with gimp_edit_bucket_fill().
To see if this would work, I tried entering the steps manually in the Python console, but only got as far as step 3 before I got an error I couldn't understand. And in step 2, I had to use gimp_image_add_vectors(), even though it's deprecated according to the documentation, because I got a TypeError using gimp_image_insert_vectors().
Here's a transcript of my console session. Can anyone explain what's causing the errors in steps 2 and 3? Or is there an easier way to draw a single line?
Code: Select all
>>> image = pdb.gimp_image_new(800,800,RGB) >>> layer = pdb.gimp_layer_new(image,image.width,image.height,RGBA_IMAGE,"Vector",100.0,NORMAL_MODE) >>> pdb.gimp_image_insert_layer(image,layer,None,0) >>> points =  >>> points.append(0) >>> points.append(0) >>> points.append(400) >>> points.append(400) >>> v = pdb.gimp_vectors_new(image,"vectors") >>> pdb.gimp_image_insert_vectors(image,v,0,-1) Traceback (most recent call last): File "<input>", line 1, in <module> TypeError: wrong parameter type >>> pdb.gimp_image_add_vectors(image,v,0) >>> sid = pdb.gimp_vectors_stroke_new_from_points(v,VECTORS_STROKE_TYPE_BEZIER,len(points),points,FALSE) Traceback (most recent call last): File "<input>", line 1, in <module> RuntimeError: execution error >>>