00001 /****************************************************************************** 00002 * 00003 * $Id: image.h,v 1.7 2001/03/19 19:27:40 root Exp $ 00004 * 00005 * 00006 * Copyright (C) 1997-2008 by Dimitri van Heesch. 00007 * 00008 * Permission to use, copy, modify, and distribute this software and its 00009 * documentation under the terms of the GNU General Public License is hereby 00010 * granted. No representations are made about the suitability of this software 00011 * for any purpose. It is provided "as is" without express or implied warranty. 00012 * See the GNU General Public License for more details. 00013 * 00014 * Documents produced by Doxygen are derivative works derived from the 00015 * input used in their production; they are not affected by this license. 00016 * 00017 */ 00018 00019 #ifndef _IMAGE_H 00020 #define _IMAGE_H 00021 #include <qglobal.h> 00022 00023 class Image 00024 { 00025 public: 00026 Image(int w,int h); 00027 ~Image(); 00028 00029 void setPixel(int x,int y,uchar val); 00030 uchar getPixel(int x,int y) const; 00031 void writeChar(int x,int y,char c,uchar fg); 00032 void writeString(int x,int y,const char *s,uchar fg); 00033 void drawHorzLine(int y,int xs,int xe,uchar colIndex,uint mask); 00034 void drawHorzArrow(int y,int xs,int xe,uchar colIndex,uint mask); 00035 void drawVertLine(int x,int ys,int ye,uchar colIndex,uint mask); 00036 void drawVertArrow(int x,int ys,int ye,uchar colIndex,uint mask); 00037 void drawRect(int x,int y,int width,int height,uchar colIndex,uint mask); 00038 void fillRect(int x,int y,int width,int height,uchar colIndex,uint mask); 00039 bool save(const char *fileName,int mode=0); 00040 friend uint stringLength(const char *s); 00041 uint getWidth() const { return width; } 00042 uint getHeight() const { return height; } 00043 uchar *getData() const { return data; } 00044 static uint stringLength(const char *s); 00045 00046 private: 00047 int width; 00048 int height; 00049 uchar *data; 00050 }; 00051 00052 #endif