Diffstat (limited to 'noncore/multimedia/camera/lib/zcameraio.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/lib/zcameraio.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/noncore/multimedia/camera/lib/zcameraio.h b/noncore/multimedia/camera/lib/zcameraio.h new file mode 100644 index 0000000..3352a5e --- a/dev/null +++ b/noncore/multimedia/camera/lib/zcameraio.h | |||
@@ -0,0 +1,86 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #ifndef ZCAMERAIO_H | ||
17 | #define ZCAMERAIO_H | ||
18 | |||
19 | #include <qobject.h> | ||
20 | |||
21 | class QImage; | ||
22 | class QTime; | ||
23 | |||
24 | class ZCameraIO : public QObject | ||
25 | { | ||
26 | Q_OBJECT | ||
27 | |||
28 | public: | ||
29 | virtual ~ZCameraIO(); | ||
30 | |||
31 | enum ReadMode | ||
32 | { | ||
33 | IMAGE = 0, STATUS = 1, | ||
34 | FASTER = 0, BETTER = 2, | ||
35 | XNOFLIP = 0, XFLIP = 4, | ||
36 | YNOFLIP = 0, YFLIP = 8, | ||
37 | AUTOMATICFLIP = -1 | ||
38 | }; | ||
39 | |||
40 | // low level interface | ||
41 | |||
42 | bool setCaptureFrame( int w, int h, int zoom = 256, bool rot = true ); | ||
43 | bool setZoom( int zoom = 0 ); | ||
44 | void setReadMode( int = IMAGE | XFLIP | YFLIP ); | ||
45 | void setFlip( int flip ); | ||
46 | |||
47 | bool isShutterPressed(); // not const, because it calls clearShutterLatch | ||
48 | bool isAvailable() const; | ||
49 | bool isCapturing() const; | ||
50 | bool isFinderReversed() const; | ||
51 | |||
52 | bool snapshot( QImage* image ); | ||
53 | bool snapshot( unsigned char* buf ); | ||
54 | |||
55 | // high level interface | ||
56 | bool isOpen() const; | ||
57 | static ZCameraIO* instance(); | ||
58 | void captureFrame( int w, int h, int zoom, QImage* image ); | ||
59 | void captureFrame( int w, int h, int zoom, unsigned char* buf ); | ||
60 | |||
61 | protected: | ||
62 | ZCameraIO(); | ||
63 | void clearShutterLatch(); | ||
64 | void init(); | ||
65 | bool read( char*, int ); | ||
66 | bool write( char*, int = 0 ); | ||
67 | |||
68 | signals: | ||
69 | void shutterClicked(); | ||
70 | |||
71 | private: | ||
72 | int _driver; | ||
73 | char _status[4]; | ||
74 | bool _pressed; | ||
75 | static ZCameraIO* _instance; | ||
76 | int _height; | ||
77 | int _width; | ||
78 | int _zoom; | ||
79 | int _flip; | ||
80 | bool _rot; | ||
81 | int _readlen; | ||
82 | |||
83 | QTime* _timer; | ||
84 | }; | ||
85 | |||
86 | #endif | ||