It is currently Fri Apr 26, 2024 9:38 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: any tutorial on use of gimp_paintbrush in a filter (full options)?
PostPosted: Thu Nov 26, 2015 6:37 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
GIMP Version: 2.8.14
Operating System: Windows
GIMP Experience: Basic Level



Hi Gimp gurus!
Is there a "detailed" tutorial on the use of gimp_paintbrush (full options, i.e. including a multicolor gradient) in a filter?
The simple explanations found on PDB doc like
"This tool is the standard paintbrush. It draws linearly interpolated lines through the specified stroke coordinates. It operates on the specified drawable in the foreground color with the active brush. The "fade_out" parameter is measured in pixels and allows the brush stroke to linearly fall off. The pressure is set to the maximum at the beginning of the stroke. As the distance of the stroke nears the fade_out value, the pressure will approach zero. The gradient_length is the distance to spread the gradient over. It is measured in pixels. If the gradient_length is 0, no gradient is used."
is not sufficient (at least for me)to understand the behaviour of the command.
It would be nice to have some examples with explanations of all the relationships among the parameters and the brush characteristics.
Thanks a lot

_________________
"Where am I ?"


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: any tutorial on use of gimp_paintbrush in a filter (full options)?
PostPosted: Fri Nov 27, 2015 9:52 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
peanuts info

the PDB Doc says
"The "fade_out" parameter is measured in pixels and allows the brush stroke to linearly fall off. The pressure is set to the maximum at the beginning of the stroke. As the distance of the stroke nears the fade_out value, the pressure will approach zero"

Do you like to make a simple test?
Open the Python console.
Enter there statements
pdb.gimp_context_set_foreground((0,255,0))
pdb.gimp_context_set_background((0,0,0))
new_image=pdb.gimp_image_new(400,400,RGB)
drawable=pdb.gimp_layer_new(new_image,400,400,RGB,"my_layer",100.0,NORMAL_MODE)
new_image.add_layer(drawable, 0)
pdb.gimp_context_set_brush("2. Hardness 100")
pdb.gimp_context_set_brush_size(50)
pdb.gimp_paintbrush(drawable, 00, 4, (25,50,375,50), 0, 0)
pdb.gimp_paintbrush(drawable, 50, 4, (25,150,375,150), 0, 0)
pdb.gimp_paintbrush(drawable, 250, 4, (25,250,375,250), 0, 0)
pdb.gimp_paintbrush(drawable, 350, 4, (25,350,375,350), 0, 0)
pdb.gimp_display_new(new_image)

This is what you get:
Attachment:
Test1_Paintbrush.PNG
Test1_Paintbrush.PNG [ 688.72 KiB | Viewed 2854 times ]


Do you consider this as being a "fade out" effect? It looks more to me like a .... "fade in"

_________________
"Where am I ?"


Top
 Post subject: Re: any tutorial on use of gimp_paintbrush in a filter (full options)?
PostPosted: Fri Nov 27, 2015 11:58 am  (#3) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
dinasset wrote:
Do you consider this as being a "fade out" effect? It looks more to me like a .... "fade in"

Let me put it this way, the PDB browser incorrectly specifies the fourth parameter to 'gimp-paintbrush'. It should probably read: Array of stroke coordinates: { sn.x, sn.y, ..., s2.x, s2.y, s1.x, s1.y }

In other words, stroke arrays provided as PDB arguments and returned as PDB values are always specified in "reverse" order.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: any tutorial on use of gimp_paintbrush in a filter (full options)?
PostPosted: Fri Nov 27, 2015 12:33 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
now it's clear!
in fact I thought to draw in the reverse order....
but, wouldn't it be better to correct the filter to stroke in the "natural" direction?

_________________
"Where am I ?"


Top
 Post subject: Re: any tutorial on use of gimp_paintbrush in a filter (full options)?
PostPosted: Fri Nov 27, 2015 12:57 pm  (#5) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
dinasset wrote:
but, wouldn't it be better to correct the filter to stroke in the "natural" direction?

1) There are about 15 years worth of filters out there that may depend upon the current behavior.
2) The underlying implementation of a path stroke is a simple linked list. The easiest way to add an element to a linked list is to insert the new element into the beginning of the linked list. In order to add an element to the end of the linked list, it is necessary to "walk" along the list from its beginning until the last element is reached, which can be inefficient if there are tens of thousands of elements in the list*.


* One could maintain two pointers for every linked list -- one to the first element and one to the last element -- and thus obviate the need to ever "walk" along the list, but that is not how it was initially done and it is a little late to change things now.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: any tutorial on use of gimp_paintbrush in a filter (full options)?
PostPosted: Fri Nov 27, 2015 1:31 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
ok, so it's simpler to update the documentation, but at least this should be done IMO, so the users get clear understanding of the behaviour before starting using the function

_________________
"Where am I ?"


Top
 Post subject: Re: any tutorial on use of gimp_paintbrush in a filter (full options)?
PostPosted: Fri Nov 27, 2015 2:03 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
and there is also another oddity:
if the option to use the gradient is chosen it seems that the stroke goes "naturally" from the first point to the last (left to right) as opposed to the behavior discussed previously
so, in the same filter the same parameter (the array of strokes) is interpreted in opposite ways when using the "fading" and when using the gradient.
Attachment:
Use_of_paintbrush_with_gradient.PNG
Use_of_paintbrush_with_gradient.PNG [ 573.25 KiB | Viewed 2819 times ]

(the result is the same both using method 0 and method 1 -BTW I do not understand when and how this parameter is taken into account-)
another aspect (in the use of the gradient) is the behaviour at the end of the "space" indicated by the user for the gradient span: the last colour is then repeated indefinitely, while it could be nice to see the gradient be repeated; maybe also this one is something "historical", but not "nice" per se

_________________
"Where am I ?"


Top
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) A guide to using Abstract Plus Filter (Tutorial) PDF

0

No new posts Attachment(s) Comic Image Tutorial using G'mic Engrave Filter (PDF)

153

No new posts Paintbrush tool not working ----> NOW SOLVED

6

No new posts Attachment(s) A guide to use Free Paint 2023 Filter (tutorial PDF)

1

No new posts Full body Wilber

6



* Login  



Powered by phpBB3 © phpBB Group