diff options
author | Norbert Preining <norbert@preining.info> | 2020-09-20 03:03:26 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-09-20 03:03:26 +0000 |
commit | 1f457376b478257b88d4a857f5ec1b6155442dd7 (patch) | |
tree | 2a06a60551dea362cf8cb0cb0ba66c78608717c4 /support/dktools/dk4pppt.h | |
parent | ac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff) |
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/dk4pppt.h')
-rw-r--r-- | support/dktools/dk4pppt.h | 1434 |
1 files changed, 1434 insertions, 0 deletions
diff --git a/support/dktools/dk4pppt.h b/support/dktools/dk4pppt.h new file mode 100644 index 0000000000..f5f402114c --- /dev/null +++ b/support/dktools/dk4pppt.h @@ -0,0 +1,1434 @@ +/* +Copyright (C) 2017-2020, Dirk Krause +SPDX-License-Identifier: BSD-3-Clause +*/ + +/* + WARNING: This file was generated by the dkct program (see + http://dktools.sourceforge.net/ for details). + Changes you make here will be lost if dkct is run again! + You should modify the original source and run dkct on it. + Original source: dk4pppt.ctr +*/ + +#ifndef DK4PPPT_H_INCLUDED +/** Avoid multiple inclusions. */ +#define DK4PPPT_H_INCLUDED 1 + + +#line 9 "dk4pppt.ctr" + +/** @file dk4pppt.h PGF/PDF+TeX/(E)PS+TeX output. +*/ + +#ifndef DK4CONF_H_INCLUDED +#if DK4_BUILDING_DKTOOLS4 +#include "dk4conf.h" +#else +#include <dktools-4/dk4conf.h> +#endif +#endif + +#ifndef DK4FONT_H_INCLUDED +#if DK4_BUILDING_DKTOOLS4 +#include "dk4font.h" +#else +#include <dktools-4/dk4font.h> +#endif +#endif + +#ifndef DK4ALIGN_H_INCLUDED +#if DK4_BUILDING_DKTOOLS4 +#include "dk4align.h" +#else +#include <dktools-4/dk4align.h> +#endif +#endif + +#ifndef DK4ERROR_H_INCLUDED +#if DK4_BUILDING_DKTOOLS4 +#include "dk4error.h" +#else +#include <dktools-4/dk4error.h> +#endif +#endif + +#ifndef DK4MEMBF_H_INCLUDED +#if DK4_BUILDING_DKTOOLS4 +#include "dk4membuf.h" +#else +#include <dktools-4/dk4membuf.h> +#endif +#endif + +#ifndef DK4MBSTRM_H_INCLUDED +#if DK4_BUILDING_DKTOOLS4 +#include "dk4mbstrm.h" +#else +#include <dktools-4/dk4mbstrm.h> +#endif +#endif + +#ifndef DK4GRA_H_INCLUDED +#if DK4_BUILDING_DKTOOLS4 +#include "dk4gra.h" +#else +#include <dktools-4/dk4gra.h> +#endif +#endif + +#ifndef DK4ENC_H_INCLUDED +#if DK4_BUILDING_DKTOOLS4 +#include "dk4enc.h" +#else +#include <dktools-4/dk4enc.h> +#endif +#endif + +#ifndef DK4REC25_H_INCLUDED +#if DK4_BUILDING_DKTOOLS4 +#include "dk4rec25.h" +#else +#include <dktools-4/dk4rec25.h> +#endif +#endif + +/** Output drivers. +*/ +typedef enum { + DK4_PPPT_DR_PDF_TEX = 0, /**< Produce PDF+TeX file pair. */ + DK4_PPPT_DR_EPS_TEX , /**< Produce EPS+TeX file pair. */ + DK4_PPPT_DR_PGF /**< Produce PGF file. */ +} dk4_pppt_driver_t; + + +/** Output structure for combined PDF+TeX/EPS+TeX output. +*/ +typedef struct { + dkChar *tfn; /**< TeX file name. */ + dk4_gra_t *gra; /**< Graphics structure. */ + dk4_font_collector_t *fc; /**< Font collector. */ + dk4_membuf_t *tmb; /**< TeX memory buffer. */ + dk4_stream_t *tms; /**< TeX memory stream. */ + dk4_sto_t *s_f; /**< Storage for font setup lines. */ + dk4_sto_it_t *i_f; /**< Iterator for font setup lines. */ + dk4_sto_t *s_p; /**< Storage for package setup lines. */ + dk4_sto_it_t *i_p; /**< Iterator for package setup lines. */ + dk4_sto_t *s_o; /**< Storage for other preamble lines. */ + dk4_sto_it_t *i_o; /**< Iterator for other preamble lines. */ + double dfs; /**< Document font size. */ + size_t n_f; /**< Number of font setup lines. */ + size_t n_p; /**< Number of package setup lines. */ + size_t n_o; /**< Number of other setup lines. */ +} dk4_pppt_pdf_ps_t; + + + +/** Details structure. +*/ +typedef union { + dk4_gra_t *pgf; /**< PGF output structure. */ + dk4_pppt_pdf_ps_t ppt; /**< Output structure PDF+TeX/EPS+TeX. */ +} dk4_pppt_out_t; + + + +/** Output structure. +*/ +typedef struct { + dk4_pppt_out_t out; /**< Output union. */ + dk4_pppt_driver_t dr; /**< Driver, dk4_pppt_driver_t value. */ + int isdoc; /**< Flag: Produce entire document. */ + int flags; /**< Document and page flags. */ +} dk4_pppt_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +/** Open an output structure. + @param texname Name of TeX output file. + The name ends on ".tex". + The name of the included *.eps or *.pdf file + is derived from this name. + @param dr Output driver. + @param isdoc Flag: Produce LaTeX document, not just image. + @param flags Additional flags for graphics. + @param width Image width in bp (PS point). + @param height Image height in bp. + @param erp Error report, may be NULL. + @return Valid pointer to new output structure on success, NULL on error. +*/ +dk4_pppt_t * +dk4pppt_open( + const dkChar *texname, + dk4_pppt_driver_t dr, + int isdoc, + int flags, + size_t width, + size_t height, + dk4_er_t *erp +); + +/** Write output file(s) and close output structure. + @param pppt Output structure to write and close. + @param erp Error report, may be NULL. + @return 1 on success, 0 on error. +*/ +int +dk4pppt_write_and_close( + dk4_pppt_t *pppt, + dk4_er_t *erp +); + +/** Close output structure without writing. + This function can be used after errors to close the structure + without any attempt to overwrite existing files. + @param pppt Output structure to close. +*/ +void +dk4pppt_close( + dk4_pppt_t *pppt +); + +/** Set flag for simplified gsave/grestore handling. + Set this flag, if you use gsave and grestore only to save and restore + the clip path for pattern filling. + @param pppt Output structure. + @param val Flag: Simplified gsave and grestore handling. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL. +*/ +void +dk4pppt_set_gs_for_pattern_only( + dk4_pppt_t *pppt, + int val, + dk4_er_t *erp +); + +/** Save current graphics state (especially clip path). + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_gsave( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Restore graphics state (especially clip path). + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_grestore( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Set line width. + @param pppt Output structure. + @param lw Line width in bp. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_line_width( + dk4_pppt_t *pppt, + double lw, + int *backptr, + dk4_er_t *erp +); + +/** Set line style. + @param pppt Output structure. + @param ls Line style. + @param sv Style value (dash length in bp). + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_line_style( + dk4_pppt_t *pppt, + dk4_gra_ls_t ls, + double sv, + int *backptr, + dk4_er_t *erp +); + +/** Set line cap. + @param pppt Output structure. + @param lc Line cap type. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_line_cap( + dk4_pppt_t *pppt, + dk4_gra_lc_t lc, + int *backptr, + dk4_er_t *erp +); + +/** Set line join. + @param pppt Output structure. + @param lj Line join type. + @param ml Miter limit, only used if lj is DK4_GRA_LJ_MITERED. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_line_join( + dk4_pppt_t *pppt, + dk4_gra_lj_t lj, + double ml, + int *backptr, + dk4_er_t *erp +); + +/** Set fill color to gray. + @param pppt Output structure. + @param g Gray value in interval 0 to 1. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_fill_gray( + dk4_pppt_t *pppt, + double g, + int *backptr, + dk4_er_t *erp +); + +/** Set fill color to RGB. + @param pppt Output structure. + @param r Red value in interval 0 to 1. + @param g Green value in interval 0 to 1. + @param b Blue value in interval 0 to 1. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_fill_rgb( + dk4_pppt_t *pppt, + double r, + double g, + double b, + int *backptr, + dk4_er_t *erp +); + +/** Set fill color to CMYK. + @param pppt Output structure. + @param c Cyan value in interval 0 to 1. + @param m Magenta value in interval 0 to 1. + @param y Yellow value in interval 0 to 1. + @param k Black value in interval 0 to 1. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_fill_cmyk( + dk4_pppt_t *pppt, + double c, + double m, + double y, + double k, + int *backptr, + dk4_er_t *erp +); + +/** Set stroke color to gray. + @param pppt Output structure. + @param g Gray value in interval 0 to 1. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_stroke_gray( + dk4_pppt_t *pppt, + double g, + int *backptr, + dk4_er_t *erp +); + +/** Set stroke color to RGB. + @param pppt Output structure. + @param r Red value in interval 0 to 1. + @param g Green value in interval 0 to 1. + @param b Blue value in interval 0 to 1. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_stroke_rgb( + dk4_pppt_t *pppt, + double r, + double g, + double b, + int *backptr, + dk4_er_t *erp +); + +/** Set stroke color to CMYK. + @param pppt Output structure. + @param c Cyan value in interval 0 to 1. + @param m Magenta value in interval 0 to 1. + @param y Yellow value in interval 0 to 1. + @param k Black value in interval 0 to 1. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation. +*/ +void +dk4pppt_set_stroke_cmyk( + dk4_pppt_t *pppt, + double c, + double m, + double y, + double k, + int *backptr, + dk4_er_t *erp +); + +/** Prepare output structure for a fill operation. + Use this function before you start to construct a path you plan to fill. + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_prepare_fill( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Prepare output structure for a stroke operation. + Use this function before you start to construct a path you plan to stroke. + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_prepare_stroke( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Prepare output structure for a combined fill and stroke operation. + Use this function before you start to construct a path you plan to + fill and stroke. + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_prepare_fill_and_stroke( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Check whether a combined fill and close operation is available + for an output structure. + @param pppt Output structure to test. + @return 1 if a fill-and-close operation is available, 0 otherwise. +*/ +int +dk4pppt_can_fill_and_stroke( + const dk4_pppt_t *pppt +); + +/** Fill current path. + Note: Use dk4gra_prepare_fill() before you start to construct a path + you plan to fill. + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_fill( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Stroke current path. + Note: Use dk4gra_prepare_stroke() before you start to construct a path + you plan to stroke. + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_stroke( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Fill and stroke current path. + Note: Use dk4gra_prepare_fill_and_stroke() before you start to construct + a path you plan to fill and stroke. + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_fill_and_stroke( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Use current path for clipping. + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_clip( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Set line width to draw fill patterns. + The pattern line width should be in range 0 to 2bp, + default is 0.9bp. + @param pppt Output structure. + @param plw New pattern line width in bp. +*/ +void +dk4pppt_set_pattern_line_width( + dk4_pppt_t *pppt, + double plw +); + +/** Pattern a region (clipping should be set to the path). + @param pppt Output structure. + @param xl Left y coordinate. + @param xr Right x coordinate. + @param yb Bottom y coordinate. + @param yt Top y coordinate. + @param pn Pattern number. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_pattern( + dk4_pppt_t *pppt, + double xl, + double xr, + double yb, + double yt, + dk4_gra_pattern_t pn, + int *backptr, + dk4_er_t *erp +); + +/** Start a new path and move to first point. + @param pppt Output structure. + @param x X coordinate of start point. + @param y Y coordinate of start point. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_newpath_moveto( + dk4_pppt_t *pppt, + double x, + double y, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Add line from current point to new point to path. + @param pppt Output structure. + @param x X coordinate of new point. + @param y Y coordinate of new point. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_lineto( + dk4_pppt_t *pppt, + double x, + double y, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Add Bezier curve segment from current point to new point in path. + @param pppt Output structure. + @param xc1 X coordinate of first control point. + @param yc1 Y coordinate of first control point. + @param xc2 X coordinate of second control point. + @param yc2 Y coordinate of second control point. + @param x X coordinate of new point. + @param y Y coordinate of new point. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_curveto( + dk4_pppt_t *pppt, + double xc1, + double yc1, + double xc2, + double yc2, + double x, + double y, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Close current path. + @param pppt Output structure. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_closepath( + dk4_pppt_t *pppt, + int *backptr, + dk4_er_t *erp +); + +/** Add bitmap image XFig style. + @param pppt Output structure. + @param xl Left x coordinate. + @param xr Right x coordinate. + @param yb Bottom y coordinate. + @param yt Top y coordinate. + @param bif Bitmap image file. + @param fn Image file name. + @param fno Frame number (0 for first frame). + @param pos Image positioning: + - 0 not rotated, not flipped, + - 1 rotated 90 degree counterclockwise, not flipped, + - 2 rotated 180 degree counterclockwise, not flipped, + - 3 rotated 270 degree counterclockwise, not flipped, + - 4 not rotated, flipped, + - 5 rotated 90 degree counterclockwise, flipped, + - 6 rotated 180 degree counterclockwise, flipped, + - 7 rotated 270 degree counterclockwise, flipped. + @param ifl Image flags. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL or bif is NULL or a frame number other than 0 + was specified for PGF output, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_bif_fig_image( + dk4_pppt_t *pppt, + double xl, + double xr, + double yb, + double yt, + dk4_bif_t *bif, + const dkChar *fn, + size_t fno, + int pos, + int ifl, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Add bitmap image. + @param pppt Output structure. + @param xl Left x coordinate. + @param xr Right x coordinate. + @param yb Bottom y coordinate. + @param yt Top y coordinate. + @param bif Bitmap image file data. + @param fn Image file name. + @param fno Frame number (0 for first frame). + @param ifl Image flags. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL or bif is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_bif_image( + dk4_pppt_t *pppt, + double xl, + double xr, + double yb, + double yt, + dk4_bif_t *bif, + const dkChar *fn, + size_t fno, + int ifl, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Add bitmap image. + @param pppt Output structure. + @param xl Left x coordinate. + @param xr Right x coordinate. + @param yb Bottom y coordinate. + @param yt Top y coordinate. + @param fn Image file name. + @param fno Frame number (0 for first frame). + @param ctx Bitmap image conversion context, may be NULL. + @param ifl Image flags. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL or bif is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_image( + dk4_pppt_t *pppt, + double xl, + double xr, + double yb, + double yt, + const dkChar *fn, + size_t fno, + dk4_cs_conv_ctx_t *ctx, + int ifl, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Add bitmap image XFig style. + @param pppt Output structure. + @param xl Left x coordinate. + @param xr Right x coordinate. + @param yb Bottom y coordinate. + @param yt Top y coordinate. + @param fn Image file name. + @param fno Frame number (0 for first frame). + @param ctx Bitmap image conversion context, may be NULL. + @param pos Image positioning: + - 0 not rotated, not flipped, + - 1 rotated 90 degree counterclockwise, not flipped, + - 2 rotated 180 degree counterclockwise, not flipped, + - 3 rotated 270 degree counterclockwise, not flipped, + - 4 not rotated, flipped, + - 5 rotated 90 degree counterclockwise, flipped, + - 6 rotated 180 degree counterclockwise, flipped, + - 7 rotated 270 degree counterclockwise, flipped. + @param ifl Image flags. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL or bif is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_fig_image( + dk4_pppt_t *pppt, + double xl, + double xr, + double yb, + double yt, + const dkChar *fn, + size_t fno, + dk4_cs_conv_ctx_t *ctx, + int pos, + int ifl, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Create path for a circle. + @param pppt Output structure. + @param xc Center point x coordinate. + @param yc Center point y coordinate. + @param r Radius. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_circle( + dk4_pppt_t *pppt, + double xc, + double yc, + double r, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Create path for rectangle parallel to axes, optionally with + rounded corners. + @param pppt Output structure. + @param xl Left x coordinate. + @param xr Right x coordinate. + @param yb Bottom y coordinate. + @param yt Top y coordinate. + @param r Corner radius, maximum is a half of the smaller side length. + Use negative values to avoid rounded corners. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_rectangle( + dk4_pppt_t *pppt, + double xl, + double xr, + double yb, + double yt, + double r, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Add path for an arc. + @param pppt Output structure. + @param xc Center point x coordinate. + @param yc Center point y coordinate. + @param ra Radius. + @param start Start angle in degree. + @param end End angle in degree. + @param cl Flag: Draw closed arc (piece of cake) instead of simple arc. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_arc( + dk4_pppt_t *pppt, + double xc, + double yc, + double ra, + double start, + double end, + int cl, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Create path for an ellipse. + @param pppt Output structure. + @param xc Center point x coordinate. + @param yc Center point y coordinate. + @param rx Radius in x direction. + @param ry Radius in y direction. + @param rot Rotation counterclockwise in degree. + @param bbptr Bounding box, may be NULL. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_ellipse( + dk4_pppt_t *pppt, + double xc, + double yc, + double rx, + double ry, + double rot, + dk4_bb_t *bbptr, + int *backptr, + dk4_er_t *erp +); + +/** Add simple (non-special) text to PGF graphics. + The text is shown in the current fill color (non-stroking color) + unless colspec is used to specify a color. + @param pppt Output structure, must be initialized for PGF. + @param x X coordinate. + @param y Y coordinate. + @param rot Rotation counterclockwise in degree. + @param txt Text to show. + @param colspec Color specification, may be NULL to use fill color. + @param ie Text encoding, only used for char text. + @param ha Horizontal alignment. + @param va Vertical alignment. + @param fno Font number. + @param fsz Font size in pt. + @param fex Flag: Use exact font (1) or similar font (0). + @param uc2l UC to LaTeX conversion structure. + @param flags Text flags DK4_GRA_TEXT_FLAG_xxx, can be or-combined. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_simple_text( + dk4_pppt_t *pppt, + double x, + double y, + double rot, + const dkChar *txt, + const char *colspec, + int ie, + dk4_text_align_h_t ha, + dk4_text_align_v_t va, + int fno, + double fsz, + dk4_gra_tf_t fex, + dk4_uc2l_t *uc2l, + int flags, + int *backptr, + dk4_er_t *erp +); + + +/** Add simple (non-special) text to PGF graphics. + The text is shown in the current fill color (non-stroking color) + unless colspec is used to specify a color. + @param pppt Output structure, must be initialized for PGF. + @param x X coordinate. + @param y Y coordinate. + @param rot Rotation counterclockwise in degree. + @param txt Text to show. + @param colspec Color specification, may be NULL to use fill color. + @param ha Horizontal alignment. + @param va Vertical alignment. + @param fno Font number. + @param fsz Font size in pt. + @param fex Flag: Use exact font (1) or similar font (0). + @param uc2l UC to LaTeX conversion structure. + @param flags Text flags DK4_GRA_TEXT_FLAG_xxx, can be or-combined. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_simple_utf8_text( + dk4_pppt_t *pppt, + double x, + double y, + double rot, + const char *txt, + const char *colspec, + dk4_text_align_h_t ha, + dk4_text_align_v_t va, + int fno, + double fsz, + dk4_gra_tf_t fex, + dk4_uc2l_t *uc2l, + int flags, + int *backptr, + dk4_er_t *erp +); + + +/** Add special text to PGF graphics. + The text is shown in the current fill color (non-stroking color) + unless colspec is used to specify a color. + @param pppt Output structure, must be initialized for PGF. + @param x X coordinate. + @param y Y coordinate. + @param rot Rotation counterclockwise in degree. + @param txt Text to show. + @param colspec Color specification, may be NULL to use fill color. + @param ha Horizontal alignment. + @param va Vertical alignment. + @param fno Font number. + @param fsz Font size in pt. + @param fex Flag: Use exact font. + @param flags Text flags DK4_GRA_TEXT_FLAG_xxx, can be or-combined. + @param backptr Address of success variable to reset on errors. + @param erp Error report, may be NULL. + + Error codes: + - DK4_E_INVALID_ARGUMENTS<br> + if gra is NULL, + - DK4_E_INVALID_ARGUMENTS<br> + if gra is not in a state allowing this operation, + - DK4_E_MATH_OVERFLOW<br> + on numeric overflow in memory size calculation, + - DK4_E_MEMORY_ALLOCATION_FAILED<br> + if there is not enough memory available, + - DK4_E_WRITE_FAILED<br> + if writing one ore multiple bytes to the stream failed, + - DK4_E_FLUSH_FAILED<br> + if flushing data downwards failed. +*/ +void +dk4pppt_special_text( + dk4_pppt_t *pppt, + double x, + double y, + double rot, + const char *txt, + const char *colspec, + dk4_text_align_h_t ha, + dk4_text_align_v_t va, + int fno, + double fsz, + dk4_gra_tf_t fex, + int flags, + int *backptr, + dk4_er_t *erp +); + + +/** Set flag for even-odd-rule. + If this flag is on, the even-odd-rule is used for filling and + clipping. Otherwise the nonzero-winding rule is used. + By default this flag is turned on when creating a dk4_gra_t structure. + @param pppt Output structure. + @param val New flag value. +*/ +void +dk4pppt_set_eorule( + dk4_pppt_t *pppt, + int val +); + + +/** Set document font size. + @param pppt Output structure. + @param fs New font size. + @param backptr Address of success variable to reset on error. + @param erp Error report, may be NULL. +*/ + +void +dk4pppt_doc_font_size( + dk4_pppt_t *pppt, + double fs, + int *backptr, + dk4_er_t *erp +); + + +/** Add one preamble line. + @param pppt Output structure. + @param line Line to add without trailing newline. + @param tp Preamble line type. + @param backptr Address of success variable to reset on error. + @param erp Error report, may be NULL. +*/ + +void +dk4pppt_doc_preamble_line( + dk4_pppt_t *pppt, + const char *line, + int tp, + int *backptr, + dk4_er_t *erp +); + + + +#ifdef __cplusplus +} +#endif + + +/* vim: set ai sw=4 ts=4 : */ + + +#endif |