PNMPainter
from panda3d.core import PNMPainter
- class PNMPainter
Bases:
This class provides a number of convenient methods for painting drawings directly into a
PNMImage
.It stores a pointer to the
PNMImage
you pass it, but it does not take ownership of the object; you are responsible for ensuring that thePNMImage
does not destruct during the lifetime of the PNMPainter object.Inheritance diagram
- __init__(image: PNMImage, xo: int, yo: int)
The constructor stores a pointer to the
PNMImage
you pass it, but it does not take ownership of the object; you are responsible for ensuring that thePNMImage
does not destruct during the lifetime of thePNMPainter
object.The xo, yo coordinates specify an optional offset for fill coordinates. If you are painting with a pattern fill, these specify the virtual coordinates of the upper-left corner of the image, which can allow you to adjust the pattern to line up with nested images, if necessary.
- __init__(param0: PNMPainter)
- draw_line(xa: float, ya: float, xb: float, yb: float)
Draws an antialiased line on the
PNMImage
, using the current pen.
- draw_rectangle(xa: float, ya: float, xb: float, yb: float)
Draws a filled rectangule on the
PNMImage
, using the current pen for the outline, and the current fill brush for the interior.The two coordinates specify any two diagonally opposite corners.
- property fill PNMBrush
- Getter
Returns the current fill brush. See
set_fill()
.- Setter
Specifies a
PNMBrush
that will be used for filling in the interiors of objects. If the brush is a bitmap brush, its image will be tiled throughout the space.Unlike the
PNMImage
passed to the constructor, thePNMPainter
will take ownership of the fill brush. It is not necessary to keep a separate pointer to it.
- get_fill() PNMBrush
Returns the current fill brush. See
set_fill()
.
- property pen PNMBrush
- Getter
Returns the current pen. See
set_pen()
.- Setter
Specifies a
PNMBrush
that will be used for drawing lines and edges. If the brush is a bitmap brush, its image will be smeared pixelwise along the line.Unlike the
PNMImage
passed to the constructor, thePNMPainter
will take ownership of the pen. It is not necessary to keep a separate pointer to it.
- set_fill(fill: PNMBrush)
Specifies a
PNMBrush
that will be used for filling in the interiors of objects. If the brush is a bitmap brush, its image will be tiled throughout the space.Unlike the
PNMImage
passed to the constructor, thePNMPainter
will take ownership of the fill brush. It is not necessary to keep a separate pointer to it.
- set_pen(pen: PNMBrush)
Specifies a
PNMBrush
that will be used for drawing lines and edges. If the brush is a bitmap brush, its image will be smeared pixelwise along the line.Unlike the
PNMImage
passed to the constructor, thePNMPainter
will take ownership of the pen. It is not necessary to keep a separate pointer to it.