Painters
Painters are lightweight classes that know how to draw a single node type
using the document context’s rendering backend. Each painter implements
the IPainter interface.
IPainter
-
class IPainter
Interface for painter classes responsible for drawing elements onto a PDF context.
Subclassed by docraft::renderer::painter::DocraftCirclePainter, docraft::renderer::painter::DocraftImagePainter, docraft::renderer::painter::DocraftLinePainter, docraft::renderer::painter::DocraftPolygonPainter, docraft::renderer::painter::DocraftRectanglePainter, docraft::renderer::painter::DocraftTablePainter, docraft::renderer::painter::DocraftTextPainter, docraft::renderer::painter::DocraftTrianglePainter, docraft::renderer::painter::docraft_blank_line_painter
Public Functions
-
virtual ~IPainter() = default
Virtual destructor.
Draws the element using the provided document context.
- Parameters:
context – Document context providing backend access and state.
-
virtual ~IPainter() = default
DocraftTextPainter
Handles alignment, justification, and underline rendering for text nodes.
-
class DocraftTextPainter : public docraft::renderer::painter::IPainter
Painter that draws DocraftText nodes.
Handles alignment, justification, and optional underline rendering.
Public Functions
-
explicit DocraftTextPainter(const model::DocraftText &text_node)
Creates a painter for a given text node.
- Parameters:
text_node – Text node to render.
Draws the text node using the provided context.
- Parameters:
context – Document context.
-
explicit DocraftTextPainter(const model::DocraftText &text_node)
DocraftRectanglePainter
Renders background and border for rectangle nodes.
-
class DocraftRectanglePainter : public docraft::renderer::painter::IPainter
Painter that draws DocraftRectangle nodes.
Renders background and border before child content.
Public Functions
-
DocraftRectanglePainter(const model::DocraftRectangle &rectangle_node)
Creates a rectangle painter bound to the rectangle node.
- Parameters:
rectangle_node – Rectangle node.
Draws the rectangle using the provided context.
- Parameters:
context – Document context.
-
DocraftRectanglePainter(const model::DocraftRectangle &rectangle_node)
DocraftCirclePainter
-
class DocraftCirclePainter : public docraft::renderer::painter::IPainter
Painter that draws DocraftCircle nodes.
Public Functions
-
explicit DocraftCirclePainter(const model::DocraftCircle &circle_node)
Creates a circle painter bound to the circle node.
- Parameters:
circle_node – Circle node.
Draws the circle using the provided context.
- Parameters:
context – Document context.
-
explicit DocraftCirclePainter(const model::DocraftCircle &circle_node)
DocraftTrianglePainter
-
class DocraftTrianglePainter : public docraft::renderer::painter::IPainter
Painter that draws DocraftTriangle nodes.
Public Functions
-
explicit DocraftTrianglePainter(const model::DocraftTriangle &triangle_node)
Creates a triangle painter bound to the triangle node.
- Parameters:
triangle_node – Triangle node.
Draws the triangle using the provided context.
- Parameters:
context – Document context.
-
explicit DocraftTrianglePainter(const model::DocraftTriangle &triangle_node)
DocraftLinePainter
-
class DocraftLinePainter : public docraft::renderer::painter::IPainter
Painter that draws DocraftLine nodes.
Public Functions
-
explicit DocraftLinePainter(const model::DocraftLine &line_node)
Creates a line painter bound to the line node.
- Parameters:
line_node – Line node.
Draws the line using the provided context.
- Parameters:
context – Document context.
-
explicit DocraftLinePainter(const model::DocraftLine &line_node)
DocraftPolygonPainter
-
class DocraftPolygonPainter : public docraft::renderer::painter::IPainter
Painter that draws DocraftPolygon nodes.
Public Functions
-
explicit DocraftPolygonPainter(const model::DocraftPolygon &polygon_node)
Creates a polygon painter bound to the polygon node.
- Parameters:
polygon_node – Polygon node.
Draws the polygon using the provided context.
- Parameters:
context – Document context.
-
explicit DocraftPolygonPainter(const model::DocraftPolygon &polygon_node)
DocraftImagePainter
Supports file-based and in-memory image sources.
-
class DocraftImagePainter : public docraft::renderer::painter::IPainter
Painter that draws DocraftImage nodes.
Supports file-based and in-memory image sources.
Public Functions
-
explicit DocraftImagePainter(const model::DocraftImage &image_node)
Creates an image painter bound to the image node.
- Parameters:
image_node – Image node.
Draws the image using the provided context.
- Parameters:
context – Document context.
-
explicit DocraftImagePainter(const model::DocraftImage &image_node)
DocraftTablePainter
Draws headers, grid lines, and cell content.
-
class DocraftTablePainter : public docraft::renderer::painter::IPainter
Painter that draws DocraftTable nodes.
Draws headers, grid lines, and cell content using the current context.
Public Functions
-
DocraftTablePainter(const model::DocraftTable &table_node)
Creates a table painter bound to the table node.
- Parameters:
table_node – Table node.
Draws the table using the provided context.
- Parameters:
context – Document context.
-
DocraftTablePainter(const model::DocraftTable &table_node)
docraft_blank_line_painter
Advances layout for blank lines (no drawing).
-
class docraft_blank_line_painter : public docraft::renderer::painter::IPainter
Painter that advances layout for blank lines.
Performs no drawing but updates the cursor state.
Public Functions
-
explicit docraft_blank_line_painter(const model::DocraftBlankLine &blank_line_node)
Creates a blank-line painter bound to the blank line node.
- Parameters:
blank_line_node – Blank line node.
Draws the blank line using the provided context.
- Parameters:
context – Document context.
-
explicit docraft_blank_line_painter(const model::DocraftBlankLine &blank_line_node)