Archive

Archive for November, 2014

Filters on large images

November 25, 2014 Leave a comment

In Flex and Flash in you put a filter on a large image, it won’t work. You will see in your console messages something like :

Warning: Filter will not render. The DisplayObject’s filtered dimensions (6302, 3540) are too large to be drawn.

There is a way to make your filters work any way. Below you will find my code for a ColorMatrixFilter.

– Before :

var colorMatrix:ColorMatrix = new ColorMatrix();
colorMatrix.adjustColor( photoComponent.luminosity, photoComponent.contrast, photoComponent.saturation, 0);

image.filters = [new ColorMatrixFilter(colorMatrix)];

– After:

var colorMatrix:ColorMatrix = new ColorMatrix();
colorMatrix.adjustColor( photoComponent.luminosity, photoComponent.contrast, photoComponent.saturation, 0);

Bitmap(image.data).bitmapData.applyFilter( Bitmap(image.data).bitmapData, new Rectangle(0,0, image.width, image.height), new Point(0,0), new ColorMatrixFilter(colorMatrix) );

Categories: Uncategorized