BitmapData class

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.

Implemented types

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

height → num
final
rectangle Rectangle<num>
read-only
renderTexture RenderTexture
read-only
renderTextureQuad RenderTextureQuad
final
width → num
final
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, 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 at destPoint. [...]
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
render(RenderState renderState) → void
override
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, 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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited

Static Properties

defaultLoadOptions BitmapDataLoadOptions
read / write

Static Methods

load(String url, [ BitmapDataLoadOptions options ]) → Future<BitmapData>
Loads a BitmapData from the given url.