Pie chart is created using filled circle segments and central circle.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include "grid_sheet.h"
#include "handler.h"
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;
}
print_grid (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_MoveTo(HPDF_Page page, HPDF_REAL x, HPDF_REAL y)
Start new subpath and move current point for drawing path.
HPDF_STATUS HPDF_Page_SetRGBFill(HPDF_Page page, HPDF_REAL r, HPDF_REAL g, HPDF_REAL b)
Set filling color (RGB).
HPDF_STATUS HPDF_Page_Arc(HPDF_Page page, HPDF_REAL x, HPDF_REAL y, HPDF_REAL radius, HPDF_REAL ang1, HPDF_REAL ang2)
Append circle arc to current path.
HPDF_STATUS HPDF_Page_Fill(HPDF_Page page)
Fill current path using non-zero winding number rule.
HPDF_STATUS HPDF_Page_Circle(HPDF_Page page, HPDF_REAL x, HPDF_REAL y, HPDF_REAL radius)
Append circle to current path.
HPDF_STATUS HPDF_Page_SetGrayFill(HPDF_Page page, HPDF_REAL value)
Set the filling color (Gray).
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_SetGrayStroke(HPDF_Page page, HPDF_REAL value)
Set stroking color (Gray).
HPDF_Point HPDF_Page_GetCurrentPos(HPDF_Page page)
Get current position for path painting.
HPDF_Page HPDF_AddPage(HPDF_Doc pdf)
Create new page and add it after the last page of document.
HPDF_STATUS HPDF_Page_SetWidth(HPDF_Page page, HPDF_REAL value)
Change page width.
HPDF_STATUS HPDF_Page_SetHeight(HPDF_Page page, HPDF_REAL value)
Change page height.
Definition: hpdf_objects.h:421
Definition: hpdf_doc.h:36
Definition: hpdf_types.h:105
HPDF_REAL y
Definition: hpdf_types.h:107
HPDF_REAL x
Definition: hpdf_types.h:106