# Stretch a bitmap

**URL:** <https://forum.kirupa.com/t/stretch-a-bitmap/317122>\
**Category:** Uncategorized\
**Created:** [December 11, 2010, 12:44am UTC](https://forum.kirupa.com/t/stretch-a-bitmap/317122 "2010-12-11T00:44:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbo](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@tbo](https://forum.kirupa.com/u/tbo)\
**Post date:** [December 11, 2010, 12:44am UTC](https://forum.kirupa.com/t/stretch-a-bitmap/317122/1 "2010-12-11T00:44:59Z")

</div>

I had this thought.  
With Air for Android you always want to be as fast as possible of course. (especially me since my coding is not excellent)

I need to draw 3 lines repeatedly. (only three visible at any given time)

My thought is, rather than actually drawing the lines, you have three 1 px cached bitmaps in an array

```auto

for (var i:uint=0; i<3; i++)
{
    var bmd:BitmapData = new BitmapData(1,1,false,0x000000);
    var bmp:Bitmap = new Bitmap(bmd);
    bmp.cacheAsBitmap=true;
    bmp.cacheAsBitmapMatrix = new Matrix();
    imageArray.push(bmp);
}

```

to draw the lines:

```auto
for (var j:uint=0; j<3; j++)
{
    var line:Bitmap = imageArray[j];
    property= objectArray[j].property; // get predetermined properties
    line.x = property;
    line.y = property;
    line.width = 200; //stretch it out to the proper length
    line.height = 5; // line thickness
    line.rotation = 40;
    addChild(line);
}

```

I suppose i will have to test and see if its actually faster or not.

the idea is that your just manipulating separate cached bitmaps to act as your visual lines.
