| Package | com.afcomponents.umap.styles |
| Class | public class BitmapStyle |
| Inheritance | BitmapStyle Style |
GeometryStyle class
in the GeometryStyle.fillBitmap property.
BitmapStyle & GeometryStyle classes
for creating a bitmap-filled rectangle:
import com.afcomponents.umap.styles.GeometryStyle;
import com.afcomponents.umap.styles.BitmapStyle;
import flash.display.Sprite;
import flash.display.BitmapData;
// create checkered pattern
var pattern:Sprite = new Sprite();
with(pattern.graphics)
{
beginFill(0xFFCC00);
drawRect(0,0,10,10);
drawRect(10,10,10,10);
beginFill(0x000000);
drawRect(0,10,10,10);
drawRect(10,0,10,10);
}
// create new bitmap from checkered pattern
var bitmap:BitmapData = new BitmapData(pattern.width, pattern.height);
bitmap.draw(pattern);
// create new GeometryStyle with bitmap fill
var style:GeometryStyle = new GeometryStyle();
style.stroke = GeometryStyle.NONE;
style.fill = GeometryStyle.BITMAP;
style.fillBitmap = new BitmapStyle();
style.fillBitmap.bitmap = bitmap;
// apply geometry style to draw bitmap-filled rectangle
style.applyTo(this.graphics);
this.graphics.drawRect(0,0,100,100); You should see a bitmap-filled rectangle after executing the code:
See also
| Property | Defined by | ||
|---|---|---|---|
| bitmap : BitmapData = null
A transparent or opaque bitmap image that contains the bits to be displayed.
| BitmapStyle | ||
| matrix : Matrix = null
A matrix object (of the
flash.geom.Matrix class),
which you can use to define transformations on the bitmap. | BitmapStyle | ||
| repeat : Boolean = true
Defines wether to repeat, or scale the bitmap.
| BitmapStyle | ||
| smooth : Boolean = true
Defines whether to use smoothing (bilinear algorithm) on the scaled bitmap.
| BitmapStyle | ||
| Method | Defined by | ||
|---|---|---|---|
|
BitmapStyle(param:Object = null)
BitmapStyle contructor.
| BitmapStyle | ||
![]() |
Creates a copy of the
Style object. | Style | |
![]() |
Creates a clone of this
Style,
copies the properties from specified object and returns the new style. | Style | |
![]() |
copy(object:Object):void
Copies all the properties from the specified object into the
Style object. | Style | |
![]() |
copyStyle(dest:Object, src:Object):void
[static]
Copies all properties of one object into another.
| Style | |
![]() |
getStyleFromXML(xml:XML):Style
[static]
Returns new
Style object, from the source XML object. | Style | |
![]() |
getXMLFromStyle(style:Style, name:String = ""):XML
[static]
Returns an
XML object that represents all the style's properties. | Style | |
![]() |
toString():String
Returns a
String that represents all the style's properties. | Style | |
![]() |
toXML(afcTags:Boolean = false):XML
Abstract function.
| Style | |
| bitmap | property |
public var bitmap:BitmapData = nullA transparent or opaque bitmap image that contains the bits to be displayed.
The default value is null.
See also
| matrix | property |
public var matrix:Matrix = null
A matrix object (of the flash.geom.Matrix class),
which you can use to define transformations on the bitmap.
For instance, you can use the following matrix to rotate a bitmap by 45 degrees (pi/4 radians):
matrix = new flash.geom.Matrix(); matrix.rotate(Math.PI/4);
The default value is null.
See also
| repeat | property |
public var repeat:Boolean = trueDefines wether to repeat, or scale the bitmap.
If true, the bitmap image repeats in a tiled pattern.
If false, the bitmap image does not repeat,
and the edges of the bitmap are used for any fill area that extends beyond the bitmap.
The default value is true.
| smooth | property |
public var smooth:Boolean = trueDefines whether to use smoothing (bilinear algorithm) on the scaled bitmap.
If false, upscaled bitmap images are rendered by
using a nearest-neighbor algorithm and look pixelated.
If true, upscaled bitmap images are rendered by using a bilinear algorithm.
Rendering by using the nearest neighbor algorithm is usually faster.
The default value is false.
| BitmapStyle | () | constructor |
public function BitmapStyle(param:Object = null)BitmapStyle contructor.
Creates new BitmapStyle object with the default parameters.
Properties defined in param object will override the default values.
param:Object (default = null) — Object that holds all the properites of a style you wish to override upon its creation.
|