Panda3D

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