-
Senior Member
[CS3][AS3] Painting Game
I'm making a simple painting game, which was going smoothly until I got to working on the erase feature.
It's not clear how exactly I'd do this, as even using a mask would seem to require being able to remove what I've drawn.
Anyone got any ideas about how I could approach this.
-
what is your current approach?- do you use bitmapData or instanced Graphics or just plain drawingAPI ?
-
Senior Member
Hey render,
I have solved this now - I was using only the drawingAPI, but the solution is to use this in conjunction with bitmapData.
Basically you draw stuff to a temporary shape, copy it to the bmp, then clear the temporary shape. When you draw to the bmp you can 'erase'.
-
that´s what I had in mind as well- though you might test out instancing of graphics so that you can use brush- textures like photoshop does
the trick is to record the path just like the drawingApi and once you release the mouse button use that path to place the brush patterns along it with equal distances - the more dense the more smooth the result can be.
-
Have you considered just placing each stroke of the drawing in a separate shape, and setting the blendMode of the erase strokes shapes to "erase"? You can occasionally just do a simple draw of the canvas to a bmd, if you don't want too many shapes hanging around.
-
Actually render something that I've always been interested in was recreating the brushes that illustrator uses, rather than the photoshop ones. I'm not sure what the best approach is, short of recording the mathematical formulas for the paths of the brush and then shaping them around the drawn path. But ideally I would want something more versatile that that, so I could use bitmaps or whatever else. I thought about using displacement maps, but things seem to get very ugly that way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|