The BitmapData class lets you load or create arbitrarily sized transparent or opaque bitmap images and manipulate them in various ways at runtime.
Most of the time you will load BitmapDatas from static image files or get them from a texture atlas. You may also create a BitmapData at runtime and draw arbitrary content onto it's surface.
The BitmapData class is not a display object and therefore can't be added to the display list (the stage or any other container). Use the Bitmap class to create a display object which will show this BitmapData.
The BitmapData class contains a series of built-in methods that are useful for creation and manipulation of pixel data. Consider using the BitmapDataUpdateBatch for multiple sequential manipulations for better performance.
- Implements
-
- BitmapDrawable
Static Properties
- defaultLoadOptions → BitmapDataLoadOptions
-
read / write
Static Methods
-
load(
String url, [ BitmapDataLoadOptions bitmapDataLoadOptions ]) → Future<BitmapData> -
Loads a BitmapData from the given url.
Constructors
- BitmapData(num width, num height, [ int fillColor = 0xFFFFFFFF, num pixelRatio = 1.0 ])
-
factory
- BitmapData.fromBitmapData(BitmapData bitmapData, Rectangle<num> rectangle)
-
factory
- BitmapData.fromImageElement(ImageElement imageElement, [ num pixelRatio = 1.0 ])
-
factory
- BitmapData.fromRenderTextureQuad(RenderTextureQuad renderTextureQuad)
- BitmapData.fromVideoElement(VideoElement videoElement, [ num pixelRatio = 1.0 ])
-
factory
Properties
- hashCode → int
-
Get a hash code for this object.
read-only, inherited - height → num
-
read-only
- rectangle → Rectangle<num>
-
read-only
- renderTexture → RenderTexture
-
read-only
- renderTextureQuad → RenderTextureQuad
-
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited - width → num
-
read-only
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
applyFilter(
BitmapFilter filter, [ Rectangle<num> rectangle ]) → void -
clear(
) → void -
Clear the entire rendering surface.
-
clone(
[num pixelRatio ]) → BitmapData -
Returns a new BitmapData with a copy of this BitmapData's texture.
-
colorTransform(
Rectangle<num> rect, ColorTransform transform) → void -
copyPixels(
BitmapData source, Rectangle<num> sourceRect, Point<num> destPoint) → void -
Copy pixels from
source
, completely replacing the pixels atdestPoint
. -
draw(
BitmapDrawable source, [ Matrix matrix ]) → void -
drawPixels(
BitmapData source, Rectangle<num> sourceRect, Point<num> destPoint, [ BlendMode blendMode ]) → void -
Draws pixels from
source
onto this object. -
fillRect(
Rectangle<num> rectangle, int color) → void -
getPixel(
num x, num y) → int -
Get a single RGB pixel
-
getPixel32(
num x, num y) → int -
Get a single RGBA pixel
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
render(
RenderState renderState) → void -
setPixel(
num x, num y, int color) → void -
Draw an RGB pixel at the given coordinates.
-
setPixel32(
num x, num y, int color) → void -
Draw an RGBA pixel at the given coordinates.
-
sliceIntoFrames(
num frameWidth, num frameHeight, { int frameCount: null, num frameSpacing: 0, num frameMargin: 0 }) → List<BitmapData> -
Returns an array of BitmapData based on this BitmapData's texture.
-
toDataUrl(
[String type = 'image/png', num quality ]) → String -
Return a dataUrl for this BitmapData.
-
toString(
) → String -
Returns a string representation of this object.
inherited