package camera;
import java.awt.Rectangle;
import org.osgi.service.log.LogService;
import com.buglabs.bug.module.camera.pub.ICameraDevice;
public class LivePreviewControl {
private final LogService log;
private final ICameraDevice iCameraDevice;
private final Rectangle overlayBounds;
LivePreviewControl(LogService log, ICameraDevice iCameraDevice) {
this.log = log;
this.iCameraDevice = iCameraDevice;
// TODO: make preview->overlay size calculation automatic (somehow)
// AWT Rectangle doesn't exactly line up with overlay's coords, at least for now.
// so this is hand-tuned.
//previewArea.getBounds();
this.overlayBounds = new Rectangle(0, 0, 320, 240);
}
public boolean enableLivePreview() {
log.log(LogService.LOG_INFO, "starting overlay");
iCameraDevice.initOverlay(overlayBounds);
iCameraDevice.startOverlay();
return true;
}
public boolean disableLivePreview() {
log.log(LogService.LOG_INFO, "stopping overlay");
iCameraDevice.stopOverlay();
return true;
}
}