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

plfilterpixel.h

00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: plfilterpixel.h,v 1.4 2002/08/04 20:08:01 uzadow Exp $
00005 |
00006 |      Copyright (c) 1996-2002 Ulrich von Zadow
00007 |
00008 \--------------------------------------------------------------------
00009 */
00010 
00011 #ifndef INCL_FILTERPIXEL
00012 #define INCL_FILTERPIXEL
00013 
00014 #if _MSC_VER > 1000
00015 #pragma once
00016 #endif
00017 
00018 #include "plfilter.h"
00019 
00020 #include "plpixel32.h"
00021 #include "plpixel24.h"
00022 #include "plpixel8.h"
00023 
00024 #include <typeinfo.h>
00025 
00026 template <class PixelC, class PixelOp>
00027 class PLFilterPixel : public PLFilter
00028 {
00029 public:
00030   PLFilterPixel(const PixelOp & Op);
00031 
00032   virtual ~PLFilterPixel();
00033 
00034   void ApplyInPlace(PLBmp * pBmp) const;
00035 
00036 private:
00037   PixelOp m_Op;
00038 };
00039 
00040 template <class PixelC, class PixelOp>
00041 PLFilterPixel<PixelC, PixelOp>::PLFilterPixel
00042     (const PixelOp & Op)
00043   : m_Op (Op)
00044 {
00045 }
00046 
00047 template <class PixelC, class PixelOp>
00048 PLFilterPixel<PixelC, PixelOp>::~PLFilterPixel ()
00049 {
00050 }
00051 
00052 template <class PixelC, class PixelOp>
00053 void PLFilterPixel<PixelC, PixelOp>::ApplyInPlace (PLBmp *pBmp) const
00054 {
00055   PixelC** ppLines = (PixelC**)(pBmp->GetLineArray());
00056 
00057   switch (pBmp->GetBitsPerPixel())
00058   {
00059     case 32:
00060       PLASSERT (typeid(PixelC) == typeid (PLPixel32));
00061       break;
00062     case 24:
00063       PLASSERT (typeid(PixelC) == typeid (PLPixel24));
00064       break;
00065     case 8:
00066       PLASSERT (typeid(PixelC) == typeid (PLPixel8));
00067       break;
00068     default:
00069       PLASSERT (false);
00070   }
00071 
00072   for (int y=0; y<pBmp->GetHeight(); ++y)
00073   {
00074     PixelC* pLine = ppLines[y];
00075     for (int x=0; x<pBmp->GetWidth(); ++x)
00076       pLine[x] = m_Op.Apply(pLine[x]);
00077   }
00078 }
00079 
00080 #endif
00081 
00082 /*
00083 /--------------------------------------------------------------------
00084 |
00085 |      $Log: plfilterpixel.h,v $
00086 |      Revision 1.4  2002/08/04 20:08:01  uzadow
00087 |      Added PLBmpInfo class, ability to extract metainformation from images without loading the whole image and proper greyscale support.
00088 |
00089 |      Revision 1.3  2002/02/24 13:00:47  uzadow
00090 |      Documentation update; removed buggy PLFilterRotate.
00091 |
00092 |      Revision 1.2  2002/02/10 22:53:26  uzadow
00093 |      Fixed cdoc problems.
00094 |
00095 |      Revision 1.1  2001/10/21 17:12:40  uzadow
00096 |      Added PSD decoder beta, removed BPPWanted from all decoders, added PLFilterPixel.
00097 |
00098 |
00099 \--------------------------------------------------------------------
00100 */

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