Just thinking here.
Is there a way instead of drawing viewport to bitmap data .. I draw the stage to bitmap data.. then crop the image produced. ? Maybe this would get around the problem ?
What you're seeing is expected behavior. The reason is, is that the StageWebView viewport is returning the actual dimensions of the new iPad view. Since SWV is actually using the native UIWebView, it's returning the high res result.
I'm guessing you didn't build the app with retina support, i.e. commandline compile with -platformsdk pointing to iOS 5.1 SDK. What you're seeing then is an image from the native browser returned at twice the resolution of what the app is returning, because the app isn't set to retina, but the browser is. To fix this, compile the app for retina display, then the image returned will be the correct proportion.
Try that and let us know.
Or, can't you set the width and height of the bitmap to the width and height of the stageview that you created? That should scale it to 100% on the older iPads, and 50% on the new one.
I did compile it with retina support iOS5.1SDK
On iPad2 everything is fine.
@Colin - If I set the width of the viewport to 2048 .. it will be too large on iPad2
My project stage size is still 1024 x 768 .. I've just used x2 graphics and sized them down by 50% .. this results in pixel perfect graphics for retina.
So .. if my stage size is being interpreted as 1024 x 768 and I make the viewport 2048 x 1536 ... it actually puts the viewport as double the size of the iPad even on the iPad3.
When I set viewport to 1024 x 768 for example... it renders perfect on iPad2 and iPad3 .. its just the bitmap capturing of the viewport thats the problem.
@colin - SocialbitmapData = new BitmapData(socialWebView.viewPort.width, socialWebView.viewPort.height);
This works for iPad2 .. but doesnt work for iPad3
very strange problem
That wasn't what I was suggesting. What Rect do you use when creating socialWebView? Can't you set the bitmap to occupy the same rect? The viewPort.width will vary depending on whether it's Retina or not, but surely the stageWebView rect you use will remain the same.
the rect is 1024 x 664 ( height is reduced to allow for a toolbar I have in place )
if I double the size of this rect to 2048 x 1328
Since the project setting stage size is 1024 x 768 .. it will make the viewport run way off stage.
Still not what I was saying. Leave the rect as 1024x664, when you get the bitmap, set its scaleX to 1024/stageWebView.viewPort.width and its scaleY to 664/stageWebView.viewPort.height. That should have no effect on the iPad 2, but ought to scale the image to the right size on the new iPad.
I'll try that
Just a note as well. I wrote this solution ... works perfectly when tested from the IDE .. copyPixels fails to display anything on iPad2 or iPad3
bitmapdataBrowser = new BitmapData(stage.stageWidth, stage.stageHeight);
bitmapDataA = new BitmapData(1024, 664);
bitmapDataA.copyPixels(bitmapdataBrowser, new Rectangle(0, 42, 1024, 664), new Point(0, 0));
var screenshot = new Bitmap(bitmapDataA);
screenshot.x = 0;
screenshot.y = 42;
No go on your scaleX scaleY suggestion. It does the exact same thing. It zooms in on the bitmap when viewed on an iPad3.
Here is my code.
SocialbitmapData = new BitmapData(socialWebView.viewPort.width, socialWebView.viewPort.height);
socialViewBitmap = new Bitmap(SocialbitmapData);
shareFacebookBTN.visible = false;
socialContent_mc.y = 768;
socialViewBitmap.scaleX = 1024/socialWebView.viewPort.width;
socialViewBitmap.scaleY = 664/socialWebView.viewPort.height;
socialViewBitmap.x = 0;
socialViewBitmap.y = 42;
Have I done something wrong in regards to your suggestion ?
So I did a test ... change the scaleX and scaleY t0
socialViewBitmap.scaleX = .5;
socialViewBitmap.scaleY = .5;
Now on the iPad3 the capture looks fine... except its width and height is cropped at 50% obviously because of the .5
So what seems to be happening .. is that
socialViewBitmap = new Bitmap(SocialbitmapData);
this cannot capture stageWebView at the high resolution. When it does the capture it isnt capture what you see with you eye.. its capturing at as if its non-retina. So .. if I capture my screen on the iPad3 which should be a resolution of 2048 x 1536 .... it really only captures stageWebView at 1024 x 768 .. so when you place the captured bitmap on the stage.. you get a non retina bitmap.
Still stuck at the office working on this issue. I've tried everything imaginable. If any of you guys have any more ideas... please shoot them my way. .. Trying to meet a deadline coming up.. this is the last major bug
What are you using to build this, Flash CS5.5 or Flash Builder? Let me try something...
I appreciate anything you can offer.
Were you able to come up with a solution ?
So far I've been able to replicate the problem.
For some reason the image created from the SWV is zoomed in. I see it on
my Xoom tablet as well as the iPad. Still looking into possible
Well I feel better that I'm not going crazy.
I have a feeling that even I there is a workaround that the image it captures wont be of retina (x2) quality.
iBrent ... how did the attempt for a workaround go ?
Did you have any luck with this? This is the only bug I have to get worked out before I can be confident for release. I'm desperate for a solution to this. :(
I've tried a number of things and can't get it to work on the new iPad at the retina display. I don't know if it's an AIR defect, or if it's something with the way UIWebView (the native SDK implementation) is returning incorrect information.
If you're looking to release now, I'd suggest releasing without new iPad retina support, then when it's been fixed in AIR (hopefully) then release an update to address the issue.
I'm not going live in the app store yet. We have a deadline to complete phase 1 in 2 weeks.. Phase 2 will be completed in a month. So probably will be app store ready by mid June.
I'm trying my luck by asking if any of you found a solution for this issue?