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

plbmpinfo.h

00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: plbmpinfo.h,v 1.1 2002/08/04 20:17:57 uzadow Exp $
00005 |
00006 |      Copyright (c) 1996-2002 Ulrich von Zadow
00007 |
00008 \--------------------------------------------------------------------
00009 */
00010 
00011 #ifndef INCL_PLBMPINFO
00012 #define INCL_PLBMPINFO
00013 
00014 #include "plobject.h"
00015 #include "plpoint.h"
00016 
00017 //! This is a simple base class that holds bitmap metainformation. It is
00018 //! used as a base class by PLPicDecoder and PLBmp and can be used standalone
00019 //! as well.
00020 class PLBmpInfo : public PLObject
00021 {
00022 
00023 public:
00024   //! Creates an info object.
00025   PLBmpInfo (const PLPoint& Size, int bpp, const PLPoint& Resolution, 
00026              bool bAlphaChannel, bool bIsGreyscale);
00027 
00028   //! Creates an uninitialized info object.
00029   PLBmpInfo () {}
00030 
00031   //! Creates an info object from an ascii representation. This ascii representation
00032   //! can be created using AsString();
00033   PLBmpInfo (const char * pszInfo);
00034 
00035   // This class doesn't have any virtual functions and there's nothing to 
00036   // destroy, so we don't define a destructor  - and the default assignment
00037   // and equality operators work well too.
00038 
00039   //!
00040   const PLPoint& GetSize () const
00041   { return m_Size; }
00042 
00043   //!
00044   int GetWidth () const
00045   { return m_Size.x; }
00046 
00047   //!
00048   int GetHeight () const
00049   { return m_Size.y; }
00050 
00051   //!
00052   int GetBitsPerPixel () const
00053   { return m_bpp; }
00054 
00055   //!
00056   bool HasAlpha () const
00057   { return m_bAlphaChannel; }
00058 
00059   //!
00060   bool IsGreyscale () const
00061   { return m_bIsGreyscale; }
00062 
00063 
00064   //! Gets the bitmap resolution in pixels per inch. Returns 0 if the
00065   //! resolution is unknown.
00066   const PLPoint& GetResolution () const
00067   { return m_Resolution; }
00068 
00069   //!
00070   void AsString (char * psz, int len) const;
00071   
00072   //!
00073   bool operator == (const PLBmpInfo & Other) const;
00074 
00075 protected:
00076   void SetBmpInfo (const PLPoint& Size, int bpp, const PLPoint& Resolution, 
00077                    bool bAlphaChannel, bool bIsGreyscale);
00078   void SetBmpInfo (const PLBmpInfo& SrcInfo);
00079 
00080   PLPoint m_Size;
00081   int     m_bpp;
00082   PLPoint m_Resolution;
00083 
00084   bool    m_bAlphaChannel;
00085   bool    m_bIsGreyscale;
00086 };
00087 
00088 
00089 #endif
00090 /*
00091 /--------------------------------------------------------------------
00092 |
00093 |      $Log: plbmpinfo.h,v $
00094 |      Revision 1.1  2002/08/04 20:17:57  uzadow
00095 |      Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support.
00096 |      Major improvements in tests.
00097 |      Update to VS .NET
00098 |
00099 |
00100 \--------------------------------------------------------------------
00101 */

Generated on Sun Jun 6 13:42:21 2004 for paintlib by doxygen 1.3.2