| <?xml version="1.0"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <!-- filters/examples/ConvolutionGlowFilterExample .mxml --> |
| <s:Application |
| xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| creationComplete="createFilters()"> |
| |
| <fx:Script><![CDATA[ |
| import spark.filters.*; |
| import flash.filters.BitmapFilterQuality; |
| import flash.filters.BitmapFilterType; |
| |
| private var myOutlineConvolutionFilter:ConvolutionFilter; |
| private var mySharpnessConvolutionFilter:ConvolutionFilter; |
| private var myBrightnessConvolutionFilter:ConvolutionFilter; |
| |
| private var outlineMatrix:Array = [ -30, 30, 0, |
| -30, 30, 0, |
| -30, 30, 0 ]; |
| |
| private var sharpnessMatrix:Array = [0, -1, 0, |
| -1, 20, -1, |
| 0, -1, 0]; |
| |
| private var brightnessMatrix:Array = [2, 2, 2, |
| 2, 0, 2, |
| 2, 2, 2]; |
| |
| public function createFilters():void { |
| myOutlineConvolutionFilter = new ConvolutionFilter(3, 3, outlineMatrix, 9, 0, true, true, 0x00CC99, 0); |
| mySharpnessConvolutionFilter = new ConvolutionFilter(3, 3, sharpnessMatrix, 9, 0, true, true, 0x00CC99, 0); |
| myBrightnessConvolutionFilter = new ConvolutionFilter(3, 3, brightnessMatrix, 3, 0, true, true, 0x00CC99, 0); |
| |
| outlineImage.filters = [myOutlineConvolutionFilter]; |
| sharpnessImage.filters = [mySharpnessConvolutionFilter]; |
| brightnessImage.filters = [myBrightnessConvolutionFilter]; |
| } |
| |
| ]]></fx:Script> |
| |
| <s:VGroup> |
| <s:VGroup> |
| <s:Label text="Original Image"/> |
| <mx:Image id="originalImage" source="@Embed(source='assets/c2.png')"/> |
| </s:VGroup> |
| |
| <s:VGroup> |
| <s:Label text="Outline Matrix Image"/> |
| <mx:Image id="outlineImage" source="@Embed(source='assets/c2.png')"/> |
| </s:VGroup> |
| |
| <s:VGroup> |
| <s:Label text="Sharpness Matrix Image"/> |
| <mx:Image id="sharpnessImage" source="@Embed(source='assets/c2.png')"/> |
| </s:VGroup> |
| |
| <s:VGroup> |
| <s:Label text="Brightness Matrix Image"/> |
| <mx:Image id="brightnessImage" source="@Embed(source='assets/c2.png')"/> |
| </s:VGroup> |
| </s:VGroup> |
| </s:Application> |