This program create hatch pattern using lines, page transform (rotation) and clipping path.
In this example clipping path is complex, constructed as intersections of two rectangles.
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <setjmp.h>
#include "handler.h"
void
{
while (x < width) {
}
}
int
main (int argc, char **argv)
{
char fname[256];
strcpy (fname, argv[0]);
strcat (fname, ".pdf");
pdf =
HPDF_New (demo_error_handler, NULL);
if (!pdf) {
printf ("error: cannot create PdfDoc object\n");
return 1;
}
if (setjmp(env)) {
return 1;
}
hatch (pdf, page);
return 0;
}
HPDF_STATUS HPDF_SaveToFile(HPDF_Doc pdf, const char *filename)
Saves the current document to file.
void HPDF_Free(HPDF_Doc pdf)
Revoke a document object and all resources.
HPDF_Doc HPDF_New(HPDF_Error_Handler user_error_fn, void *user_data)
Create an instance of a document object and initialize it.
HPDF_STATUS HPDF_Page_EndPath(HPDF_Page page)
Finish path object without filling or painting.
HPDF_STATUS HPDF_Page_SetRGBStrokeHex(HPDF_Page page, HPDF_UINT8 r, HPDF_UINT8 g, HPDF_UINT8 b)
Set stroke color (RGB) using HPDF_UINT8 values.
HPDF_STATUS HPDF_Page_SetLineWidth(HPDF_Page page, HPDF_REAL line_width)
Set width of the line used to stroke paths.
HPDF_STATUS HPDF_Page_Stroke(HPDF_Page page)
Paint current path.
HPDF_STATUS HPDF_Page_MoveTo(HPDF_Page page, HPDF_REAL x, HPDF_REAL y)
Start new subpath and move current point for drawing path.
HPDF_STATUS HPDF_Page_Eoclip(HPDF_Page page)
Modifies the current clipping path by intersecting it with current path using the even-odd rule....
HPDF_STATUS HPDF_Page_GSave(HPDF_Page page)
Save the page's current graphics state to the stack.
HPDF_STATUS HPDF_Page_Rectangle(HPDF_Page page, HPDF_REAL x, HPDF_REAL y, HPDF_REAL width, HPDF_REAL height)
Append rectangle to the current path.
HPDF_STATUS HPDF_Page_Concat(HPDF_Page page, HPDF_REAL a, HPDF_REAL b, HPDF_REAL c, HPDF_REAL d, HPDF_REAL x, HPDF_REAL y)
Concatenate the page's transformation matrix and specified matrix.
HPDF_STATUS HPDF_Page_LineTo(HPDF_Page page, HPDF_REAL x, HPDF_REAL y)
Append path from current point to specified point.
HPDF_STATUS HPDF_Page_GRestore(HPDF_Page page)
Restore graphics state which is saved by HPDF_Page_GSave().
HPDF_REAL HPDF_Page_GetHeight(HPDF_Page page)
Get page height.
HPDF_Page HPDF_AddPage(HPDF_Doc pdf)
Create new page and add it after the last page of document.
HPDF_STATUS HPDF_Page_SetSize(HPDF_Page page, HPDF_PageSizes size, HPDF_PageDirection direction)
Change page size and direction to a predefined ones.
HPDF_REAL HPDF_Page_GetWidth(HPDF_Page page)
Get page width.
#define HPDF_MM
Predefined value for calculations with millimeters. Equals to 72.0/25.4 (72 points pre inch per mm).
Definition: hpdf_consts.h:178
#define HPDF_PI
Definition: hpdf_consts.h:32
@ HPDF_PAGE_SIZE_A4
ISO 216 "A4" page size (210.0mm x 297.0mm)
Definition: hpdf_page_sizes.h:137
float HPDF_REAL
Definition: hpdf_types.h:79
@ HPDF_PAGE_PORTRAIT
Portrait orientation (longest size vertical)
Definition: hpdf_types.h:575
Definition: hpdf_objects.h:421
Definition: hpdf_doc.h:36