Open fukhaos opened 11 years ago
Could you be more specific? How do you create your overlay? How does it look like when displayed by the ANE? Can you attach an image to show us?
Normal Screen (white square is a button to call camera)
the screenshot after camera close. (looks like trying to put in portrait)
Init Class
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import starling.core.Starling;
[SWF(width="1024", height="748", frameRate="30", backgroundColor="#474747")]
public class TesteCamera extends Sprite
{
private var _starling:Starling;
public function TesteCamera()
{
super();
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
this.addEventListener(Event.ADDED_TO_STAGE, addHandler);
}
protected function addHandler(event:Event):void
{
Starling.handleLostContext = true;
_starling = new Starling(Main, stage);
_starling.start();
}
}
}
Maii Class
package
{
import com.freshplanet.ane.AirImagePicker.AirImagePicker;
import flash.display.BitmapData;
import flash.utils.ByteArray;
import starling.core.RenderSupport;
import starling.core.Starling;
import starling.display.Button;
import starling.display.Quad;
import starling.display.Sprite;
import starling.display.Stage;
import starling.events.Event;
import starling.textures.Texture;
import starling.utils.Color;
public class Main extends Sprite
{
public function Main()
{
var quad:Quad = new Quad(1024,768, Color.YELLOW);
addChild(quad);
var button:Button = new Button(Texture.fromColor(100, 100));
button.addEventListener(Event.TRIGGERED, callCamera);
addChild(button);
}
private function callCamera():void
{
// Clear the buffers
var stage:Stage = Starling.current.stage;
var support:RenderSupport = new RenderSupport();
RenderSupport.clear(stage.color, 1.0);
support.setOrthographicProjection(0, 0, stage.width, stage.height);
stage.render(support, 1.0);
support.finishQuadBatch();
// Take a screenshot of current screen
var screenshot:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
Starling.context.drawToBitmapData(screenshot);
// Setup ANE
AirImagePicker.getInstance().setupStage3DOverlay(Starling.current.stage3D, screenshot)
AirImagePicker.getInstance().displayCamera(callback, false);
}
private function callback(image:BitmapData, data:ByteArray):void
{
// TODO Auto Generated method stub
}
}
}
I think the problem is not with the ANE itself but with the code that we use to generate a screenshot (specifically the part after "// Clear the buffers"). It's not a problem for me as the application I'm working on is portrait-only.
You might want to ask for help on Starling's forum.
I don't think is a Starling problem, because I made a test and put a bitmap with this screenshot in flash stage, and the image was right.
any news about this issue ?
any news about this issue ? I have same problem now!
any news about this issue ? I have same problem now!
any news about this issue ? I have same problem now!
any news about this issue ? I have same problem now!
any news about this issue ? I have same problem now!
any news about this issue ? I have same problem now!
any news about this issue ? I have same problem now!
This code for handleLostContext, set screenshot with wrong size in app landscape and not fullScreen.