author | mickeyl <mickeyl> | 2003-04-01 23:19:16 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-01 23:19:16 (UTC) |
commit | 911a05806c4cce85750f3bd9bca84e18162cb739 (patch) (side-by-side diff) | |
tree | d5bbed42b991968852aa30e702deda95fa7b1393 /noncore/multimedia/camera/zcameraio.cpp | |
parent | 3497616220db68ea4105880c40c4c542d9b5228d (diff) | |
download | opie-911a05806c4cce85750f3bd9bca84e18162cb739.zip opie-911a05806c4cce85750f3bd9bca84e18162cb739.tar.gz opie-911a05806c4cce85750f3bd9bca84e18162cb739.tar.bz2 |
figured out how to get binary RAW data into a QImage
actual capturing is now only a footstep away :-D
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 @@ -26,12 +26,15 @@ #include <opie2/odebug.h> +ZCameraIO* ZCameraIO::_instance = 0; + ZCameraIO::ZCameraIO() { _driver = open( "/dev/sharp_zdc", O_RDWR ); if ( _driver == -1 ) oerr << "Can't open camera driver: " << strerror(errno) << oendl; + ZCameraIO::_instance = this; }; @@ -42,8 +45,10 @@ ZCameraIO::~ZCameraIO() } -bool ZCameraIO::snapshot( QImage* img ) +bool ZCameraIO::snapshot( QImage* image ) { + /* + char buf[76800]; write( _driver, "M=13", 4 ); @@ -53,4 +58,32 @@ bool ZCameraIO::snapshot( QImage* img ) int result = read( _driver, &buf, sizeof buf ); 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; } |