# BitmapData.graphics implementation

**URL:** <https://forum.kirupa.com/t/bitmapdata-graphics-implementation/231733>\
**Category:** flash\
**Created:** [July 7, 2007, 6:16am UTC](https://forum.kirupa.com/t/bitmapdata-graphics-implementation/231733 "2007-07-07T06:16:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CarlLooper](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@CarlLooper](https://forum.kirupa.com/u/CarlLooper)\
**Post date:** [July 7, 2007, 6:16am UTC](https://forum.kirupa.com/t/bitmapdata-graphics-implementation/231733/1 "2007-07-07T06:16:51Z")

</div>

I’ve extended the BitmapData class to enable the following type of coding. All graphics calls are supported. Haven’t done any performance testing but if anyone wants to test it - feel free.

```auto

[COLOR=Gray]// EXAMPLE USAGE[/COLOR]

import BitmapDataEx; [COLOR=Gray]// BitmapDataEx extends flash.display.BitmapData[/COLOR]

[COLOR=Gray]// create a BitmapDataEx object in exactly the same way 
// as you would create a BitmapData object [/COLOR]

var bmd = new BitmapDataEx(100, 100, true, 0xFFaabbcc);

[COLOR=Gray]// convert such to a displayable bitmap[/COLOR]

var bitmap = new Bitmap(bmd);

[COLOR=Gray]// add the bitmap to the display list so it will be visible[/COLOR]

addChild(bitmap);

[COLOR=Gray]// position the bitmap[/COLOR]

bitmap.x = 100;
bitmap.y = 100;

[COLOR=Gray]// use graphics calls on the bitmap[/COLOR] 

bmd.graphics.clear();
bmd.graphics.lineStyle(1,0xFF0000);
bmd.graphics.beginFill(0xffbbaa);
bmd.graphics.drawCircle(50,50,40);
bmd.graphics.endFill();
[COLOR=Gray]
// drawings are not actually drawn until you call draw 
[/COLOR]
bmd.graphics.draw();

```
