I want to fill bitmapdata with transparent sprites using different transformations and blend-modes. It causes light lines on the borders of image after drawing.
Here is screenshot of result without using blend-modes http://www.flasher.ru/forum/attachment.php?attachmentid=30347&stc=1&d=1389390901 And result when using blend-modes http://www.flasher.ru/forum/attachment.php?attachmentid=30348&stc=1&d=1389390901
here example of code, as singleSp you can use any transparent image
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.geom.Rectangle;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
public class Main extends Sprite
{
[Embed(source = "assets/pic1.png")]
public var singleSp:Class;
var picBD:BitmapData;
var picBM:Bitmap;
public function Main():void
{
picBD = new BitmapData(600, 600, true, 0);
picBM = new Bitmap(picBD, "auto", true);
addChild(picBM);
var tr:Matrix = new Matrix();
var drawIm:BitmapData = (new singleSp as Bitmap).bitmapData;
for (var i:int = 0; i < 30; i++ ) {
var scale:Number = 0.3 + Math.random() * 0.8;
tr.setTo(1, 0, 0, 1, 0, 0);
tr.scale(scale, scale);
tr.rotate(Math.random() * 2);
tr.tx = Math.random() * 150 + 150;
tr.ty = Math.random() * 150;
picBD.draw(drawIm, tr, new ColorTransform(1,1,1,0.4), "invert", null, true);
}
}
}
}
I have run a test and I can seen those lines (edges of the image) My guess is that artefact is due to the semi transparent colorTransform.