312
ActionScript classes
var filterRect:Rectangle =
myBitmapData.generateFilterRect(myBitmapData.rectangle, filter);
trace(filterRect); // (x=-31, y=-31, w=162, h=142)
getColorBoundsRect
(BitmapData.getColorBoundsRect method)
public getColorBoundsRect(mask:Number, color:Number, [findColor:Boolean]) :
Rectangle
Determines a rectangular region that fully encloses all pixels of a specified color within the
bitmap image.
For example, if you have a source image and you want to determine the rectangle of the image
that contains a nonzero alpha channel, you pass
{mask: 0xFF000000, color:
0x00000000}
as parameters. The entire image is searched for the bounds of pixels whose
(value & mask) != color
. To determine white space around an image, you pass
{mask:
0xFFFFFFFF, color: 0xFFFFFFFF}
to find the bounds of nonwhite pixels.
Availability:
ActionScript 1.0; Flash Player 8
Parameters
mask
:Number
- A hexadecimal color value.
color
:Number
- A hexadecimal color value.
findColor
:Boolean
[optional] - If the value is set to
true
, returns the bounds of a color
value in an image. If the value is set to
false
, returns the bounds of where this color doesn't
exist in an image. The default value is
true
.
Returns
flash.geom.Rectangle
- The region of the image that is the specified color.
Example
The following example shows how to determine a rectangular region that fully encloses all
pixels of a specified color within the bitmap image:
import flash.display.BitmapData;
import flash.geom.Rectangle;
var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
var mc:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...