06-01-2012 03:42 PM
Hi folks!
I've published the first of several camera samples here:
https://github.com/blackberry/Cascades-Community-S
The app is called HelloCamera and is a BB10 Cascades sample. This is a very bare-bones camera app which demonstrates how to start a ForeignWindow viewfinder and save photos to the camera rolll.
It will build with the BB10.0.4 NDK and will run on BB10 devices (eg. Dev Alpha).
Some of you will notice that libcamapi.so now ships on the 2.1 PlayBook beta firmware, however the 2.1 NDK is not yet released which targets this functionality. If you are particularly savvy, you can probably get by with the camera_api.h file from the BB10.0.4 NDK and the libcamapi.so file from the 2.1 PlayBook beta firmware until the 2.1 NDK ships out some time later next week.
I promise* over the coming weeks to get more samples published -- specifically samples which do not require the use of Cascades.
Cheers,
Sean
/Disclaimer: *promise may not be an actual promise.. but I'm trying real hard!
06-01-2012 03:54 PM
06-01-2012 04:33 PM
Good stuff Sean!
06-08-2012 04:27 PM
Here comes another sample:
https://github.com/blackberry/Cascades-Community-S
This one is called NativeCamera, and contrary to the repository that it is currently checked-in under, this is a non-cascades BB10 example of how to start the camera viewfinder and manipulate the viewfinder window using libscreen.
This is similar to the HelloCamera Cascades demo in that it starts a viewfinder and saves photos to the camera roll when you tap the screen. To change between front and rear cameras, you will have to modify the code to select a different camera unit.
This sample should also work on the 2.1 beta NDK.
Cheers,
Sean
06-08-2012 06:56 PM
I'm getting all kinds of undefined references linking under 2.1.0 beta SDK. What am I missing?
In function `still_callback':
/Users/kcheung/ndk-2.1.0-workspace/NativeCamera/De
src/main.o: In function `run_state_machine':
/Users/kcheung/ndk-2.1.0-workspace/NativeCamera/De
src/main.o: In function `init_camera':
/Users/kcheung/ndk-2.1.0-workspace/NativeCamera/De
/Users/kcheung/ndk-2.1.0-workspace/NativeCamera/De
/Users/kcheung/ndk-2.1.0-workspace/NativeCamera/De
/Users/kcheung/ndk-2.1.0-workspace/NativeCamera/De
src/main.o: In function `main':
/Users/kcheung/ndk-2.1.0-workspace/NativeCamera/De
/Users/kcheung/ndk-2.1.0-workspace/NativeCamera/De
cc: /Developer/SDKs/bbndk-2.1.0-beta1/host/macosx/x86/
06-08-2012 09:43 PM
I will download the 2.1 NDK and give it a go tonight. You're just missing -lcamapi (libcamapi.so).
If I import it into BB10.0.4 NDK, it works fine. The NDK is supposed to sort out dependencies as part of the managed build solution.. it's possible the 2.1 NDK is missing this magic.
Cheers,
Sean
06-08-2012 10:31 PM
FYI, I just updated the github repo. The .cproject file only was including libcamapi for Device-Release builds instead of all builds.
I will still verify with the 2.1 NDK.
06-09-2012 05:28 AM
I found out what's wrong with the 2.1 NDK. If you try to add the library using "Add Library" under Project in Momentics (I'm using a Mac, BTW), the library is nowhere to be found.
However, if I go to Project->Properties->C/C++ Build->Settings->Tool Settings->QCC Linker->Lbraries and add in camapi, then the project linked fine.
So it looks like the list in Add Library needs to be updated.
Great sample app! Now I know what to do with the camera. The first thing I am going to do is to change the shutter sound to something barely legal, whatever "legal" is. ![]()
06-23-2012 07:11 AM
I am doing an experiment and the results are somewhat unexpected.
In the NativeCamera sample, I changed the zorder of the viewfinder to be 1 LESS than the application window (i.e. the view finder appear BELOW the application window) and modified the colour of the application window using the following code in main
int attribs[] = { SCREEN_BLIT_COLOR, 0x00FF11, SCREEN_BLIT_GLOBAL_ALPHA, 50, SCREEN_BLIT_END };
screen_fill(screen_ctx, screen_buf, attribs);
screen_post_window(screen_win, screen_buf, 1, rect, 0);
In theory, this should give a transparent green window on top of the view finder window. But it doesn't do that. What is wrong?
06-23-2012 11:58 AM - edited 06-23-2012 11:59 AM
Did you set SCREEN_PROPERTY_TRANSPARENCY for your overlay window?
Docs are not very verbose, but here are the available modes: