Panda3D

Loading...
Searching...
No Matches
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 {
31PUBLISHED:
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::get_pen
get_pen
Returns the current pen.
Definition pnmPainter.h:40
PNMPainter::set_fill
set_fill
Specifies a PNMBrush that will be used for filling in the interiors of objects.
Definition pnmPainter.h:41
PNMPainter::draw_line
void draw_line(float xa, float ya, float xb, float yb)
Draws an antialiased line on the PNMImage, using the current pen.
Definition pnmPainter.cxx:39
PNMPainter::PNMPainter
PNMPainter(PNMImage &image, int xo=0, int yo=0)
The constructor stores a pointer to the PNMImage you pass it, but it does not take ownership of the o...
Definition pnmPainter.cxx:27
PNMPainter::draw_rectangle
void draw_rectangle(float xa, float ya, float xb, float yb)
Draws a filled rectangule on the PNMImage, using the current pen for the outline, and the current fil...
Definition pnmPainter.cxx:142
PNMPainter::get_fill
get_fill
Returns the current fill brush.
Definition pnmPainter.h:41
PNMPainter::draw_point
void draw_point(float x, float y)
Draws an antialiased point on the PNMImage, using the current pen.
Definition pnmPainter.I:69
PNMPainter::set_pen
set_pen
Specifies a PNMBrush that will be used for drawing lines and edges.
Definition pnmPainter.h:40
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.