00001 00002 // Flash Plugin and Player 00003 // Copyright (C) 1998 Olivier Debon 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00020 #ifndef _BITMAP_H_ 00021 #define _BITMAP_H_ 00022 00023 struct MyErrorHandler { 00024 struct jpeg_error_mgr pub; 00025 jmp_buf setjmp_buffer; 00026 }; 00027 00028 class Bitmap : public Character { 00029 public: 00030 long width; 00031 long height; 00032 long bpl; 00033 long depth; 00034 00035 unsigned char *pixels; // Array of Pixels 00036 Color *colormap; // Array of color definitions 00037 long nbColors; 00038 00039 unsigned char *alpha_buf; // Array of alpha values (no alpha if NULL) 00040 00041 int defLevel; 00042 00043 // Class Variables 00044 00045 static int haveTables; 00046 static struct jpeg_decompress_struct jpegObject; 00047 static struct jpeg_source_mgr jpegSourceManager; 00048 static MyErrorHandler jpegErrorMgr; 00049 00050 public: 00051 Bitmap(long id, int level = 1); 00052 ~Bitmap(); 00053 00054 // JPEG handling methods 00055 int buildFromJpegInterchangeData(unsigned char *stream, int alpha, long offset); // Complete 00056 int buildFromJpegAbbreviatedData(unsigned char *stream); // Abbreviated 00057 00058 // Class Method 00059 static int readJpegTables(unsigned char *stream); // Tables Only 00060 00061 // ZLIB handling methods 00062 int buildFromZlibData(unsigned char *buffer, 00063 int width, int height, 00064 int format, int tableSize, int tableHasAlpha); 00065 00066 long getWidth(); 00067 long getHeight(); 00068 Color *getColormap(long *n); 00069 unsigned char *getPixels(); 00070 }; 00071 00072 #endif /* _BITMAP_H_ */
1.4.2