Panda3D
pnmPainter.h
1 // Filename: pnmPainter.h
2 // Created by: drose (02Feb07)
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 PNMPAINTER_H
16 #define PNMPAINTER_H
17 
18 #include "pandabase.h"
19 #include "pnmBrush.h"
20 
21 class PNMImage;
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : PNMPainter
25 // Description : This class provides a number of convenient methods
26 // for painting drawings directly into a PNMImage.
27 //
28 // It stores a pointer to the PNMImage you pass it, but
29 // it does not take ownership of the object; you are
30 // responsible for ensuring that the PNMImage does not
31 // destruct during the lifetime of the PNMPainter
32 // object.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_PNMIMAGE PNMPainter {
35 PUBLISHED:
36  PNMPainter(PNMImage &image, int xo = 0, int yo = 0);
37  INLINE ~PNMPainter();
38 
39  INLINE void set_pen(PNMBrush *pen);
40  INLINE PNMBrush *get_pen() const;
41  INLINE void set_fill(PNMBrush *fill);
42  INLINE PNMBrush *get_fill() const;
43 
44  INLINE void draw_point(float x, float y);
45  void draw_line(float xa, float ya, float xb, float yb);
46  void draw_rectangle(float xa, float ya, float xb, float yb);
47 
48 private:
49  INLINE void draw_hline_point(int x, float xa, float ya,
50  float xd, float yd,
51  float pixel_scale);
52  INLINE void draw_vline_point(int y, float xa, float ya,
53  float xd, float yd,
54  float pixel_scale);
55 
56 private:
57  PNMImage &_image;
58  int _xo, _yo;
59 
60  PT(PNMBrush) _pen;
61  PT(PNMBrush) _fill;
62 };
63 
64 #include "pnmPainter.I"
65 
66 #endif
This class provides a number of convenient methods for painting drawings directly into a PNMImage...
Definition: pnmPainter.h:34
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