[cairo] can cairo give me a draw pen with gradient width

glorious tao glorioustao at gmail.com
Tue Dec 11 20:16:04 PST 2007


On Dec 11, 2007 3:24 PM, Donn <donn.ingle at gmail.com> wrote:

> > My situation is this: I want to write a progam, which use mouse as the
> > brush pen. if you move mouse faster, you will get thinner stroke,
> Sure, that's possible. You could:
> 1. Create a brush shape - say a circle.
> 2. Track the mouse x,y and "stamp" the circle down there.
> 3. As the speed increases (monitor the gap between this x,y and last x,y),
> use
> that to make the "stamp" smaller.
> 4. loop
>
> I suppose one could keep a clever track of nodes on the sides of each
> circle
> and after a "stroke" has been drawn, actually create a path from each of
> those nodes and draw that instead -- that way you won't see all the little
> edges of the circles. So, the circles are simply the visual part of the
> drawing process, the path is the end result.


yes,  that was exactly what I thought before. Yesterday night I tried this
idea, and it looked not very good. I think maybe the problems are 1) I
choose a bad math function width = C / speed. 2) when I use mouse to write,
I can't move the mouse smoothly, so the speed changed not smoothly. 3) when
I use brush pen, the pen pressure is changing, that will affect the line
width. But with mouse, I can't do that.

So I think a idea: I can record the user's movement, and judge what he/she
want to write (chinese character's is composed of about thirty basic
strokes), then I can show already stored basic vector stokes in the user's
movement area. To achieve that, I must store all the basic vector stokes,
their position, width, height, lean angle can be variable. To me seems not
very easy, I have to work hard, but it is intersting :)

Omg ,did I express my idea explicitly :( ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20071212/baabe22d/attachment.html 


More information about the cairo mailing list