Last active
February 22, 2024 06:15
-
-
Save avanderw/5850094 to your computer and use it in GitHub Desktop.
The following color matrix filter will grayscale an image.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private const matrix:Array = [ | |
0.3, 0.59, 0.11, 0, 0, | |
0.3, 0.59, 0.11, 0, 0, | |
0.3, 0.59, 0.11, 0, 0, | |
0, 0, 0, 1, 0]; | |
private const zero:Point = new Point(); | |
grayscale.bitmapData.applyFilter(image.bitmapData, image.getRect(image), zero, new ColorMatrixFilter(matrix)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment