I made an effect similar to the paint bucket feature in Photoshop. This replace colors similar to a user defined color with a specific color.
You can download the BMPFunctions.as file in the following link.
포토샵의 페인트 버켓 툴과 비슷한 효과를 만들어 보았습니다. 지정된 색과 비슷한 색상을 찾아서 원하는 색상으로 바꿔줍니다.
클래스 파일은 아래 페이지에서 BMPFunctions.as를 다운로드하면 됩니다.
PhotoshopのPaint Bucketのような物を作ってみました。選んだ色に似ている色をほかの色に変わります。
下のリンクのページで BMPFunctions.asファイルをダウンロードできます。
http://hangunsworld.com/classes/com/hangunsworld/as3/util/
import com.hangunsworld.as3.util.BMPFunctions;
var bd:BitmapData = new BitmapData(mc.width, mc.height, true, 0×00000000);
bd.draw(mc);
var bmp:Bitmap = new Bitmap(bd);
addChild(bmp);
bmp.x = mc.width;
// Replace Color button event listener
replace_btn.addEventListener(MouseEvent.CLICK, doReplace);
function doReplace(evt:MouseEvent):void{
var c1:uint = uint(“0x” + c1_txt.text);
var c2:uint = uint(“0x” + c2_txt.text);
var t:uint = Math.max(0, Math.min(255, uint(t_txt.text)));
t_txt.text = t.toString();
// draws original image
bd.draw(mc);
// replaces colors
bd = BMPFunctions.replaceColor(bd, c1, c2, t);
}
답글 남기기