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

plpixel8.h

00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: plpixel8.h,v 1.3 2002/02/24 13:00:37 uzadow Exp $
00005 |
00006 |      Copyright (c) 1996-2002 Ulrich von Zadow
00007 |
00008 \--------------------------------------------------------------------
00009 */
00010 
00011 #ifndef INCL_PLPIXEL8
00012 #define INCL_PLPIXEL8
00013 
00014 #include "plpixeldefs.h"
00015 
00016 //! 8 bit pixel class. A pixel in this class contains 8 bits of
00017 //! image data. This class is meant to be
00018 //! fast, so all methods are inlined.
00019 class PLPixel8
00020 {
00021   public:
00022     //!
00023     PLPixel8 ();
00024     //!
00025     PLPixel8 (PLBYTE val);
00026     //!
00027     void Set (PLBYTE val);
00028     //!
00029     PLBYTE Get () const;
00030 
00031     //!
00032     bool operator ==(const PLPixel8&);
00033 
00034     //!
00035     bool operator !=(const PLPixel8&);
00036 
00037     //! Simple and fast 'distance' between two pixels.
00038     int BoxDist (PLPixel8 Pix);
00039 
00040   private:
00041     PLBYTE m_Data;
00042 };
00043 
00044 inline PLPixel8::PLPixel8()
00045 {
00046 }
00047 
00048 
00049 inline PLPixel8::PLPixel8(PLBYTE val)
00050 {
00051   Set (val);
00052 }
00053 
00054 
00055 inline void PLPixel8::Set(PLBYTE val)
00056 {
00057   m_Data = val;
00058 }
00059 
00060 
00061 inline PLBYTE PLPixel8::Get() const
00062 {
00063   return m_Data;
00064 }
00065 
00066 
00067 inline int PLPixel8::BoxDist (PLPixel8 Pix)
00068 {
00069   return abs ((int)Get()-Pix.Get());
00070 }
00071 
00072 inline bool PLPixel8::operator ==(const PLPixel8& Pix)
00073 {
00074   return (Get() == Pix.Get());
00075 }
00076 
00077 inline bool PLPixel8::operator !=(const PLPixel8& Pix)
00078 {
00079   return (!(*this == Pix));
00080 }
00081 
00082 
00083 #endif
00084 
00085 /*
00086 /--------------------------------------------------------------------
00087 |
00088 |      $Log: plpixel8.h,v $
00089 |      Revision 1.3  2002/02/24 13:00:37  uzadow
00090 |      Documentation update; removed buggy PLFilterRotate.
00091 |
00092 |      Revision 1.2  2001/10/06 22:03:26  uzadow
00093 |      Added PL prefix to basic data types.
00094 |
00095 |      Revision 1.1  2001/09/16 19:03:22  uzadow
00096 |      Added global name prefix PL, changed most filenames.
00097 |
00098 |      Revision 1.1  2001/09/13 20:45:35  uzadow
00099 |      Added 8-bpp pixel class.
00100 |
00101 |
00102 \--------------------------------------------------------------------
00103 */

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