From 2cc909c36a779d1041a3382939f8ad41d84b0fc5 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Sat, 12 Apr 2003 15:02:32 +0000 Subject: - 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 --- (limited to 'noncore/multimedia/camera/zcameraio.cpp') 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 @@ -108,6 +108,7 @@ inline bool ZCameraIO::isAvailable() const 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 ) ) @@ -173,18 +174,31 @@ bool ZCameraIO::write( char* buf, int 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++; -- cgit v0.9.0.2