|
1 /****************************************************************************** |
|
2 * |
|
3 * |
|
4 * |
|
5 * |
|
6 * Copyright (C) 1997-2008 by Dimitri van Heesch. |
|
7 * |
|
8 * Permission to use, copy, modify, and distribute this software and its |
|
9 * documentation under the terms of the GNU General Public License is hereby |
|
10 * granted. No representations are made about the suitability of this software |
|
11 * for any purpose. It is provided "as is" without express or implied warranty. |
|
12 * See the GNU General Public License for more details. |
|
13 * |
|
14 * Documents produced by Doxygen are derivative works derived from the |
|
15 * input used in their production; they are not affected by this license. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef _IMAGE_H |
|
20 #define _IMAGE_H |
|
21 #include <qglobal.h> |
|
22 |
|
23 class Image |
|
24 { |
|
25 public: |
|
26 Image(int w,int h); |
|
27 ~Image(); |
|
28 |
|
29 void setPixel(int x,int y,uchar val); |
|
30 uchar getPixel(int x,int y) const; |
|
31 void writeChar(int x,int y,char c,uchar fg); |
|
32 void writeString(int x,int y,const char *s,uchar fg); |
|
33 void drawHorzLine(int y,int xs,int xe,uchar colIndex,uint mask); |
|
34 void drawHorzArrow(int y,int xs,int xe,uchar colIndex,uint mask); |
|
35 void drawVertLine(int x,int ys,int ye,uchar colIndex,uint mask); |
|
36 void drawVertArrow(int x,int ys,int ye,uchar colIndex,uint mask); |
|
37 void drawRect(int x,int y,int width,int height,uchar colIndex,uint mask); |
|
38 void fillRect(int x,int y,int width,int height,uchar colIndex,uint mask); |
|
39 bool save(const char *fileName,int mode=0); |
|
40 friend uint stringLength(const char *s); |
|
41 uint getWidth() const { return width; } |
|
42 uint getHeight() const { return height; } |
|
43 uchar *getData() const { return data; } |
|
44 static uint stringLength(const char *s); |
|
45 |
|
46 private: |
|
47 int width; |
|
48 int height; |
|
49 uchar *data; |
|
50 }; |
|
51 |
|
52 #endif |