Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

bitmap.h

00001 // $Id: bitmap_8h-source.html,v 1.2 2002/06/20 17:09:53 mkrohn5 Exp $
00002 
00003 // Bitmap Header File
00004 // Written by: Marco Krohn
00005 
00006 // Copyright (C) 1999, 2000
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 1, or (at your option)
00011 // any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 
00018 #ifndef __BITMAP_INCLUDED
00019 #define __BITMAP_INCLUDED
00020 
00021 #include <string>
00022 
00023 #include "common/global.h"
00024 
00025 using namespace std;
00026 
00027 
00028 
00029 
00030 
00031 //----------  Declarations for BMP handling
00032 typedef struct tBMPFileHeader
00033 {
00034   int2 iType;
00035   uint4 uSize;
00036   int2  iReserved1;
00037   int2  iReserved2;
00038   uint2 uOffbits;
00039 };
00040 
00041 typedef struct tBMPInfo
00042 {
00043   uint2 uSize;
00044   int2 uWidth;
00045   int2 iPlanes;
00046   int2 uHeight;
00047   int2 iBitCount;
00048   uint2 uCompression;
00049   uint2 uImageSize;
00050   int2  iXpelspermeter;
00051   int2  iYpelspermeter;
00052   int2 uColorsUsed;
00053   int2 uColorsImportant;
00054 };
00055 
00056 struct tBMPHeader
00057 {
00058   tBMPFileHeader File;
00059   tBMPInfo       Info;
00060 };
00061 
00062 
00063 
00064 
00075 class TBitmap
00076 {
00077   public:
00078     struct tRGBColor
00079     {
00080       byte red;
00081       byte green;
00082       byte blue;
00083     };
00084 
00085     TBitmap();
00086     TBitmap( string sFileName );
00087     ~TBitmap();
00088 
00089 //  PENDING: operator= must be defined as well as a copy constructor
00090 
00091     void Clear();
00092     void ConvertToGrayScale();
00093     bool Empty() const;
00094     uint2 GetHeight() const;
00095     tRGBColor GetPixel(int2 x, int2 y) const;
00096     uint2 GetWidth() const;
00097     void Invert();
00098     bool Load(string sFileName);
00099     bool LoadBMP(string sFileName);
00100     void SetAllPixels(tRGBColor Color);
00101     void SetAllPixels(uint2 uGray=0);
00102 
00103   private:
00104     tRGBColor** Bitmap;
00105     uint2 uWidth, uHeight;
00106 
00107     bool AllocateMemoryForBitmap();
00108     void DeleteBitmap();
00109     void Reset();
00110     void WriteBMPHeaderToLog(const tBMPHeader Header) const;
00111 };
00112 
00113 
00114 
00115 
00116 
00117 #endif        // __BITMAP_INCLUDED
00118 
00119 
00120 
00121 
00122 

Generated on Thu Jun 20 18:13:15 2002 for Stellar Legacy by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001