1 #ifndef DRAWING_WINDOW_H
2 #define DRAWING_WINDOW_H
4 #define USE_PIXMAP_CACHE
11 #ifdef USE_PIXMAP_CACHE
18 class DrawingWindow: public QWidget {
22 typedef int (*ThreadFunction)(DrawingWindow &);
24 static const int DEFAULT_WIDTH = 640;
25 static const int DEFAULT_HEIGHT = 480;
27 DrawingWindow(ThreadFunction fun,
28 int width = DEFAULT_WIDTH, int height = DEFAULT_HEIGHT);
29 DrawingWindow(QWidget *parent,
31 int width = DEFAULT_WIDTH, int height = DEFAULT_HEIGHT);
32 DrawingWindow(QWidget *parent, Qt::WindowFlags flags,
34 int width = DEFAULT_WIDTH, int height = DEFAULT_HEIGHT);
41 void setColor(float red, float green, float blue);
42 void setColor(const QColor &color);
44 void drawPoint(int x, int y);
45 void drawLine(int x1, int y1, int x2, int y2);
48 void paintEvent(QPaintEvent *ev);
49 void showEvent(QShowEvent *ev);
50 void timerEvent(QTimerEvent *ev);
55 static const int paintInterval = 33;
61 #ifdef USE_PIXMAP_CACHE
65 DrawingThread *thread;
73 void initialize(ThreadFunction fun, int width, int height);
79 void setDirtyRect(int x, int y);
80 void setDirtyRect(int x1, int y1, int x2, int y2);
81 void setDirtyRect(const QRect &rect);
85 int DrawingWindow::width() const
87 return image->width();
91 int DrawingWindow::height() const
93 return image->height();
97 void DrawingWindow::lock()
103 void DrawingWindow::unlock()
108 #endif // !DRAWING_WINDOW_H