03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example<br />

The following example shows how to determine the destination rectangle that the<br />

applyfilter() method affects:<br />

import flash.display.BitmapData;<br />

import flash.filters.BevelFilter;<br />

import flash.geom.Rectangle;<br />

var myBitmapData:BitmapData = new BitmapData(100, 80, true, 0xCCCCCCCC);<br />

var filter:BevelFilter = new BevelFilter(5, 45, 0xFFFF00, 0.8, 0x0000FF,<br />

0.8, 20, 20, 1, 3, "outter", false);<br />

var filterRect:Rectangle =<br />

myBitmapData.generateFilterRect(myBitmapData.rectangle, filter);<br />

trace(filterRect); // (x=-31, y=-31, w=162, h=142)<br />

getColorBoundsRect<br />

(BitmapData.getColorBoundsRect method)<br />

public getColorBoundsRect(mask:Number, color:Number, [findColor:Boolean]) :<br />

Rectangle<br />

Determines a rectangular region that fully encloses all pixels of a specified color within the<br />

bitmap image.<br />

For example, if you have a source image <strong>and</strong> you want to determine the rectangle of the image<br />

that contains a nonzero alpha channel, you pass {mask: 0xFF000000, color:<br />

0x00000000} as parameters. The entire image is searched for the bounds of pixels whose<br />

(value & mask) != color. To determine white space around an image, you pass {mask:<br />

0xFFFFFFFF, color: 0xFFFFFFFF} to find the bounds of nonwhite pixels.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Parameters<br />

mask:Number - A hexadecimal color value.<br />

color:Number - A hexadecimal color value.<br />

findColor:Boolean [optional] - If the value is set to true, returns the bounds of a color<br />

value in an image. If the value is set to false, returns the bounds of where this color doesn't<br />

exist in an image. The default value is true.<br />

Returns<br />

Rectangle - The region of the image that is the specified color.<br />

320 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!