Hey Quentin,
I was playing with EUI last week and started to write a basic
paintbrush tool - here's the current (very early and hacky) code. It
only works in OS X for now because I'm using NSGradient.

I made a ETShape subclass called ETDrawingStrokeShape which stores the
path of the drawing stroke, and currently the tablet pressure at each
point in the path. I'm planning to extend it to store more info, such
as timestamp of each event and parameters for fancy tablets (angle,
rotation, etc.).

ETDrawingStrokeShape then has another stlye, as an ivar, which it
delegates the actual drawing to. I wrote two styles which work here,
ETBrushStyle, a bitmap brush, and ETPenStyle, a vector brush.

I'm not too comfortable with the graphics coordinates yet, so I may be
doing many things wrong.
One bug is that if you start drawing on top of an existing layout item
(rather than the window background) the drawing is offset vertically
by 10 or 15 pixels.

Anyway, it was exciting to get this working very quickly. :)

Eric

Attachment: DrawingTool.diff
Description: Binary data

_______________________________________________
Etoile-dev mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-dev

Reply via email to