AS3 Photoshop笔刷笔刷、Photoshop

2023-09-08 15:28:11 作者:奈何桥上唱咆哮

我在寻找一种方式来建立一个像在ActionScript 3绘图工具,特别是我想建立类似Photoshop中的画笔一个Photoshop。这样就可以使用不同的巴新作为刷子。

I'm searching for a way to build a photoshop like drawing tool in ActionScript 3. Especially I want to build something like the brushes in photoshop. So that you can use different PNG's as a brush.

我试图拯救在Photoshop画笔为一个透明的PNG,将其导入到我的AS3项目,并用鼠标移动事件,画出你将鼠标移动到一个BitmapData对象巴布亚新几内亚每次。 但是,这看起来并不像Photoshop。这里有一个例子,首先是Photoshop中绘制,那么AS3图:

I tried it with saving a brush in photoshop as a transparent png, import it into my AS3 project and with a mouse move event, draw the png everytime you move the mouse into a bitmapdata object. But that doesn't look like photoshop. Here's a example, first the photoshop drawing, then the as3 drawing:

在Photoshop中看起来很顺利,但在AS3中你有丑陋的边角和颜色的变化。 有谁知道一个解决方案吗?

In photoshop it looks very smooth, but in as3 you have that ugly corners and color shifts. Does anyone know a solution?

THX,礼服

推荐答案

要更具体:你应该在鼠标按下触发每次做一个临时的位图。在此刷子将绘制黑色和白色 - 当你的画刷阿尔法未满这将产生例如平滑的结果。另外 - 在这里你将不得不使用的走技术,通过grapefrukt作为上述

To be more specific: You should make a temporary bitmap each time a mouseDown is fired. On this the brushes will be drawn in black and white - this will produce smoother results for example when you make the drawn brush not full in alpha. Also - here you will have to use the "walking" technique, as said by grapefrukt.

最后,当鼠标松开事件被触发,你必须重新着色位图(用于刷色),可能如果你想添加一些过滤器和借鉴它的主要位图。

Finally, once the mouseUp event is fired, you have to recolor the bitmap (for brush color), possibly add some filters if you want and draw it on the main bitmap.