Highlighted

Save to camera roll kicks in before draw stage is done. How to solve this? (ios)

Explorer ,
Aug 24, 2014

Copy link to clipboard

Copied

Hi,

My app takes a screensave of an area of the stage and save it to the camera roll. The problem is that cameraRoll.addBitmapData(bitmapDataA); kicks in before the draw is done.

Is there a way to use oncomplete events on the draw-function or something like that?

Thanks,

Dan

  bitmapdata = new BitmapData(stage.stageWidth, stage.stageHeight);

  bitmapDataA = new BitmapData(1536, 1536);

  bitmapdata.draw(stage);

  bitmapDataA.copyPixels(bitmapdata, new Rectangle(0,236, 1536, 1772), new Point(0, 0));

  cameraRoll.addBitmapData(bitmapDataA);

TOPICS
Development

Views

245

Likes

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

Save to camera roll kicks in before draw stage is done. How to solve this? (ios)

Explorer ,
Aug 24, 2014

Copy link to clipboard

Copied

Hi,

My app takes a screensave of an area of the stage and save it to the camera roll. The problem is that cameraRoll.addBitmapData(bitmapDataA); kicks in before the draw is done.

Is there a way to use oncomplete events on the draw-function or something like that?

Thanks,

Dan

  bitmapdata = new BitmapData(stage.stageWidth, stage.stageHeight);

  bitmapDataA = new BitmapData(1536, 1536);

  bitmapdata.draw(stage);

  bitmapDataA.copyPixels(bitmapdata, new Rectangle(0,236, 1536, 1772), new Point(0, 0));

  cameraRoll.addBitmapData(bitmapDataA);

TOPICS
Development

Views

246

Likes

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
Aug 24, 2014 0
Engaged ,
Aug 25, 2014

Copy link to clipboard

Copied

Other people will have to either confirm or debunk this as an option, but you could add ", true, 0x00000000" to the creation of your BitmapData objects so they will start out as blank bitmaps. Next step is to run a BitmapData.getPixel32() call on either a timer or EnterFrame and once the returned value is no longer 0, you know that the image has been fully drawn.

This thought process is making an assumption that the draw() and copyPixels() methods render pixels in a left-to-right, top-to-bottom order, and start at the (0,0) position. That is the part I was saying that others would have to confirm or debunk as a viable option. I ran a basic test of this on my Mac, and it worked but I don't have an iOS device to test with in a real world case. Basically this method has you checking to see if the bottom right pixel has a pixel color value that is not 0, meaning it has some color value in it.

bitmapdata = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x00000000);

bitmapDataA = new BitmapData(1536, 1536, true, 0x00000000);

bitmapdata.draw(stage);

bitmapDataA.copyPixels(bitmapdata, new Rectangle(0,236, 1536, 1772), new Point(0, 0));

// in some timer or enter frame

if (bitmapDataA.getPixel32(1535, 1535) != 0) {

    // terminate timer or enter frame

    cameraRoll.addBitmapData(bitmapDataA);

}

Likes

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
Reply
Loading...
Aug 25, 2014 0
gronli21 LATEST
Explorer ,
Aug 26, 2014

Copy link to clipboard

Copied

Thanks for your reply.

After some research and testing. I found out that it's this bug that is causing my problems: https://bugbase.adobe.com/index.cfm?event=bug&id=3340382

[ErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="Error #3004: Insufficient file space." errorID=3004]

I can't find any good solution for this problem.

Likes

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
Reply
Loading...
Aug 26, 2014 0