Panda3D
pnmBrush.h
1 // Filename: pnmBrush.h
2 // Created by: drose (01Feb07)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PNMBRUSH_H
16 #define PNMBRUSH_H
17 
18 #include "pandabase.h"
19 #include "referenceCount.h"
20 #include "pointerTo.h"
21 #include "luse.h"
22 
23 class PNMImage;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : PNMBrush
27 // Description : This class is used to control the shape and color of
28 // the drawing operations performed by a PNMPainter
29 // object.
30 //
31 // Normally, you don't create a PNMBrush directly;
32 // instead, use one of the static PNMBrush::make_*()
33 // methods provided here.
34 //
35 // A PNMBrush is used to draw the border of a polygon or
36 // rectangle, as well as for filling its interior. When
37 // it is used to draw a border, the brush is "smeared"
38 // over the border; when it is used to fill the
39 // interior, it is tiled through the interior.
40 ////////////////////////////////////////////////////////////////////
41 class EXPCL_PANDA_PNMIMAGE PNMBrush : public ReferenceCount {
42 protected:
43  INLINE PNMBrush(float xc, float yc);
44 
45 PUBLISHED:
46  virtual ~PNMBrush();
47 
48  enum BrushEffect {
49  BE_set,
50  BE_blend,
51  BE_darken,
52  BE_lighten,
53  };
54 
55  static PT(PNMBrush) make_transparent();
56  static PT(PNMBrush) make_pixel(const LColorf &color, BrushEffect effect = BE_blend);
57  static PT(PNMBrush) make_spot(const LColorf &color, float radius, bool fuzzy,
58  BrushEffect effect = BE_blend);
59  static PT(PNMBrush) make_image(const PNMImage &image, float xc, float yc,
60  BrushEffect effect = BE_blend);
61 
62 public:
63  INLINE float get_xc() const;
64  INLINE float get_yc() const;
65 
66  virtual void draw(PNMImage &image, int x, int y, float pixel_scale)=0;
67  virtual void fill(PNMImage &image, int xfrom, int xto, int y,
68  int xo, int yo)=0;
69 
70 protected:
71  float _xc, _yc;
72 };
73 
74 #include "pnmBrush.I"
75 
76 #endif
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
Definition: pnmImage.h:68
This class is used to control the shape and color of the drawing operations performed by a PNMPainter...
Definition: pnmBrush.h:41
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
A base class for all things that want to be reference-counted.