Diffstat (limited to 'noncore/multimedia/camera/zcameraio.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/zcameraio.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/noncore/multimedia/camera/zcameraio.cpp b/noncore/multimedia/camera/zcameraio.cpp index aa6cbe3..e74136f 100644 --- a/noncore/multimedia/camera/zcameraio.cpp +++ b/noncore/multimedia/camera/zcameraio.cpp @@ -28,2 +28,4 @@ +ZCameraIO* ZCameraIO::_instance = 0; + ZCameraIO::ZCameraIO() @@ -34,2 +36,3 @@ ZCameraIO::ZCameraIO() + ZCameraIO::_instance = this; }; @@ -44,4 +47,6 @@ ZCameraIO::~ZCameraIO() -bool ZCameraIO::snapshot( QImage* img ) +bool ZCameraIO::snapshot( QImage* image ) { + /* + char buf[76800]; @@ -55,2 +60,30 @@ bool ZCameraIO::snapshot( QImage* img ) return result == sizeof buf; + + */ + + uchar buf[76800]; + uchar* bp = buf; + uchar* p; + + + int fd = open( "/tmp/cam", O_RDONLY ); + if ( read( fd, buf, sizeof buf ) != sizeof buf ) + qDebug( "WARNING: couldn't read image!" ); + + image->create( 240, 160, 16 ); + for ( int i = 0; i < 160; ++i ) + { + p = image->scanLine( i ); + for ( int j = 0; j < 240; j++ ) + { + *p = *bp; + p++; + bp++; + *p = *bp; + p++; + bp++; + } + } + + return true; } |