NAME
PDF::Make::Render - Native path rendering for PDF content
SYNOPSIS
use PDF::Make::Render;
# Create a render context
my $ctx = PDF::Make::Render->new(800, 600);
# Set up graphics state
$ctx->save;
$ctx->set_fill_color(1, 0, 0); # Red
$ctx->set_stroke_color(0, 0, 0);
$ctx->set_line_width(2);
# Build a path
$ctx->move_to(100, 100);
$ctx->line_to(200, 100);
$ctx->line_to(200, 200);
$ctx->close_path;
# Render
$ctx->fill;
$ctx->restore;
# Get pixel data
my $pixels = $ctx->get_pixels;
DESCRIPTION
PDF::Make::Render provides a native path rendering engine for PDF content. It implements PDF's imaging model including paths, fills, strokes, clipping, and transformations.
METHODS
new($width, $height)
Create a new render context with the specified dimensions.
width / height
Get the dimensions of the render context.
clear($r, $g, $b, $a)
Clear the context to the specified color.
save / restore
Save or restore graphics state.
Path Building
- move_to($x, $y)
-
Begin a new subpath.
- line_to($x, $y)
-
Add a line segment.
- curve_to($x1, $y1, $x2, $y2, $x3, $y3)
-
Add a cubic Bezier curve.
- close_path
-
Close the current subpath.
- rectangle($x, $y, $w, $h)
-
Add a rectangle to the path.
Path Painting
- fill
-
Fill the current path using non-zero winding rule.
- stroke
-
Stroke the current path.
- fill_stroke
-
Fill and stroke the current path.
- clip
-
Clip to the current path.
Color
- set_fill_color($r, $g, $b, $a)
-
Set the fill color.
- set_stroke_color($r, $g, $b, $a)
-
Set the stroke color.
Line Properties
- set_line_width($width)
-
Set the line width.
- set_line_cap($cap)
-
Set line cap style (0=butt, 1=round, 2=square).
- set_line_join($join)
-
Set line join style (0=miter, 1=round, 2=bevel).
- set_miter_limit($limit)
-
Set the miter limit.
Transformations
- set_matrix($a, $b, $c, $d, $e, $f)
-
Set the current transformation matrix.
- concat_matrix($a, $b, $c, $d, $e, $f)
-
Concatenate a matrix with the current CTM.
Output
- get_pixels
-
Get the raw pixel data as a scalar (RGBA format).
- get_pixel($x, $y)
-
Get a single pixel as ($r, $g, $b, $a).
CONSTANTS
Line Cap
PDFMAKE_LINE_CAP_BUTT = 0
PDFMAKE_LINE_CAP_ROUND = 1
PDFMAKE_LINE_CAP_SQUARE = 2
Line Join
PDFMAKE_LINE_JOIN_MITER = 0
PDFMAKE_LINE_JOIN_ROUND = 1
PDFMAKE_LINE_JOIN_BEVEL = 2
SEE ALSO
PDF::Make, PDF::Make::RenderPage
AUTHOR
LNATION <email@lnation.org>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.