RSS/Atom feed Twitter
Site is read-only, email is disabled

how to do fast drawing in plugin, pdb paintbrush api is slow

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

how to do fast drawing in plugin, pdb paintbrush api is slow ?? 06 Oct 07:22
  how to do fast drawing in plugin, pdb paintbrush api is slow Alexia Death 06 Oct 08:39
   how to do fast drawing in plugin, pdb paintbrush api is slow ?? 06 Oct 15:06
    how to do fast drawing in plugin, pdb paintbrush api is slow Alexia Death 06 Oct 16:17
??
2010-10-06 07:22:52 UTC (about 14 years ago)

how to do fast drawing in plugin, pdb paintbrush api is slow

I'm trying to write a plugin to apply effects like this(http://mrdoob.com/projects/harmony/) to any path. I've done the coding, but it runs too slow, it speed several minutes to draw 7000 lines on my laptop.
Currently i use following methods to draw lines:

pdb.gimp_context_set_opacity(alpha) pdb.gimp_paintbrush_default(drawable, 4, [x1,y1,x2,y2])

I guess the overhead of pdb api is too heavy. Is there any alternate way to achieve my purpose?
I can't find a proper one in pdb, maybe i should use cairo api to draw a back buffer, then send it to gimp, but i have no idea how to do that.

Alexia Death
2010-10-06 08:39:29 UTC (about 14 years ago)

how to do fast drawing in plugin, pdb paintbrush api is slow

On Wed, Oct 6, 2010 at 8:22 AM, ?? wrote:

I'm trying to write a plugin to apply effects like this(http://mrdoob.com/projects/harmony/) to any path. I've done the coding, but it runs too slow, it speed several minutes to draw 7000 lines on my laptop.
Currently i use following methods to draw lines:

   pdb.gimp_context_set_opacity(alpha)    pdb.gimp_paintbrush_default(drawable, 4, [x1,y1,x2,y2])

I guess the overhead of pdb api is too heavy. Is there any alternate way to achieve my purpose?
I can't find a proper one in pdb, maybe i should use cairo api to draw a back buffer, then send it to gimp, but i have no idea how to do that.

Several minutes for 7000 strokes to me seems pretty much on par or even above with paint core normal performance. You can try drawing on a drawable/image that isn't visible, if you aren't already, but other than that... Painting is rather expensive operation and is generally optimized to keep up with human speeds, that usually at best do 4 or 5 strokes per second and I have to admit, with large brushes even there it sometimes isn't good enough.

??
2010-10-06 15:06:45 UTC (about 14 years ago)

how to do fast drawing in plugin, pdb paintbrush api is slow

On Wed, Oct 6, 2010 at 2:39 PM, Alexia Death wrote:

On Wed, Oct 6, 2010 at 8:22 AM, ?? wrote:

I'm trying to write a plugin to apply effects like this(http://mrdoob.com/projects/harmony/) to any path. I've done the coding, but it runs too slow, it speed several minutes to draw 7000 lines on my laptop.
Currently i use following methods to draw lines:

pdb.gimp_context_set_opacity(alpha) pdb.gimp_paintbrush_default(drawable, 4, [x1,y1,x2,y2])

I guess the overhead of pdb api is too heavy. Is there any alternate way to achieve my purpose?
I can't find a proper one in pdb, maybe i should use cairo api to draw a back buffer, then send it to gimp, but i have no idea how to do that.

Several minutes for 7000 strokes to me seems pretty much on par or even above with paint core normal performance. You can try drawing on a drawable/image that isn't visible, if you aren't already, but other than that... Painting is rather expensive operation and is generally optimized to keep up with human speeds, that usually at best do 4 or 5 strokes per second and I have to admit, with large brushes even there it sometimes isn't good enough.

Make the layer invisible don't make it better, using pycairo does.

With pycairo, drawing random lines with random alpha value on gtk surface, 100000 strokes only take 21 seconds.

for i in range(100000):

cr = self.window.cairo_create() cr.set_source_rgba(0,0,0,random.random()) cr.move_to(random.randint(0,200), random.randint(0,200)) cr.line_to(random.randint(0,200), random.randint(0,200)) cr.stroke()

Now i use pycairo to draw to a memory buffer, then copy to gimp layer, that's fast enough, the code still needs to be adjusted though.

Thank you very much.

Alexia Death
2010-10-06 16:17:15 UTC (about 14 years ago)

how to do fast drawing in plugin, pdb paintbrush api is slow

On Wed, Oct 6, 2010 at 4:06 PM, ?? wrote:

Make the layer invisible don't make it better, using pycairo does.

With pycairo, drawing random lines with random alpha value on gtk surface, 100000 strokes only take 21 seconds.

Paint core offers a lot more features than cairo stroking and because of this is a lot more resource hungry. If what cairo stroking provides is good enough for you, then it probably is the best solution.