00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: plbmpinfo_8h-source.html,v 1.4 2004/09/15 15:26:29 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 #include "plpixelformat.h" 00017 00018 //! This is a simple base class that holds bitmap metainformation. It is 00019 //! used as a base class by PLPicDecoder and PLBmp and can be used standalone 00020 //! as well. 00021 class PLBmpInfo : public PLObject 00022 { 00023 00024 public: 00025 //! Creates an info object. 00026 PLBmpInfo (const PLPoint& Size, const PLPoint& Resolution, 00027 const PLPixelFormat & pf); 00028 00029 //! Creates an uninitialized info object. 00030 PLBmpInfo () : m_pf(PLPixelFormat::DONTCARE) {} 00031 00032 //! Creates an info object from an ascii representation. This ascii representation 00033 //! can be created using AsString(); 00034 PLBmpInfo (const char * pszInfo); 00035 00036 // This class doesn't have any virtual functions and there's nothing to 00037 // destroy, so we don't define a destructor - and the default assignment 00038 // and equality operators work well too. 00039 00040 //! 00041 const PLPoint& GetSize () const 00042 { return m_Size; } 00043 00044 //! 00045 int GetWidth () const 00046 { return m_Size.x; } 00047 00048 //! 00049 int GetHeight () const 00050 { return m_Size.y; } 00051 00052 //! 00053 unsigned GetBitsPerPixel () const 00054 { return m_pf.GetBitsPerPixel(); } 00055 00056 //! 00057 bool HasAlpha () const 00058 { return m_pf.HasAlpha(); } 00059 00060 //! 00061 bool IsGreyscale () const 00062 { return m_pf.IsGrayscale(); } 00063 00064 const PLPixelFormat & GetPixelFormat() const 00065 { return m_pf; } 00066 00067 //! Gets the bitmap resolution in pixels per inch. Returns 0 if the 00068 //! resolution is unknown. 00069 const PLPoint& GetResolution () const 00070 { return m_Resolution; } 00071 00072 //! 00073 void AsString (char * psz, int len) const; 00074 00075 //! 00076 bool operator == (const PLBmpInfo & Other) const; 00077 00078 protected: 00079 void SetBmpInfo (const PLPoint& Size, const PLPoint& Resolution, 00080 const PLPixelFormat & pf); 00081 void SetBmpInfo (const PLBmpInfo& SrcInfo); 00082 00083 PLPoint m_Size; 00084 00085 PLPoint m_Resolution; 00086 00087 PLPixelFormat m_pf; 00088 }; 00089 00090 00091 #endif 00092 /* 00093 /-------------------------------------------------------------------- 00094 | 00095 | $Log: plbmpinfo_8h-source.html,v $ 00095 | Revision 1.4 2004/09/15 15:26:29 uzadow 00095 | Linux compatibility changes, doc update. 00095 | 00096 | Revision 1.3 2004/09/09 16:52:49 artcom 00097 | refactored PixelFormat 00098 | 00099 | Revision 1.2 2004/06/06 12:56:38 uzadow 00100 | Doxygenified documentation. 00101 | 00102 | Revision 1.1 2002/08/04 20:17:57 uzadow 00103 | Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support. 00104 | Major improvements in tests. 00105 | Update to VS .NET 00106 | 00107 | 00108 \-------------------------------------------------------------------- 00109 */