libhpdftbl 1.5.0
Table construction library for Haru PDF library
|
Support for drawing widgets. More...
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <hpdf.h>
#include <string.h>
#include <math.h>
#include "hpdftbl.h"
Macros | |
#define | TRUE 1 |
#define | FALSE 0 |
Functions | |
void | hpdftbl_table_widget_letter_buttons (HPDF_Doc doc, HPDF_Page page, HPDF_REAL xpos, HPDF_REAL ypos, HPDF_REAL width, HPDF_REAL height, const HPDF_RGBColor on_color, const HPDF_RGBColor off_color, const HPDF_RGBColor on_background, const HPDF_RGBColor off_background, const HPDF_REAL fsize, const char *letters, _Bool *state) |
Display an array of letters as a table where each letter is its own "mini" cell and sorrounded by a frame. Each boxed letter can be in an "on" state or "off" state which is illustrated with different font and fac colors. More... | |
void | hpdftbl_widget_slide_button (HPDF_Doc doc, HPDF_Page page, HPDF_REAL xpos, HPDF_REAL ypos, HPDF_REAL width, HPDF_REAL height, _Bool state) |
Table widget that draws a sliding on/off switch. Meant to be used in a canvas callback to display a boolean value. More... | |
void | hpdftbl_widget_hbar (const HPDF_Doc doc, const HPDF_Page page, const HPDF_REAL xpos, const HPDF_REAL ypos, const HPDF_REAL width, const HPDF_REAL height, const HPDF_RGBColor color, const float val, const _Bool hide_val) |
Draw a horizontal partially filled bar to indicate an analog (percentage) value. More... | |
void | hpdftbl_widget_segment_hbar (const HPDF_Doc doc, const HPDF_Page page, const HPDF_REAL xpos, const HPDF_REAL ypos, const HPDF_REAL width, const HPDF_REAL height, const size_t num_segments, const HPDF_RGBColor on_color, const double val_percent, const _Bool hide_val) |
Draw a horizontal segment meter that can be used to visualize a discrete value. More... | |
void | hpdftbl_widget_strength_meter (const HPDF_Doc doc, const HPDF_Page page, const HPDF_REAL xpos, const HPDF_REAL ypos, const HPDF_REAL width, const HPDF_REAL height, const size_t num_segments, const HPDF_RGBColor on_color, const size_t num_on_segments) |
Draw a phone strength meter. More... | |
Support for drawing widgets.
#define FALSE 0 |
C Boolean false value
#define TRUE 1 |
C Boolean truth value
void hpdftbl_table_widget_letter_buttons | ( | HPDF_Doc | doc, |
HPDF_Page | page, | ||
HPDF_REAL | xpos, | ||
HPDF_REAL | ypos, | ||
HPDF_REAL | width, | ||
HPDF_REAL | height, | ||
const HPDF_RGBColor | on_color, | ||
const HPDF_RGBColor | off_color, | ||
const HPDF_RGBColor | on_background, | ||
const HPDF_RGBColor | off_background, | ||
const HPDF_REAL | fsize, | ||
const char * | letters, | ||
_Bool * | state | ||
) |
Display an array of letters as a table where each letter is its own "mini" cell
and sorrounded by a frame. Each boxed letter can be in an "on" state or "off" state which is illustrated with different font and fac colors.
doc | HPDF document handle |
page | HPDF page handle |
xpos | X-öosition of cell |
ypos | Y-Position of cell |
width | Width of cell |
height | Height of cell |
on_color | The font color in "on" state |
off_color | The font color in "off" state |
on_background | The face color in "on" state |
off_background | The face color in "off" state |
fsize | The font size |
letters | What letters to have in the boxes |
state | What state each boxed letter should be (0=off, 1=pn) |
void hpdftbl_widget_hbar | ( | const HPDF_Doc | doc, |
const HPDF_Page | page, | ||
const HPDF_REAL | xpos, | ||
const HPDF_REAL | ypos, | ||
const HPDF_REAL | width, | ||
const HPDF_REAL | height, | ||
const HPDF_RGBColor | color, | ||
const float | val, | ||
const _Bool | hide_val | ||
) |
Draw a horizontal partially filled bar to indicate an analog (percentage) value.
This function can not be used directly as a canvas callback since it needs additional parameters. Instead create a simple canvas callback that gives the additional parameters.
doc | HPDF Document handle |
page | HPDF Page handle |
xpos | Lower left x |
ypos | Lower left y |
width | Width of meter |
height | Height of meter |
color | Fill color for bar |
val | Percentage fill in range [0.0, 100.0] |
hide_val | TRUE to hide the value (in percent) at the right end of the entire bar |
void hpdftbl_widget_segment_hbar | ( | const HPDF_Doc | doc, |
const HPDF_Page | page, | ||
const HPDF_REAL | xpos, | ||
const HPDF_REAL | ypos, | ||
const HPDF_REAL | width, | ||
const HPDF_REAL | height, | ||
const size_t | num_segments, | ||
const HPDF_RGBColor | on_color, | ||
const double | val_percent, | ||
const _Bool | hide_val | ||
) |
Draw a horizontal segment meter that can be used to visualize a discrete value.
This function can not be used directly as a canvas callback since it needs additional parameters. Instead create a simple canvas callback that gives the additional parameters.
doc | HPDF Document handle |
page | HPDF Page handle |
xpos | Lower left x |
ypos | Lower left y |
width | Width of meter |
height | Height of meter |
num_segments | Total number of segments |
on_color | Color for "on" segment |
val_percent | To what extent should the bars be filled (as a value 0.0 - 1.0) |
hide_val | TRUE to hide the value (in percent) at the right end of the entire bar |
void hpdftbl_widget_slide_button | ( | HPDF_Doc | doc, |
HPDF_Page | page, | ||
HPDF_REAL | xpos, | ||
HPDF_REAL | ypos, | ||
HPDF_REAL | width, | ||
HPDF_REAL | height, | ||
_Bool | state | ||
) |
Table widget that draws a sliding on/off switch. Meant to be used in a canvas callback to display a boolean value.
This function can not be used directly as a canvas callback since it needs the state of the button as an argument. Instead create a simple canvas callback that determines the wanted state and then just passes on all argument to this widget function.
doc | HPDF document handle |
page | HPDF page handle |
xpos | X-öosition of cell |
ypos | Y-Position of cell |
width | Width of cell |
height | Height of cell |
state | State of button On/Off |
void hpdftbl_widget_strength_meter | ( | const HPDF_Doc | doc, |
const HPDF_Page | page, | ||
const HPDF_REAL | xpos, | ||
const HPDF_REAL | ypos, | ||
const HPDF_REAL | width, | ||
const HPDF_REAL | height, | ||
const size_t | num_segments, | ||
const HPDF_RGBColor | on_color, | ||
const size_t | num_on_segments | ||
) |
Draw a phone strength meter.
This function can not be used directly as a canvas callback since it needs additional parameters. Instead create a simple canvas callback that gives the additional parameters.
doc | HPDF Document handle |
page | HPDF Page handle |
xpos | Lower left x |
ypos | Lower left y |
width | Width of meter |
height | Height of meter |
num_segments | Total number of segments |
on_color | Color for "on" segment |
num_on_segments | Number of on segments |