Root/
Source at commit 1322 created 12 years 8 months ago. By meklort, Add doxygen to utils folder | |
---|---|
1 | /******************************************************************************␊ |
2 | *␊ |
3 | * $Id: image.h,v 1.7 2001/03/19 19:27:40 root Exp $␊ |
4 | *␊ |
5 | *␊ |
6 | * Copyright (C) 1997-2011 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 | class ColoredImage␊ |
53 | {␊ |
54 | public:␊ |
55 | ColoredImage(int width,int height,␊ |
56 | const uchar *greyLevels,const uchar *alphaLevels,␊ |
57 | int saturation,int hue,int gamma);␊ |
58 | ~ColoredImage();␊ |
59 | bool save(const char *fileName);␊ |
60 | static void hsl2rgb(double h,double s,double l,␊ |
61 | double *pRed,double *pGreen,double *pBlue);␊ |
62 | private:␊ |
63 | int m_width;␊ |
64 | int m_height;␊ |
65 | uchar *m_data;␊ |
66 | bool m_hasAlpha;␊ |
67 | };␊ |
68 | ␊ |
69 | #endif␊ |
70 |