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


BitmapData(num width, num height, [int fillColor = 0xFFFFFFFF, num pixelRatio = 1.0])
BitmapData.fromBitmapData(BitmapData bitmapData, Rectangle<num> rectangle)
BitmapData.fromImageElement(ImageElement imageElement, [num pixelRatio = 1.0])
BitmapData.fromRenderTextureQuad(RenderTextureQuad renderTextureQuad)
BitmapData.fromVideoElement(VideoElement videoElement, [num pixelRatio = 1.0])


hashCode int
The hash code for this object. [...]
read-only, inherited
height num
rectangle Rectangle<num>
renderTexture RenderTexture
renderTextureQuad RenderTextureQuad
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
width num


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
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
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, 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
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]

Static Properties

defaultLoadOptions BitmapDataLoadOptions
read / write

Static Methods

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