00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: plfilterfillrect_8h-source.html,v 1.4 2004/09/15 15:26:29 uzadow Exp $ 00005 | 00006 \-------------------------------------------------------------------- 00007 */ 00008 00009 #if !defined(INCL_PLFILTERFILLRECT) 00010 #define INCL_PLFILTERFILLRECT 00011 00012 #if _MSC_VER > 1000 00013 #pragma once 00014 #endif // _MSC_VER > 1000 00015 00016 #include "plinplacefilter.h" 00017 #include "../plpoint.h" 00018 00019 class PLBmp; 00020 00021 //! Filter that fills a rectangle in a Bitmap with a color. Works 00022 //! for 8, 24 and 32 bpp. 00023 template<class PixelC> class PLFilterFillRect: public PLInPlaceFilter 00024 { 00025 public: 00026 PLFilterFillRect (PLPoint min, PLPoint max, const PixelC& Color); 00027 virtual ~PLFilterFillRect(); 00028 virtual void ApplyInPlace(PLBmpBase *pBmp) const; 00029 00030 private: 00031 PixelC m_Color; 00032 PLPoint m_min; 00033 PLPoint m_max; 00034 }; 00035 00036 template<class PixelC> 00037 PLFilterFillRect<PixelC>::PLFilterFillRect 00038 (PLPoint min, PLPoint max, const PixelC& Color) 00039 { 00040 m_min = min; 00041 m_max = max; 00042 m_Color = Color; 00043 } 00044 00045 template<class PixelC> 00046 PLFilterFillRect<PixelC>::~PLFilterFillRect () 00047 { 00048 00049 } 00050 00051 template<class PixelC> 00052 void PLFilterFillRect<PixelC>::ApplyInPlace (PLBmpBase *pBmp) const 00053 { 00054 PixelC** ppLines = (PixelC**)(pBmp->GetLineArray()); 00055 for (int y=m_min.y; y<m_max.y; ++y) 00056 { 00057 PixelC* pLine = ppLines[y]; 00058 for (int x=m_min.x; x<m_max.x; ++x) 00059 pLine[x] = m_Color; 00060 } 00061 } 00062 00063 #endif 00064 00065 /* 00066 /-------------------------------------------------------------------- 00067 | 00068 | $Log: plfilterfillrect_8h-source.html,v $ 00068 | Revision 1.4 2004/09/15 15:26:29 uzadow 00068 | Linux compatibility changes, doc update. 00068 | 00069 | Revision 1.6 2004/06/20 16:59:38 uzadow 00070 | Added PLBmpBase::CopyPixels() and PLInPlaceFilter 00071 | 00072 | Revision 1.5 2004/06/06 12:56:38 uzadow 00073 | Doxygenified documentation. 00074 | 00075 | Revision 1.4 2002/02/10 22:53:26 uzadow 00076 | Fixed cdoc problems. 00077 | 00078 | Revision 1.3 2001/10/21 17:12:40 uzadow 00079 | Added PSD decoder beta, removed BPPWanted from all decoders, added PLFilterPixel. 00080 | 00081 | Revision 1.2 2001/09/28 19:50:56 uzadow 00082 | Added some 24 bpp stuff & other minor features. 00083 | 00084 | Revision 1.1 2001/09/16 19:03:23 uzadow 00085 | Added global name prefix PL, changed most filenames. 00086 | 00087 | Revision 1.1 2001/09/13 20:48:42 uzadow 00088 | Added fill filters. 00089 | 00090 | Revision 1.1 2001/09/13 10:39:31 uzadow 00091 | Added FilterFillRect 00092 | 00093 | 00094 \-------------------------------------------------------------------- 00095 */