Posts

Es werden Posts vom Dezember, 2013 angezeigt.

Erasing parts of a Bitmap: bitmapData.draw with BlendMode.ERASE turns erased areas black instead of transparent

Been trying to erase areas of a Bitmap using a circle-type Sprite. Worked using the Sprite on the bitmap's bitmapData.draw method but for some reason instead of making the areas I've been deleting transparent, they'd just turn black. Problem was I was using a JPG without alpha layer which obviously couldn't have any transparency. Solution was I would transfer the JPG bitmapData into a new bitmap that had an extra alpha layer with transparency on. This was achieved by creating a new BitmapData with true as transparency value and adding a 8-digit color value for fillColor:uint parameter. [Embed(source="image.jpg",mimeType="image/jpeg")] private var bmp:Class; private var drawOn:Bitmap; var bmpd:BitmapData = new BitmapData(1280,780,true,0x00000000); bmpd.draw( new bmp ); drawOn = new Bitmap(bmpd); I could drawOn.bitmapData.draw( myBrushSprite, etc...) now with transparency. Had some nasty looking edges around my brush sprite which disappeare...