00001 /****************************************************************************** 00002 * 00003 * $Id: pngenc.h,v 1.0 2000/04/23 14:56:23 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 _PNGENC_H 00020 #define _PNGENC_H 00021 #include <qfile.h> 00022 00023 typedef unsigned char Byte; 00024 00026 struct Color 00027 { 00028 Byte red; 00029 Byte green; 00030 Byte blue; 00031 }; 00032 00038 class PngEncoder 00039 { 00040 public: 00041 PngEncoder(Byte *rawBytes,Color *p,int w,int h,Byte d,int t); 00042 ~PngEncoder(); 00043 void write(const char *fileName); 00044 00045 private: 00046 // image variables 00047 Byte *data; // pointer to the image data (one byte per pixel) 00048 Color *palette; // pointer to the color palette 00049 int width; // image width 00050 int height; // image height 00051 Byte depth; // bits per CLUT entry 00052 int transIndex; // index of the transparant color; -1 = none 00053 int numPixels; // total number of pixel (i.e. width * height) 00054 Byte *dataPtr; // pointer located at the current pixel. 00055 00056 }; 00057 00058 #endif