From 0b985ce87d6ce6d4110a50d5be48831d34794cd2 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sun, 06 Apr 2003 14:38:18 +0000 Subject: - add realtime preview widget with zoom control The camera driver is damn slow. For a 240x160x16 image, it takes ~100ms. That gives approx. 10fps which is too slow for doing video. :( --- (limited to 'noncore/multimedia/camera/mainwindow.cpp') diff --git a/noncore/multimedia/camera/mainwindow.cpp b/noncore/multimedia/camera/mainwindow.cpp index 4218232..8578bce 100644 --- a/noncore/multimedia/camera/mainwindow.cpp +++ b/noncore/multimedia/camera/mainwindow.cpp @@ -14,30 +14,28 @@ **********************************************************************/ #include "mainwindow.h" +#include "mainwindowbase.h" #include "zcameraio.h" #include +#include #include #include - #include - #include #include +#include + CameraMainWindow::CameraMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ) { - QVBox* v = new QVBox( this ); - l = new QLabel( v ); - l->setFixedSize( QSize( 240, 160 ) ); - QPushButton* p = new QPushButton( "Snapshot", v ); - connect( p, SIGNAL( clicked() ), this, SLOT( clickedSnapShot() ) ); - v->show(); - l->show(); - p->show(); - setCentralWidget( v ); + mw = new MainWindowBase( this, "main widget" ); + ZCameraIO::instance()->setCaptureFrame( 240, 160, 256 ); + setCentralWidget( mw ); + mw->show(); + connect( mw->zoom, SIGNAL( activated( int ) ), this, SLOT( changeZoom(int) ) ); }; @@ -46,19 +44,17 @@ CameraMainWindow::~CameraMainWindow() } -void CameraMainWindow::clickedSnapShot() +void CameraMainWindow::changeZoom( int zoom ) { - QDirectPainter fb( l ); - ZCameraIO::instance()->snapshot( fb.frameBuffer() ); - - /* - QImage i; - QPixmap p; - if ( ZCameraIO::instance()->snapshot( &i ) ) + int z; + switch ( zoom ) { - p.convertFromImage( i ); - l->setPixmap( p ); + case 0: z = 128; break; + case 1: z = 256; break; + case 2: z = 512; break; + default: assert( 0 ); break; } - */ + + ZCameraIO::instance()->setCaptureFrame( 240, 160, z ); } -- cgit v0.9.0.2