Android相机放大钛合金覆盖

时间:2014-03-03 09:31:51

标签: android titanium zoom android-camera titanium-alloy

我正在尝试使用Titanium SDK为Android相机添加叠加层。一切都好。但是,缩放不起作用。有没有办法在钛中实现这一点?

我使用的是最新的Titanium SDK 3.2.1GA

这是我的代码:

// Containing window
var win = Ti.UI.createWindow({
    navBarHidden : true,
    backgroundColor : "#ffffff",
    height : Ti.UI.FILL,
    width : Ti.UI.FILL
});

// Blue button that opens the camera
var open_camera = Ti.UI.createButton({
    height : Ti.UI.SIZE,
    width : Ti.UI.SIZE,
    bottom : 50,
    title : 'Camera'
});
// Adding the "open camera" button
win.add(open_camera);

// Function to show the camera
function openCamera() {
    alert('opening');
    open_camera.backgroundColor = "#00ff00";
    // Just checking if we got here

    // The camera overlay I want displayed over the camera
    var camera_overlay = Ti.UI.createView({
        top : 0,
        left : 0,
        height : Ti.UI.FILL,
        width : Ti.UI.FILL
    });

    var take_picture = Ti.UI.createButton({
        height : Ti.UI.SIZE,
        width : Ti.UI.SIZE,
        bottom : 50,
        title : 'Take Picture'
    });
    take_picture.addEventListener('click', function() {
        Ti.Media.takePicture();
    });
    camera_overlay.add(take_picture);

    // The actual show camera part
    Ti.Media.showCamera({
        success : function(e) {
            alert('success');
            // I want this!
        },
        cancel : function(e) {
        },
        error : function(error) {
        },
        autohide : false,
        showControls : false,
        mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
        overlay : camera_overlay // The camera overlay being added to camera view
    });
};

// Click event to show the camera
open_camera.addEventListener("click", function(e) {
    openCamera();
});

// Open the window
win.open();

0 个答案:

没有答案