11-02-2012 06:41 PM
I have a ForeignWindowControl with the camera control and when I rotate the device the UI controls on the screen are redrawn correctly but the preview camera is not properly rotated. looks weird.
Do I have to set the ForeignWindowControl size on rotate completed if so how?
Solved! Go to Solution.
11-02-2012 09:59 PM
can you post a pair of screenshots?
You mentioned using ForeignWindowControl, but then you also mentioned the Camera control. Are you using the C native camera API, or the cascades Camera? I'm just a bit confused because I thought the Cascades Camera took care of all the FWC control details.
11-02-2012 11:24 PM
I'm using C++ and adding cascade controls manually vs qml.
In the Page I have a container(ForeignWindowControl and a button on the bottom left corner).
When I rotate to landscape the button is redrawn correctly but the camera preview is strettched and looks weird.
I want to the camera preview behave like the native camera app when changing orientations.
11-02-2012 11:39 PM
okay. the co-ordinate reference for the display was rotated, so you need to apply a screen window rotation to your viewfinder window handle. that should sort it out. I'm assuming you are seeing a sideways compressed viewfinder.
11-03-2012 12:38 AM - edited 11-03-2012 12:54 AM
ok. thanks
edit: Half way there. The problem i'm having now is determine the direction. In the slot it passes the var bb::cascades::UIOrientation::Type uiOrientation
how do I tell which direction the device was rotated?
11-03-2012 04:26 PM
take a look here:
https://developer.blackberry.com/cascades/referenc
I believe displayDirection is the value you want to look for. The value in degrees is either the amount you need to rotate the window by, or the complementary angle.. just experiment to see which one it is.
Cheers,
Sean
01-17-2013 03:03 PM
I thought have the problem solved but it is still there.
When I start the camera in portrait mode and then rotate to right the preview is still showing in portrait and is not rotated like the native camera.
I have some controls overlay and I have them rotated correctly.
When my app detects orientation change I do this
1. set the viewfinder property
screen_set_window_property_iv(mViewfinderWindow->w
2. set the video property
camera_set_videovf_property(mCameraHandle,
CAMERA_IMGPROP_ROTATION, angle);
and all i get is a black screen.
01-17-2013 04:19 PM
Do you need the pixels coming from the camera to be rotated? (eg. for a video recording) or is this strictly a viewfinder?
if it's only a viewfinder, then I would suggest not bothering to reconfigure CAMERA_IMGPROP_ROTATION, and I would just tweak the screen window settings appropriately: swap width & height and apply a window rotation.
If you actually need to reconfigure the viewfinder pixel rotation via CAMERA_IMGPROP_ROTATION (eg. for recording), then you should not need to rotate the screen window.. just swap w & h.
The first solution is what the BB10 camera app does when you rotate the device in video mode, but once you need to start recording, it takes the second approach to re-orient the buffers so that they can be fed to the mp4 encoder correctly.
I'm not sure why you would be getting a black screen back. Can you try only doing the CAMERA_IMGPROP_ROTATION change and see what happens? (you should just see a squashed viewfinder as a result).
01-17-2013 04:44 PM
The first problem I have is when I rotate the viewfinder (camera preview screen) is not roated.
Second when I do record the video it is in the wrong orientation.
If I leave everything as is then my controls on the overlay are not rotated. That is when I add
screen_set_window_property_iv(mViewfinderWindow->w
I'm not using Cascade camera control.
I will try your suggestion. thanks
01-17-2013 05:03 PM
HI Sean,
My problem now is that the recording is wrong when recording in landscape.
My setting is 480 x 640 for portrait. When i wipe the wid and hi and set it it returns error because 640 x 480 is not one of the support mode.
if (camera_set_videovf_property(mCameraHandle,
CAMERA_IMGPROP_WIDTH, wid,
CAMERA_IMGPROP_HEIGHT, hi) != 0)
What is the correct way to reset the screen resolution? thanks