Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

GIFBitmap.h

Go to the documentation of this file.
00001 // This file is part of dvi2bitmap. 00002 // Copyright 1999--2002, Council for the Central Laboratory of the Research Councils 00003 // 00004 // This program is part of the Starlink Software Distribution: see 00005 // http://www.starlink.ac.uk 00006 // 00007 // dvi2bitmap is free software; you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // dvi2bitmap is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with dvi2bitmap; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 // 00021 // The General Public License is distributed along with this 00022 // program in the file LICENCE. 00023 // 00024 // Author: Norman Gray <norman@astro.gla.ac.uk> 00025 // $Id: GIFBitmap.h,v 1.15 2003/02/17 16:11:29 norman Exp $ 00026 00027 00028 #ifndef GIFBITMAP_HEADER_READ 00029 #define GIFBITMAP_HEADER_READ 1 00030 00031 #include "BitmapImage.h" 00032 #ifdef HAVE_CSTD_INCLUDE 00033 #include <cstdio> 00034 #else 00035 #include <stdio.h> 00036 #endif 00037 00038 typedef int code_int; 00039 #ifdef SIGNED_COMPARE_SLOW 00040 typedef unsigned long int count_int; 00041 typedef unsigned short int count_short; 00042 #else /*SIGNED_COMPARE_SLOW*/ 00043 typedef long int count_int; 00044 #endif /*SIGNED_COMPARE_SLOW*/ 00045 00046 class GIFBitmap : public BitmapImage { 00047 public: 00048 //GIFBitmap (int w, int h, Byte *b, int bpp=1); 00049 GIFBitmap (const int w, const int h, const int bpp=1); 00050 ~GIFBitmap (); 00051 void setBitmap (const Byte *b); 00052 void setBitmapRow (const Byte *b); 00053 //void setTransparent (const bool sw) { transparent_ = sw; } 00054 void write (const string filename); 00055 string fileExtension() const { return "gif"; } 00056 00057 private: 00058 //const Byte *bitmap_; 00059 //Byte *allocBitmap_; 00060 //const int w_, h_; 00061 //const int bpp_; 00062 //int bitmapRows_; 00063 //bool transparent_; 00064 //bool myBitmap_; 00065 void GIFEncode(FILE* fp, 00066 int GWidth, int GHeight, 00067 int GInterlace, 00068 int Background, 00069 int Transparent, 00070 int BitsPerPixel, 00071 int *Red, int *Green, int *Blue); 00072 void BumpPixel(void); 00073 int GIFNextPixel(void); 00074 void Putword(int w, FILE* fp); 00075 void compress(int init_bits, FILE* outfile); 00076 void output(code_int code); 00077 void cl_block (void); 00078 void cl_hash(count_int hsize); 00079 void char_init(void); 00080 void char_out( int c ); 00081 void flush_char(); 00082 00083 // remainder are the static globals which were in 00084 // the original GIFENCOD routine 00085 int Width, Height; 00086 int curx, cury; 00087 long CountDown; 00088 int Pass; 00089 int Interlace; 00090 00091 #if 0 00092 const int BITS = 12; 00093 const int HSIZE = 5003; /* 80% occupancy */ 00094 #endif 00095 #define BITS 12 00096 #define HSIZE 5003 00097 00098 int n_bits; /* number of bits/code */ 00099 int maxbits; /* user settable max # bits/code */ 00100 code_int maxcode; /* maximum code, given n_bits */ 00101 code_int maxmaxcode; /* should NEVER generate this code */ 00102 00103 count_int htab [HSIZE]; 00104 unsigned short codetab [HSIZE]; 00105 code_int hsize; /* for dynamic table sizing */ 00106 00107 code_int free_ent; /* first unused entry */ 00108 00109 int clear_flg; 00110 00111 int offset; 00112 long int in_count; /* length of input */ 00113 long int out_count; /* # of codes output (for debugging) */ 00114 00115 int g_init_bits; 00116 FILE* g_outfile; 00117 00118 int ClearCode; 00119 int EOFCode; 00120 00121 unsigned long cur_accum; 00122 int cur_bits; 00123 00124 int a_count; 00125 char accum[ 256 ]; 00126 00127 static const unsigned long masks[]; 00128 }; 00129 #endif // #ifndef GIFBITMAP_HEADER_READ

Generated on Sun Aug 21 18:21:02 2005 for dvi2bitmap by doxygen 1.3.8