#include <ElementBuilder.h>
Public Member Functions | |
ElementBuilder () | |
~ElementBuilder () | |
void | Reset (GState gs=0) |
Element | CreateImage (Image &img) |
Element | CreateImage (Image &img, const Common::Matrix2D &mtx) |
Element | CreateImage (Image &img, double x, double y, double hscale, double vscale) |
Element | CreateGroupBegin () |
Element | CreateGroupEnd () |
Element | CreateShading (Shading &sh) |
Element | CreateForm (SDF::Obj form) |
Element | CreateForm (Page page) |
Element | CreateForm (Page page, class PDFDoc &doc) |
Element | CreateTextBegin (Font font, double font_sz) |
Element | CreateTextBegin () |
Element | CreateTextEnd () |
Element | CreateTextRun (const char *text_data, Font font, double font_sz) |
Element | CreateTextRun (const char *text_data, UInt32 text_data_sz, Font font, double font_sz) |
Element | CreateTextRun (const UChar *text_data, UInt32 text_data_sz, Font font, double font_sz) |
Element | CreateTextRun (const char *text_data) |
Element | CreateTextRun (const char *text_data, UInt32 text_data_sz) |
Element | CreateTextRun (const UChar *text_data, UInt32 text_data_sz) |
Element | CreateUnicodeTextRun (const Unicode *text_data, UInt32 text_data_sz) |
Element | CreateShapedTextRun (ShapedText text_data) |
Element | CreateTextNewLine (double dx, double dy) |
Element | CreateTextNewLine () |
Element | CreatePath (const std::vector< double > &points, const std::vector< unsigned char > &seg_types) |
Element | CreatePath (const double *points, int point_count, const char *seg_types, int seg_types_count) |
Element | CreateRect (double x, double y, double width, double height) |
Element | CreateEllipse (double x, double y, double width, double height) |
void | PathBegin () |
Element | PathEnd () |
void | MoveTo (double x, double y) |
void | LineTo (double x, double y) |
void | CurveTo (double cx1, double cy1, double cx2, double cy2, double x2, double y2) |
void | ArcTo (double x, double y, double width, double height, double start, double extent) |
void | ArcTo (double xr, double yr, double rx, bool isLargeArc, bool sweep, double endX, double endY) |
void | Ellipse (double x, double y, double width, double height) |
void | Rect (double x, double y, double width, double height) |
void | ClosePath () |
Element | CreateMarkedContentBeginInlineProperties (const char *tag) |
Element | CreateMarkedContentBegin (const char *tag, SDF::Obj property_dict) |
Element | CreateMarkedContentEnd () |
Element | CreateMarkedContentPointInlineProperties (const char *tag) |
Element | CreateMarkedContentPoint (const char *tag, SDF::Obj property_dict) |
void | Destroy () |
ElementBuilder is used to build new PDF::Elements (e.g. image, text, path, etc) from scratch. In conjunction with ElementWriter, ElementBuilder can be used to create new page content.
Definition at line 33 of file ElementBuilder.h.
pdftron::PDF::ElementBuilder::ElementBuilder | ( | ) |
pdftron::PDF::ElementBuilder::~ElementBuilder | ( | ) |
void pdftron::PDF::ElementBuilder::ArcTo | ( | double | x, |
double | y, | ||
double | width, | ||
double | height, | ||
double | start, | ||
double | extent | ||
) |
Draw an arc with the specified parameters (lower left corner, width, height and angles).
x | The horizontal x coordinate of the lower left corner of the ellipse encompassing rectangle |
y | The horizontal y coordinate of the lower left corner of the ellipse encompassing rectangle |
width | overall width of the full ellipse (not considering the angular extents). |
height | overall height of the full ellipse (not considering the angular extents). |
start | starting angle of the arc in degrees |
extent | angular extent of the arc in degrees |
void pdftron::PDF::ElementBuilder::ArcTo | ( | double | xr, |
double | yr, | ||
double | rx, | ||
bool | isLargeArc, | ||
bool | sweep, | ||
double | endX, | ||
double | endY | ||
) |
Draw an arc from the current point to the end point.
xr | x radius for the arc |
yr | y radius for the arc |
rx | x-axis rotation in radians |
isLargeArc | indicates if smaller or larger arc is chosen 1 - one of the two larger arc sweeps is chosen 0 - one of the two smaller arc sweeps is chosen |
sweep | direction in which arc is drawn (1 - clockwise, 0 - counterclockwise) |
endX | x coordinate of end point |
endY | y coordinate of end point |
void pdftron::PDF::ElementBuilder::ClosePath | ( | ) |
Closes the current subpath.
Element pdftron::PDF::ElementBuilder::CreateEllipse | ( | double | x, |
double | y, | ||
double | width, | ||
double | height | ||
) |
Create a Form XObject Element.
form | a Form XObject content stream |
Create a Form XObject Element using the content of the existing page. This method assumes that the XObject will be used in the same document as the given page. If you need to create the Form XObject in a different document use CreateForm(Page, Doc) method.
page | A page used to create the Form XObject. |
Create a Form XObject Element using the content of the existing page. Unlike CreateForm(Page) method, you can use this method to create form in another document.
page | A page used to create the Form XObject. |
doc | Destination document for the Form XObject. |
Element pdftron::PDF::ElementBuilder::CreateGroupBegin | ( | ) |
Element pdftron::PDF::ElementBuilder::CreateGroupEnd | ( | ) |
Element pdftron::PDF::ElementBuilder::CreateImage | ( | Image & | img, |
const Common::Matrix2D & | mtx | ||
) |
Element pdftron::PDF::ElementBuilder::CreateImage | ( | Image & | img, |
double | x, | ||
double | y, | ||
double | hscale, | ||
double | vscale | ||
) |
Create a content image Element out of a given document Image with the lower left corner at (x, y), and scale factors (hscale, vscale).
img | the given image. |
x | The horizontal x position to place the lower left corner of the image |
y | The vertical x position to place the lower left corner of the image |
hscale | The horizontal scale of the image |
vscale | The vertical scale of the image |
Element pdftron::PDF::ElementBuilder::CreateMarkedContentBegin | ( | const char * | tag, |
SDF::Obj | property_dict | ||
) |
Create e_marked_content_begin element with an associated property dictionary (i.e. BMC or BDC operator in PDF content stream).
tag | the tag entry for this element. |
property_dict | the property dictionary. |
Element pdftron::PDF::ElementBuilder::CreateMarkedContentBeginInlineProperties | ( | const char * | tag | ) |
Create e_marked_content_begin element with an inline property dictionary (i.e. BDC operator in PDF content stream).
tag | the tag entry for this element. |
Element pdftron::PDF::ElementBuilder::CreateMarkedContentEnd | ( | ) |
Create e_marked_content_end element (i.e. EMC operator in PDF content stream).
Element pdftron::PDF::ElementBuilder::CreateMarkedContentPoint | ( | const char * | tag, |
SDF::Obj | property_dict | ||
) |
Create e_marked_content_point element with an associated property dictionary (i.e. MP or DP operator in PDF content stream).
tag | the tag entry for this element. |
property_dict | the property dictionary. |
Element pdftron::PDF::ElementBuilder::CreateMarkedContentPointInlineProperties | ( | const char * | tag | ) |
Create e_marked_content_point element with an inline property dictionary (i.e. DP operator in PDF content stream).
tag | the tag entry for this element. |
Element pdftron::PDF::ElementBuilder::CreatePath | ( | const std::vector< double > & | points, |
const std::vector< unsigned char > & | seg_types | ||
) |
Element pdftron::PDF::ElementBuilder::CreatePath | ( | const double * | points, |
int | point_count, | ||
const char * | seg_types, | ||
int | seg_types_count | ||
) |
Element pdftron::PDF::ElementBuilder::CreateRect | ( | double | x, |
double | y, | ||
double | width, | ||
double | height | ||
) |
Element pdftron::PDF::ElementBuilder::CreateShapedTextRun | ( | ShapedText | text_data | ) |
Create a new text run from shaped text. Shaped Text can be created with an approriate Font, using the Font::GetShapedText() method.
text_data | the shaped text data |
Start a text block ('BT' operator in PDF content stream). The function installs the given font in the current graphics state.
font | font to set the text in the text block to |
font_sz | size to set the text in the text block to |
Element pdftron::PDF::ElementBuilder::CreateTextBegin | ( | ) |
Start a text block ('BT' operator in PDF content stream).
Element pdftron::PDF::ElementBuilder::CreateTextEnd | ( | ) |
Ends a text block.
Element pdftron::PDF::ElementBuilder::CreateTextNewLine | ( | double | dx, |
double | dy | ||
) |
Create e_text_new_line Element (i.e. a Td operator in PDF content stream). Move to the start of the next line, offset from the start of the current line by (dx , dy). dx and dy are numbers expressed in unscaled text space units.
dx | The horizontal x offset from the start of the current line |
dy | The vertical y offset from the start of the current line |
Element pdftron::PDF::ElementBuilder::CreateTextNewLine | ( | ) |
Element pdftron::PDF::ElementBuilder::CreateTextRun | ( | const char * | text_data, |
Font | font, | ||
double | font_sz | ||
) |
Create a text run using the given font.
Element pdftron::PDF::ElementBuilder::CreateTextRun | ( | const char * | text_data, |
UInt32 | text_data_sz, | ||
Font | font, | ||
double | font_sz | ||
) |
Element pdftron::PDF::ElementBuilder::CreateTextRun | ( | const UChar * | text_data, |
UInt32 | text_data_sz, | ||
Font | font, | ||
double | font_sz | ||
) |
Element pdftron::PDF::ElementBuilder::CreateTextRun | ( | const char * | text_data | ) |
Create a new text run.
Element pdftron::PDF::ElementBuilder::CreateTextRun | ( | const UChar * | text_data, |
UInt32 | text_data_sz | ||
) |
Element pdftron::PDF::ElementBuilder::CreateUnicodeTextRun | ( | const Unicode * | text_data, |
UInt32 | text_data_sz | ||
) |
Create a new Unicode text run.
text_data | pointer to Unicode text |
text_data_sz | number of characters (not bytes) in text_data |
void pdftron::PDF::ElementBuilder::CurveTo | ( | double | cx1, |
double | cy1, | ||
double | cx2, | ||
double | cy2, | ||
double | x2, | ||
double | y2 | ||
) |
Draw a Bezier curve from the current point to the given point (x2, y2) using (cx1, cy1) and (cx2, cy2) as control points.
cx1 | The x component of the first control point |
cy1 | The y component of the first control point |
cx2 | The x component of the second control point |
cy2 | The y component of the second control point |
x2 | The horizontal x component of the goal point |
y2 | The vertical y component of the goal point |
void pdftron::PDF::ElementBuilder::Destroy | ( | ) |
Frees the native memory of the object.
void pdftron::PDF::ElementBuilder::Ellipse | ( | double | x, |
double | y, | ||
double | width, | ||
double | height | ||
) |
Add an ellipse (or circle, if rx == ry) to the current path as a complete subpath. Setting the current point is not required before using this function.
x | The x coordinate of the ellipse center. |
y | The y coordinate of the ellipse center. |
width | The x radii of the ellipse. |
height | The y radii of the ellipse. |
void pdftron::PDF::ElementBuilder::LineTo | ( | double | x, |
double | y | ||
) |
Draw a line from the current point to the given point.
x | The horizontal x component of the goal point |
y | The vertical y component of the goal point |
void pdftron::PDF::ElementBuilder::MoveTo | ( | double | x, |
double | y | ||
) |
Set the current point.
x | The horizontal x component of the point |
y | The vertical y component of the point |
void pdftron::PDF::ElementBuilder::PathBegin | ( | ) |
Starts building a new path Element that can contain an arbitrary sequence of lines, curves, and rectangles.
Element pdftron::PDF::ElementBuilder::PathEnd | ( | ) |
void pdftron::PDF::ElementBuilder::Rect | ( | double | x, |
double | y, | ||
double | width, | ||
double | height | ||
) |
Add a rectangle to the current path as a complete subpath. Setting the current point is not required before using this function.
x | The x coordinate of the lower left corner of the rectangle. |
y | The y coordinate of the lower left corner of the rectangle. |
width | The width of the rectangle. |
height | The height of the rectangle. |
void pdftron::PDF::ElementBuilder::Reset | ( | GState | gs = 0 | ) |
The function sets the graphics state of this Element to the given value. If 'gs' parameter is not specified or is NULL the function resets the graphics state of this Element to the default graphics state (i.e. the graphics state at the beginning of the display list).
The function can be used in situations where the same ElementBuilder is used to create content on several pages, XObjects, etc. If the graphics state is not Reset() when moving to a new display list, the new Element will have the same graphics state as the last Element in the previous display list (and this may or may not be your intent).
Another use of Reset(gs) is to make sure that two Elements have the graphics state.
gs | GState (graphics state) object. If NULL or unspecified, resets graphics state to default. |