• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Android limit of 8,191px bitmapdata .. not an issue on iOS [HELP]

Engaged ,
Nov 15, 2015 Nov 15, 2015

Copy link to clipboard

Copied

I'm creating some bitmaps that are larger than 8,191 pixels. Everything works fine on iOS...  even 20,000 pixels and above..  on Android anything over 8,191 hangs my app.

Does anyone have experience with this or know of a workaround?  Had to completely remove a feature from my Android app because of this. 

TOPICS
Development

Views

815

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 16, 2015 Nov 16, 2015

Copy link to clipboard

Copied

According to the Adobe ActionScript 3 documentation (linked below and possibly not up to date since it references AIR 1.5 specifically), a DisplayObject cannot have more than 16,777,215 pixels ( 4096*4096 - 1, 2048*8192 - 1, 1024*16382 - 1) contained within it. Depending on how wide your images are, over 20000 pixels tall (838px wide in that instance) seems like it is possible according to the docs. But the version of OpenGL Android uses is different per Android OS version, and the capabilities change based on the version. So you may need to look into what the limitations are of the Android device and OS you are testing with to know what you can do. It could be a memory issue or it could be an image size limit of the Android device you are testing with.

Question. Why are you needing to create images that big in size? If you really do, you could split them up into multiple images and have the X/Y positions place the second image directly after the first.

DisplayObject - Adobe ActionScript® 3 (AS3 ) API Reference

http://developer.android.com/guide/topics/graphics/opengl.html

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

The reason I need to capture an image that large is because its an image of a massive visual checklist... bitmapdata gets passed to a social ANE to share on Facebook, iMessage, etc.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 19, 2015 Nov 19, 2015

Copy link to clipboard

Copied

Normally in these situations you would create several smaller bitmaps and tile them (but them inside a Sprite, for example).

If flash still won't let you do this because the total width/height exceeds the limit, then you'll need to add/remove them from the display list as the user scroll to view it.

However - it's not going to help though if you need to pass that BitmapData around (to the ANE you mention). Can you scale it down (BitmapData.draw) to a smaller bitmap before passing it to the ANE, or does it need to be that big?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 19, 2015 Nov 19, 2015

Copy link to clipboard

Copied

Dumb question ...

If the sprite that I'm capturing is say 600px x 21,000px   ..    how do I capture it smaller than it actually is ?  Wouldnt I still have to capture the large bitmap and then resize it ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 19, 2015 Nov 19, 2015

Copy link to clipboard

Copied

BitmapData.draw() and BitmapData.drawWithQuality() can both take a matrix parameter. You use that to scale down the contents that are grabbed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 19, 2015 Nov 19, 2015

Copy link to clipboard

Copied

Yes, Colin is correct. You use matrix.scale

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 20, 2015 Nov 20, 2015

Copy link to clipboard

Copied

I've never used matrix.scale  ... would that be easy to adapt to this ?

if(currentOS == "Android"){

  shareHeight = 9420;

  rectangle = null;

  rectangle = new Shape; // initializing the variable named rectangle

  rectangle.graphics.beginFill(0xFFFFFF); // choosing the colour for the fill, here it is white

  rectangle.graphics.drawRect(0, 0, 640,shareHeight); // (x spacing, y spacing, width, height)

  rectangle.graphics.endFill(); // not always needed but I like to put it in to end the fill

  myBitmapData = null;

  myBitmapData = new BitmapData(640, shareHeight);

  myBitmapData.draw(rectangle); // Add white rectangle

  myBitmapData.draw(charactersMain_mc,  new Matrix(1, 0, 0, 1, 5, 10)); // Add Movieclip

  }

Any help is appreciated..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 22, 2015 Nov 22, 2015

Copy link to clipboard

Copied

LATEST

The short answer: yes

I haven't tested this, but try something like:

if(currentOS == "Android"){

  shareHeight = 9420;

  shareWidth = 640;

  maxBitmapSize = 1024; // or whatever you want maximum to be

  var scale : Number = Math.min( maxBitmapSize / shareHeight, maxBitmapSize / shareWidth);

  var scaledWidth : int = int( shareHeight * scale );

  var scaledHeight : int = int( shareWidth * scale );

  rectangle = null;

  rectangle = new Shape; // initializing the variable named rectangle

  rectangle.graphics.beginFill(0xFFFFFF); // choosing the colour for the fill, here it is white

  rectangle.graphics.drawRect(0, 0, scaledWidth , scaledHeight); // (x spacing, y spacing, width, height)

  rectangle.graphics.endFill(); // not always needed but I like to put it in to end the fill

  var matrix : Matrix = new Matrix();

  matrix.scale( scale, scale ); // I think this is the correct order, but might need to swap scale and translate

  matrix.translate(5, 10);

  myBitmapData = null;

  myBitmapData = new BitmapData( scaledWidth, scaledHeight );

  myBitmapData.draw(rectangle); // Add white rectangle

  myBitmapData.draw(charactersMain_mc,  matrix); // Add Movieclip

}

By the way, you could completely skip the whole drawing of the rectangle in the above example, and replace it with a fill color passed in to the BitmapData constructor:

if(currentOS == "Android"){

  shareHeight = 9420;

  shareWidth = 640;

  maxBitmapSize = 1024; // or whatever you want maximum to be

  var scale : Number = Math.min( maxBitmapSize / shareHeight, maxBitmapSize / shareWidth);

  var scaledWidth : int = int( shareHeight * scale );

  var scaledHeight : int = int( shareWidth * scale );

  var matrix : Matrix = new Matrix();

  matrix.scale( scale, scale ); // I think this is the correct order, but might need to swap scale and translate

  matrix.translate(5, 10);

  myBitmapData = null;

  myBitmapData = new BitmapData( scaledWidth, scaledHeight, false, 0xFFFFFF );  // Initially fill with solid white

  myBitmapData.draw(rectangle); // Add white rectangle

  myBitmapData.draw(charactersMain_mc,  matrix); // Add Movieclip

}

But I'm guessing this is a simplification of your code, and there is actually other content in the rectangle?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines