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

shadow.h

00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: shadow.h,v 1.5 2002/03/31 13:36:42 uzadow Exp $
00005 |      Shadow Graphic item class
00006 |
00007 |      A shadowed region on a canvas. The item is basically a
00008 |      partially transparent region. Transparency is defined by an
00009 |      alpha DIB and a global transparency value. Most of the code
00010 |      was just copied from CDIBGrItem & changed a bit.
00011 |
00012 |      Copyright (c) 1996-2002 Ulrich von Zadow
00013 |
00014 \--------------------------------------------------------------------
00015 */
00016 
00017 #ifndef INCL_SHADOW
00018 #define INCL_SHADOW
00019 
00020 #include "plbitmap.h"
00021 #include "gritem.h"
00022 
00023 class CShadowItem : public CGrItem
00024 {
00025 
00026 DECLARE_DYNAMIC (CShadowItem);
00027 
00028 public:
00029   CShadowItem
00030     ( int x,             // Position on the canvas
00031       int y,
00032       int w,             // Width
00033       int h,             // Height
00034       int z,             // Position in z-Order
00035       PLBYTE Opacity,      // Opacity of the object. 255 is completely
00036                          // opaque, 0 is completely transparent.
00037       PLPixel32 * pColor, // Shadow color.
00038       PLBmp * pAlphaBmp   // Alpha channel (must be 8 bpp). Can be NULL.
00039     );
00040 
00041   ~CShadowItem
00042     ();
00043 
00044   virtual void Draw
00045     ( PLBmp * pCanvas,
00046       CRect * pUpdateRect
00047     );
00048     // Responsible for drawing the object on the canvas.
00049 
00050   // Member variables.
00051 
00052   PLPixel32  m_Color;        // Shadow color
00053   PLBmp    * m_pAlphaBmp;
00054   PLBYTE   ** m_pLineArray;
00055 
00056 private:
00057 
00058   void drawClippedNoScale
00059     ( PLBmp * pCanvas,
00060       CRect * pRect
00061     );
00062     // Draws the object. pRect must have been clipped already.
00063     // Assumes that no scaling is nessesary.
00064 
00065   void drawAlphaLine
00066     ( PLBYTE * pDest,
00067       PLBYTE * pAlpha,
00068       CRect * pRect
00069     );
00070 
00071   void drawFadeLine
00072     ( PLBYTE * pDest,
00073       CRect * pRect
00074     );
00075     // Draws one line. No scaling. Assumes alpha channel doesn't
00076     // exist.
00077 
00078   void drawClipped
00079     ( PLBmp * pCanvas,
00080       CRect * pRect
00081     );
00082     // Draws the object. pRect must have been clipped already.
00083 
00084   void drawScaleLine
00085     ( PLBYTE * pDest,
00086       PLBYTE * pAlpha,
00087       CRect * pRect
00088     );
00089 
00090 };
00091 
00092 #endif
00093 /*
00094 /--------------------------------------------------------------------
00095 |
00096 |      $Log: shadow.h,v $
00097 |      Revision 1.5  2002/03/31 13:36:42  uzadow
00098 |      Updated copyright.
00099 |
00100 |      Revision 1.4  2001/09/16 19:03:23  uzadow
00101 |      Added global name prefix PL, changed most filenames.
00102 |
00103 |
00104 --------------------------------------------------------------------
00105 */

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