Eugeny89
Eugeny89

Reputation: 3731

Making vector curve from raster curve drawn by user

I'm trying to develop a simple real-time graphical editor into my web-based (flash) app. And I'm having two questions:

  1. After MouseEvent.MOUSE_DOWN event, I'm going to draw curve on MouseEvent.MOUSE_MOVE. After MouseEvent.MOUSE_UP event is dispatched drawing of a curve is stopped and I need to inform other active clients what exactly was drawn. Hence, I need to vectorize drawn curve. After that I'll replace drawn curve with vectorized. So, I'm having an array of points, and need to draw a natural curve passing through them. How can that be done?
  2. I need to have an ability to erase drawn. Note that I can't use drawing with white color as erasing, as I can have image on background. What is the simpliest way to erase?

Thank you in advance!

Upvotes: 0

Views: 194

Answers (1)

Roman Trofimov
Roman Trofimov

Reputation: 446

  1. To draw vector curve, you can use Graphics.drawPath method and pass vector of points to it.
  2. If you use Bitmap (BitmapData) to draw your image, you can use copyChannel method, to draw your stamp of alpha brush.

Upvotes: 1

Related Questions