AND Blend Mode

From Director Online Wiki
Jump to: navigation, search
--result := a AND b;
-- ******* AND mode *************
on ANDBlendMode (image1, image2)
 
  theWidth = image1.width - 1
  theHeight = image1.height - 1
  theImage = image(theWidth + 1, theHeight + 1, 32)
  repeat with x = 0 to theWidth
    repeat with y = 0 to theHeight
      theColour1 = image1.getPixel(point(x,y), #integer)
      theColour2 = image2.getPixel(point(x,y), #integer)
 
      theNewColour = bitAnd(theColour1, theColour2)
 
      theImage.setPixel(point(x, y), theNewColour)
 
    end repeat
  end repeat
  return theImage
end