Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-13-2010, 07:24 AM   PM User | #1
brbati
New to the CF scene

 
Join Date: Sep 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
brbati is an unknown quantity at this point
BitmapData size problem

BitmapData has limited size (2880x2880). How to create bitmap larger than that?
brbati is offline   Reply With Quote
Old 09-14-2010, 07:05 AM   PM User | #2
taguru
New to the CF scene

 
Join Date: Sep 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
taguru is an unknown quantity at this point
Try this:

public class VirtualScreenBitmapData
{
private const maxWidth:int = 2880;

private var bitmapArray:Array;

private var width:int;
private var height:int;

public function VirtualScreenBitmapData(width:int, height:int, transparent:Boolean, fillColor:uint)
{
bitmapArray = new Array();

this.width = width;
this.height = height;

var count:int = Math.ceil(width/maxWidth);

for(var i:int=0; i<count; i++)
bitmapArray.push(new BitmapData(i<(count-1)?maxWidthwidth-(count-1)*maxWidth), height, transparent, fillColor));
}

public function get Width():int
{
return width;
}

public function get Height():int
{
return height;
}

public function Dispose():void
{
for(var i:int=0; i<bitmapArray.length; i++)
(bitmapArray[i] as BitmapData).dispose();
}

public function Draw(source:IBitmapDrawable):void
{
for(var i:int=0; i<bitmapArray.length; i++)
{
var mx:Matrix = i!=0?new Matrix(1, 0, 0, 1, -i*maxWidth):null;
(bitmapArray[i] as BitmapData).draw(source, mx);
}
}

public function CopyTo(dest:BitmapData, sourceRect:Rectangle, dx:int):void
{
var x1BitmapIndex:int = Math.floor(sourceRect.x/maxWidth);
var x1:int = sourceRect.x%maxWidth;
var x2BitmapIndex:int = Math.floor((sourceRect.x+sourceRect.width)/maxWidth);
var x2:int = (sourceRect.x+sourceRect.width)%maxWidth;
var left:int;

var rect1:Rectangle = new Rectangle(x1, 0, x1BitmapIndex==x2BitmapIndex?(x2-x1)maxWidth-x1), height);
dest.copyPixels(bitmapArray[x1BitmapIndex], rect1, new Point(dx, 0));
left = dx+rect1.width;
for(var i:int=x1BitmapIndex+1; i<x2BitmapIndex; i++)
{
dest.copyPixels(bitmapArray[i], new Rectangle(0, 0, maxWidth, height), new Point(left, 0));
left += maxWidth;
}
if (x2BitmapIndex!=x1BitmapIndex)
dest.copyPixels(bitmapArray[x2BitmapIndex], new Rectangle(0, 0, x2, height), new Point(left, 0));
}
}

This class is part of finance ticker package. Visit http://www.ta-guru.com/ticker.php5 to download whole package. There you will see how you can use this class.
taguru is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:45 AM.


Advertisement
Log in to turn off these ads.