author | mickeyl <mickeyl> | 2003-04-12 15:02:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-12 15:02:32 (UTC) |
commit | 2cc909c36a779d1041a3382939f8ad41d84b0fc5 (patch) (side-by-side diff) | |
tree | 42c95673d72f7ecb7a8f4acbb0f517dd75ecc167 /noncore/multimedia/camera/zcameraio.cpp | |
parent | 11861d35730cee70920aa6797ba12263bbcce081 (diff) | |
download | opie-2cc909c36a779d1041a3382939f8ad41d84b0fc5.zip opie-2cc909c36a779d1041a3382939f8ad41d84b0fc5.tar.gz opie-2cc909c36a779d1041a3382939f8ad41d84b0fc5.tar.bz2 |
- make main layout a full preview window and think about configuring capturing parameters later...adding an on-demand-applet to the taskbar would be spiffy
- portrait or landscape mode is now self-configuring thanks to life-rotation :-D
Diffstat (limited to 'noncore/multimedia/camera/zcameraio.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/zcameraio.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/noncore/multimedia/camera/zcameraio.cpp b/noncore/multimedia/camera/zcameraio.cpp index 56b2e13..51771a5 100644 --- a/noncore/multimedia/camera/zcameraio.cpp +++ b/noncore/multimedia/camera/zcameraio.cpp @@ -105,12 +105,13 @@ inline bool ZCameraIO::isAvailable() const return _status[3] == 'A'; } bool ZCameraIO::setCaptureFrame( int width, int height, int zoom, bool rot ) { + odebug << "setCaptureFrame( " << width << ", " << height << ", " << zoom << ", " << rot << " )" << oendl; char b[100]; sprintf( b, "%c=%d,%d,%d,%d", rot ? 'R':'S', width, height, zoom, width*2 ); if ( write( b ) ) { _width = width; _height = height; @@ -170,24 +171,37 @@ bool ZCameraIO::write( char* buf, int len ) return ::write( _driver, buf, len ) == len; } bool ZCameraIO::snapshot( QImage* image ) { - setReadMode( IMAGE | XFLIP | YFLIP ); - char buf[76800]; + setReadMode( STATUS ); + + odebug << "finder reversed = " << isFinderReversed() << oendl; + odebug << "rotation = " << _rot << oendl; + + if ( _rot ) // Portrait + { + setReadMode( IMAGE | isFinderReversed() ? XFLIP | YFLIP : 0 ); + } + else // Landscape + { + setReadMode( IMAGE | XFLIP | YFLIP ); //isFinderReversed() ? 0 : XFLIP ); + } + + char buf[_readlen]; char* bp = buf; unsigned char* p; read( bp, _readlen ); - image->create( 240, 160, 16 ); - for ( int i = 0; i < 160; ++i ) + image->create( _width, _height, 16 ); + for ( int i = 0; i < _height; ++i ) { p = image->scanLine( i ); - for ( int j = 0; j < 240; j++ ) + for ( int j = 0; j < _width; j++ ) { *p = *bp; p++; bp++; *p = *bp; p++; |