| Package | graphics.display |
| Class | public class CropBitmapData |
| Inheritance | CropBitmapData flash.display.BitmapData |
Example :
package examples
{
import graphics.display.CropBitmapData;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.display.StageScaleMode;
import flash.geom.Rectangle;
[SWF(width="200", height="200", frameRate="24", backgroundColor="#333333")]
public dynamic class CropBitmapDataExample extends Sprite
{
public function CropBitmapDataExample()
{
//////////
stage.align = "" ;
stage.scaleMode = StageScaleMode.NO_SCALE ;
/////////
var picture:BitmapData = new Picture(0,0) as BitmapData ; // Picture a symbol in the library
var crop:BitmapData = new CropBitmapData( picture , new Rectangle( 18 , 31, 120, 120 ) , true , true , 0x55A2A2A2 ) ;
var bitmap:Bitmap = new Bitmap( crop ) ;
bitmap.x = 35 ;
bitmap.y = 35 ;
trace( bitmap.width + " / " + bitmap.height ) ;
addChild( bitmap ) ;
}
}
}
| Method | Defined By | ||
|---|---|---|---|
CropBitmapData(bitmap:IBitmapDrawable, area:Rectangle = null, smoothing:Boolean = true, transparent:Boolean = true, fillColor:uint = 0, matrix:Matrix = null, colorTransform:ColorTransform = null, blendMode:String = null, clipRect:Rectangle = null, strict:Boolean = true)
Creates a new CropBitmapData instance. | CropBitmapData | ||
| CropBitmapData | () | Constructor |
public function CropBitmapData(bitmap:IBitmapDrawable, area:Rectangle = null, smoothing:Boolean = true, transparent:Boolean = true, fillColor:uint = 0, matrix:Matrix = null, colorTransform:ColorTransform = null, blendMode:String = null, clipRect:Rectangle = null, strict:Boolean = true)Creates a new CropBitmapData instance.
Parametersbitmap:IBitmapDrawable — The IBitmapDrawable object to transform (DisplayObject or BitmapData).
| |
area:Rectangle (default = null) — The area to crop the original IBitmapDrawable object. If this Rectangle is null the BitmapData is a simple copy of the original view.
| |
smoothing:Boolean (default = true) — A Boolean value that determines whether a BitmapData object is smoothed when scaled or rotated, due to a scaling or rotation in the matrix parameter. The smoothing parameter only applies if the source parameter is a BitmapData object.
| |
transparent:Boolean (default = true) — Specifies whether the bitmap image supports per-pixel transparency. The default value is true (transparent). To create a fully transparent bitmap, set the value of the transparent parameter to true and the value of the fillColor parameter to 0x00000000 (or to 0). Setting the transparent property to false can result in minor improvements in rendering performance.
| |
fillColor:uint (default = 0) — A 32-bit ARGB color value that you use to fill the bitmap image area. The default value is 0 (black transparent).
| |
matrix:Matrix (default = null) — A Matrix object used to scale, rotate, or translate the coordinates of the bitmap. If you do not want to apply a matrix transformation to the image, set this parameter to an identity matrix, created with the default new Matrix() constructor, or pass a null value.
| |
colorTransform:ColorTransform (default = null) — A ColorTransform object that you use to adjust the color values of the bitmap. If no object is supplied, the bitmap image's colors are not transformed. If you must pass this parameter but you do not want to transform the image, set this parameter to a ColorTransform object created with the default new ColorTransform() constructor.
| |
blendMode:String (default = null) — A string value, from the flash.display.BlendMode class, specifying the blend mode to be applied to the resulting bitmap.
| |
clipRect:Rectangle (default = null) — A Rectangle object that defines the area of the source object to draw. If you do not supply this value, no clipping occurs and the entire source object is drawn.
| |
strict:Boolean (default = true) — Indicates if the crop use the minimal size of the bitmap to crop or only the passed-in area Rectangle.
|