We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › not too simple drawing program
Page Index Toggle Pages: 1
not too simple drawing program (Read 447 times)
not too simple drawing program
Nov 24th, 2007, 5:27am
 
heeeeeeeeeeeey proce55ing world!!11!1
I'm trying to build a drawing program to save arrays of little drawings I'm making(it's part of a bigger project). Here's a link to a current-ish version:

http://www.benisaloser.com/processingQuestion/Ghost_RecordingDrawingsAsText.pde
(for some reason, the variation in mouse speed didn't change the strokeWeight() in the applet, but it works fine in the sketch).

Basically, it just uses line()'s as you draw and varies the strokeWeight() by the recorded speed of the mouse. I'm okay (as in, "it was okay, but not great")with the resolution at openGL speeds, but I was wondering if someone could point me in the right direction as far as things go with creating a drawing program that would work more similarly to how a wacom tablet responds to pressure in photoshop. I was thinking something like the link below, but I can't find a way to implement it.

http://www.benisaloser.com/processingQuestion/processingQuestion.jpg

thanks y'alllllllllll
Re: not too simple drawing program
Reply #1 - Nov 25th, 2007, 2:43am
 
What I understand is that you're not too happy about the visible connections between lines of different weights, right ?

There are more ways than one to smooth things up. The easiest one would be to not se the stroke to be affected directly on the mouse speed, but with a damper.

somethng like

stroke = (stroke + newStroke)/2;  // the most basic damper there is.

Or make a line out of more lines of steady increasing width.

But, if you really want to do it right, make the lines yourself, out of bezier polygons. It's alittle more work but it would be perfectly smooth.

Just make sure you save the last "line's" two ending vertices positioin and tangents and continue your next line with those. Not too hard.

http://processing.org/reference/bezierVertex_.html

Page Index Toggle Pages: 1