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