This content has been marked as final. Show 4 replies
You can use imageObject.extractAlpha() to get the alpha channels of your
2 images, copyPixels() to combine them and setAlpha() to add the
resulting grayScale image object as an alpha channel - just be aware
that setAlpha() will fail if the alpha channel's dimensions don't match
the image's dimensions
I'm not quite there yet with this problem. I've extracted two Alpha's from to different bitmaps and the only way I've managed to combine both alpha's together is by repeating through each alpha pixel by pixel to see if the pixel is black and if it is drawing it into another bitmap. Once it's finished I then use setAlpha.
Even though it works it just takes a bit of time to loop through all the pixels and I might be using his technique on more than two bitmaps with alpha's. Is there a neat way i can do this using copypixel?
let's say you now have alphaImg1 and alphaImg2... try copyImages with the #ink parameter... the values for the different inks can be found in the help... in my example below I'm going to try using 39 - Darkest ink.
alphaImg1.copyPixels(alphaImg2, alphaImg1.rect, alphaImg2.rect, [#ink: 39])
Spot on Chunick. I used ink 37 which seemed to give me the best result and it's A LOT faster than my repeat method. It was taking 14 seconds plus to draw and this is instant.