File: shadow.h

package info (click to toggle)
paintlib 2.6.2-14
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 7,920 kB
  • ctags: 3,874
  • sloc: cpp: 25,209; sh: 10,605; ansic: 1,891; makefile: 120
file content (105 lines) | stat: -rw-r--r-- 2,486 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
/--------------------------------------------------------------------
|
|      $Id: shadow.h,v 1.5 2002/03/31 13:36:42 uzadow Exp $
|      Shadow Graphic item class
|
|      A shadowed region on a canvas. The item is basically a
|      partially transparent region. Transparency is defined by an
|      alpha DIB and a global transparency value. Most of the code
|      was just copied from CDIBGrItem & changed a bit.
|
|      Copyright (c) 1996-2002 Ulrich von Zadow
|
\--------------------------------------------------------------------
*/

#ifndef INCL_SHADOW
#define INCL_SHADOW

#include "plbitmap.h"
#include "gritem.h"

class CShadowItem : public CGrItem
{

DECLARE_DYNAMIC (CShadowItem);

public:
  CShadowItem
    ( int x,             // Position on the canvas
      int y,
      int w,             // Width
      int h,             // Height
      int z,             // Position in z-Order
      PLBYTE Opacity,      // Opacity of the object. 255 is completely
                         // opaque, 0 is completely transparent.
      PLPixel32 * pColor, // Shadow color.
      PLBmp * pAlphaBmp   // Alpha channel (must be 8 bpp). Can be NULL.
    );

  ~CShadowItem
    ();

  virtual void Draw
    ( PLBmp * pCanvas,
      CRect * pUpdateRect
    );
    // Responsible for drawing the object on the canvas.

  // Member variables.

  PLPixel32  m_Color;        // Shadow color
  PLBmp    * m_pAlphaBmp;
  PLBYTE   ** m_pLineArray;

private:

  void drawClippedNoScale
    ( PLBmp * pCanvas,
      CRect * pRect
    );
    // Draws the object. pRect must have been clipped already.
    // Assumes that no scaling is nessesary.

  void drawAlphaLine
    ( PLBYTE * pDest,
      PLBYTE * pAlpha,
      CRect * pRect
    );

  void drawFadeLine
    ( PLBYTE * pDest,
      CRect * pRect
    );
    // Draws one line. No scaling. Assumes alpha channel doesn't
    // exist.

  void drawClipped
    ( PLBmp * pCanvas,
      CRect * pRect
    );
    // Draws the object. pRect must have been clipped already.

  void drawScaleLine
    ( PLBYTE * pDest,
      PLBYTE * pAlpha,
      CRect * pRect
    );

};

#endif
/*
/--------------------------------------------------------------------
|
|      $Log: shadow.h,v $
|      Revision 1.5  2002/03/31 13:36:42  uzadow
|      Updated copyright.
|
|      Revision 1.4  2001/09/16 19:03:23  uzadow
|      Added global name prefix PL, changed most filenames.
|
|
--------------------------------------------------------------------
*/