Pregunta

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

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top