-1

i want to add some ui inside camera view blackberry 10 like photobomber samples on github https://github.com/blackberry/Cascades-Samples/tree/master/photobomber

but i want to overlay the image while the camera is active and save the photo + image inside the photo to memory can somebody tell me how to do that ?

best regards, adit

Richard
  • 8,920
  • 2
  • 18
  • 24
abang_adit
  • 21
  • 5

1 Answers1

1

You should opt for DockLayout whenever you want to overlap any controls. Go through the following code, you should get the idea

Page {
    content: Container {
        gestureHandlers: [
            TapHandler {
                onTapped: cameraControl.capturePhoto()
            }
        ]
        layout: DockLayout {
        }
        Camera {
            id: cameraControl
            onCameraOpened: {
                cameraControl.startViewfinder();
            }
        }
        Button {
            horizontalAlignment: HorizontalAlignment.Center
            verticalAlignment: VerticalAlignment.Center
            text: "Overlapping button"
        }
    }
    onCreationCompleted: {
        if (cameraControl.allCamerasAccessible) {
            cameraControl.open(CameraUnit.Rear);
        }
    }
}

To capture photo you can use capturePhoto method of camera control. Go through the documentation to find more methods.

Do note that Camera control should be declared at the top in the container & other controls should be declared below it to overlap controls over it.

Don't forget to provide Camera acess permission in bar-descriptor, to add LIBS += -lcamapi in pro file & to import bb.cascades.multimedia 1.0 in qml.

Nishant Shah
  • 1,590
  • 1
  • 15
  • 25
  • hey thank you for your reply :) i havent try it yet but i think it should be work thanks :) – abang_adit Dec 27 '12 at 21:16
  • Worth noting that with this approach you will still have to manually combine the overlay with the final jpeg, like how it is done in the photobomber sample. The other option is to drop down into the C layer and set up a camera filter like in the FaceFilter demo: https://github.com/blackberry/Presentations/tree/master/2012-BlackBerryJam-Americas/JAM15/FaceFilter This may be overkill, depends on your needs. – Paul Bernhardt Jan 02 '13 at 21:01