ActionScript 3 删除绘图的问题
我有一个基础图像和一些位于 basd 图像 movieclip 之上的精灵...用户可以使用 actionscript 3 中的图形 api 绘制一些精灵。我可以在精灵上绘制内容,但无法创建橡皮擦就像画笔一样,可以删除部分不需要的图画。我尝试使用Alpha,但不,它不起作用
我已经用谷歌搜索了它并提出了解决方案:
1)Linebitmapstyle...这个解决方案不是最好的,因为我的精灵可以移动,所以如果我使用linebitmapstyle,它确实将像素从图像绘制到精灵,但如果精灵移动,则绘制的像素不会改变。
2)遮蔽可能对我也不起作用......
创建橡皮擦的最佳方法是什么
I have a based image and some sprites on top of the basd image movieclip... Some of the sprites can be drawn by the user using graphics api in actionscript 3. I can draw things on the sprites but I can't create an eraser like brush that can remove part of the unwanted drawings. I try using Alpha but no it doesn't work
I have googled about it and come up with the solution:
1) Linebitmapstyle... This solution is not the best one coz I my sprites can be moved so if I use linebitmapstyle, it does draw the pixel from the image to the sprite but if the sprite moved the drawn pixel won't change.
2) Masking may not work for me either....
What is the best way of creating the eraser
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能更想使用位图来使这些事情更容易操作(当然,除非您需要进行可缩放矢量图形!)。要绘制形状,您仍然可以使用图形 API 来创建形状。
为此,请实例化一个“虚拟”精灵(或另一个
IBitmapDrawable
实现)来创建图形,然后将它们“复制”到bitmapData.draw 的
函数。这样,您可以使用选项BitmapData
中。 ()BlendMode.ERASE
进行绘制,以删除形状的像素。示例(来自我的脑海):
You may rather want to use a Bitmap to make such things easier to manipulate (unless you need to do scalable vector graphics of course!). To draw shapes you can still use the graphics API to create the shapes.
To do so, instantiate a "dummy" sprite (or another
IBitmapDrawable
implementation) to create the graphics and then "copy" them to theBitmapData
thebitmapData.draw()
function. This way you can for instance draw with the optionBlendMode.ERASE
in order remove the pixels of the shape.Example (from the top of my mind) :