ShapeFrame.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003 The Pentagram Team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #ifndef SHAPEFRAME_H
00020 #define SHAPEFRAME_H
00021 
00022 struct ConvertShapeFormat;
00023 struct ConvertShapeFrame;
00024 
00025 class ShapeFrame 
00026 {
00027 public:
00028 
00029         // parse data. 
00030         //
00031         // You will find this is quite similar to the ConvertShapeFrame except 
00032         // all the unknown crap is removed. It's designed to allow for painting
00033         // only, and for speed when loading.
00034         
00035         ShapeFrame(const uint8* data, uint32 size, const ConvertShapeFormat* format=0,
00036                 const uint8 special[256]=0, ConvertShapeFrame *prev=0);
00037         ~ShapeFrame();
00038 
00039         uint32                          compressed;
00040         sint32                          width, height;
00041         sint32                          xoff, yoff;
00042 
00043         uint32                          *line_offsets;          // Note these are offsets into rle_data
00044         const uint8                     *rle_data;
00045 
00046         bool hasPoint(sint32 x, sint32 y) const;        // Check to see if a point is in the frame
00047 
00048         uint8 getPixelAtPoint(sint32 x, sint32 y) const;        // Get the pixel at the point 
00049 
00050         void getConvertShapeFrame(ConvertShapeFrame &csf, bool need_bytes_rle=false);
00051 protected:
00052 
00053         // This will load a u8 style shape 'optimized'.
00054         void LoadU8Format(const uint8* data, uint32 size);
00055 
00056         // This will load a pentagram style shape 'optimized'.
00057         void LoadPentagramFormat(const uint8* data, uint32 size);
00058 
00059         // This will load any sort of shape via a ConvertShapeFormat struct
00060         // Crusader shapes must be loaded this way
00061         void LoadGenericFormat(const uint8* data, uint32 size, const ConvertShapeFormat* format);
00062 
00063         // This will load a u8-compressed shape
00064         void LoadU8CMPFormat(const uint8* data, uint32 size, const ConvertShapeFormat* format, const uint8 special[256], ConvertShapeFrame *prev);
00065 };
00066 
00067 
00068 #endif

Generated on Fri Jul 27 22:27:36 2007 for pentagram by  doxygen 1.4.7