My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
image.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  *
6  * Copyright (C) 1997-2015 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 
24 class Image
25 {
26  public:
27  Image(int w,int h);
28  ~Image();
29 
30  void setPixel(int x,int y,uchar val);
31  uchar getPixel(int x,int y) const;
32  void writeChar(int x,int y,char c,uchar fg);
33  void writeString(int x,int y,const char *s,uchar fg);
34  void drawHorzLine(int y,int xs,int xe,uchar colIndex,uint mask);
35  void drawHorzArrow(int y,int xs,int xe,uchar colIndex,uint mask);
36  void drawVertLine(int x,int ys,int ye,uchar colIndex,uint mask);
37  void drawVertArrow(int x,int ys,int ye,uchar colIndex,uint mask);
38  void drawRect(int x,int y,int width,int height,uchar colIndex,uint mask);
39  void fillRect(int x,int y,int width,int height,uchar colIndex,uint mask);
40  bool save(const char *fileName,int mode=0);
41  friend uint stringLength(const char *s);
42  uint getWidth() const { return width; }
43  uint getHeight() const { return height; }
44  uchar *getData() const { return data; }
45  static uint stringLength(const char *s);
46 
47  private:
48  int width;
49  int height;
50  uchar *data;
51 };
52 
55 {
56  public:
57  ColoredImage(int width,int height,
58  const uchar *greyLevels,const uchar *alphaLevels,
59  int saturation,int hue,int gamma);
60  ~ColoredImage();
61  bool save(const char *fileName);
62  static void hsl2rgb(double h,double s,double l,
63  double *pRed,double *pGreen,double *pBlue);
64  private:
65  int m_width;
66  int m_height;
67  uchar *m_data;
68  bool m_hasAlpha;
69 };
70 
71 #endif