- Main Page
- Modules
- Data Structures
- Files

# hpgs.h

Go to the documentation of this file.

    00001 /***********************************************************************
    00002  *                                                                     *
    00003  * $Id: hpgs.h 489 2009-02-11 14:10:30Z softadm $
    00004  *                                                                     *
    00005  * hpgs - HPGl Script, a hpgl/2 interpreter, which uses a Postscript   *
    00006  *        API for rendering a scene and thus renders to a variety of   *
    00007  *        devices and fileformats.                                     *
    00008  *                                                                     *
    00009  * (C) 2004-2009 ev-i Informationstechnologie GmbH  http://www.ev-i.at *
    00010  *                                                                     *
    00011  * Author: Wolfgang Glas                                               *
    00012  *                                                                     *
    00013  *  hpgs is free software; you can redistribute it and/or              *
    00014  * modify it under the terms of the GNU Lesser General Public          *
    00015  * License as published by the Free Software Foundation; either        *
    00016  * version 2.1 of the License, or (at your option) any later version.  *
    00017  *                                                                     *
    00018  * hpgs is distributed in the hope that it will be useful,             *
    00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of      *
    00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   *
    00021  * Lesser General Public License for more details.                     *
    00022  *                                                                     *
    00023  * You should have received a copy of the GNU Lesser General Public    *
    00024  * License along with this library; if not, write to the               *
    00025  * Free Software  Foundation, Inc., 59 Temple Place, Suite 330,        *
    00026  * Boston, MA  02111-1307  USA                                         *
    00027  *                                                                     *
    00028  ***********************************************************************
    00029  *                                                                     *
    00030  * The public interfaces, which have to be known to all components.    *
    00031  *                                                                     *
    00032  ***********************************************************************/
    00033
    00034 #ifndef __HPGS_H
    00035 #define __HPGS_H
    00036
    00037 #include<stdio.h>
    00038 #include<stdarg.h>
    00039 #include<stdlib.h>
    00040
    00041 #ifdef __cplusplus
    00042 extern "C" {
    00043 #endif
    00044
    00045 #ifndef __GNUC__
    00046 #ifdef _MSC_VER
    00047 #define __inline__ __inline
    00048 #else
    00049 #define __inline__ inline
    00050 #endif
    00051 #endif
    00052
    00053 /* All this is needed in order to set the right attributes for functions.
    00054    This allows us to build fully compliant dlls under Windows and to
    00055    hide functions needed for the implementation of the API in
    00056    ELF modules. Additionally, we make use of the 'format' attribute of
    00057    gcc in order to get the most out of -Wall.
    00058  */
    00059 #ifdef HPGS_SHARED
    00060 # ifdef WIN32
    00061 #  ifdef __GNUC__
    00062 #   ifdef HPGS_BUILD_SLIB
    00063 #    define HPGS_API __attribute__((dllexport))
    00064 #    define HPGS_PRINTF_API(i) __attribute__((dllexport,format(printf,i,i+1)))
    00065 #    define HPGS_I18N_API __attribute__((dllexport,format_arg (1)))
    00066 #    define HPGS_I18N_N_API __attribute__((dllexport,format_arg (1),format_arg (2)))
    00067 #   else
    00068 #    define HPGS_API __attribute__((dllimport))
    00069 #    define HPGS_PRINTF_API(i) __attribute__((dllimport,format(printf,i,i+1)))
    00070 #    define HPGS_I18N_API __attribute__((dllimport,format_arg (1)))
    00071 #    define HPGS_I18N_N_API __attribute__((dllimport,format_arg (1),format_arg (2)))
    00072 #   endif
    00073 #   define HPGS_INTERNAL_PRINTF_API(i) __attribute__((format(printf,i,i+1)))
    00074 #  else
    00075 #   ifdef HPGS_BUILD_SLIB
    00076 #    define HPGS_API __declspec(dllexport)
    00077 #   else
    00078 #    define HPGS_API __declspec(dllimport)
    00079 #   endif
    00080 #  endif
    00081 # else
    00082 #  ifdef __GNUC__
    00083 #   define HPGS_PRINTF_API(i) __attribute__((format(printf,i,i+1)))
    00084 #   define HPGS_I18N_API __attribute__((format_arg (1)))
    00085 #   define HPGS_I18N_N_API __attribute__((format_arg (1),format_arg (2)))
    00086 #   define HPGS_INTERNAL_API __attribute__((visibility("hidden")))
    00087 #   define HPGS_INTERNAL_PRINTF_API(i) __attribute__((visibility("hidden"),format(printf,i,i+1)))
    00088 #  endif
    00089 # endif
    00090 #endif
    00091
    00092 #ifndef HPGS_API
    00093 #define HPGS_API
    00094 #endif
    00095 #ifndef HPGS_PRINTF_API
    00096 #define HPGS_PRINTF_API(i) HPGS_API
    00097 #endif
    00098 #ifndef HPGS_I18N_API
    00099 #define HPGS_I18N_API HPGS_API
    00100 #endif
    00101 #ifndef HPGS_I18N_N_API
    00102 #define HPGS_I18N_N_API HPGS_API
    00103 #endif
    00104 #ifndef HPGS_INTERNAL_API
    00105 #define HPGS_INTERNAL_API
    00106 #endif
    00107 #ifndef HPGS_INTERNAL_PRINTF_API
    00108 #define HPGS_INTERNAL_PRINTF_API(i) HPGS_INTERNAL_API
    00109 #endif
    00110
    00111 /* These defines are used in order to allow better doxygen integration
    00112    of the printf API functions. */
    00113 #define HPGS_PRINTF1_API HPGS_PRINTF_API(1)
    00114 #define HPGS_PRINTF2_API HPGS_PRINTF_API(2)
    00115 #define HPGS_INTERNAL_PRINTF1_API HPGS_INTERNAL_PRINTF_API(1)
    00116 #define HPGS_INTERNAL_PRINTF2_API HPGS_INTERNAL_PRINTF_API(2)
    00117
    00118 #ifdef WIN32
    00119 #define HPGS_SIZE_T_FMT "%lu"
    00120 #else
    00121 #define HPGS_SIZE_T_FMT "%zu"
    00122 #endif
    00123
    00134 #define HPGS_STRINGIFYIFY(i) #i
    00135 #define HPGS_STRINGIFY(i) HPGS_STRINGIFYIFY(i)
    00136
    00137 #define HPGS_MAJOR_VERSION 1
    00138 #define HPGS_MINOR_VERSION 1
    00139 #define HPGS_PATCH_VERSION 5
    00140 #define HPGS_EXTRA_VERSION
    00141
    00142 // a string for displaying the version.
    00143 #define HPGS_VERSION HPGS_STRINGIFY(HPGS_MAJOR_VERSION) "." HPGS_STRINGIFY(HPGS_MINOR_VERSION) "." HPGS_STRINGIFY(HPGS_PATCH_VERSION) HPGS_STRINGIFY(HPGS_EXTRA_VERSION)
    00144
    00145 #define HPGS_ESC '\033'
    00146
    00147 #define HPGS_MAX_LABEL_SIZE 256
    00148
    00149 #define hpgs_alloca(sz) alloca(sz)
    00150
    00154 typedef int hpgs_bool;
    00155
    00156 #define HPGS_TRUE 1
    00157 #define HPGS_FALSE 0
    00158
    00159 HPGS_API int hpgs_array_safe_resize (size_t itemsz, void **pptr, size_t *psz, size_t nsz);
    00160
    00161 #define HPGS_MIN(a,b) ((a)<(b)?(a):(b))
    00162 #define HPGS_MAX(a,b) ((a)>(b)?(a):(b))
    00163
    00164 #define HPGS_INIT_ARRAY(st,type,pmemb,nmemb,szmemb,insz) \
    00165 (st->szmemb=insz,st->nmemb=0,(st->pmemb=(type*)malloc(sizeof(type)*insz))?0:-1)
    00166
    00167 #define HPGS_GROW_ARRAY_FOR_PUSH(st,type,pmemb,nmemb,szmemb) \
    00168 ((st->nmemb >= st->szmemb)?hpgs_array_safe_resize(sizeof(type),(void **)(&st->pmemb),&st->szmemb,st->szmemb*2):(0))
    00169
    00170 #define HPGS_GROW_ARRAY_MIN_SIZE(st,type,pmemb,nmemb,szmemb,msz) \
    00171 ((st->nmemb>=st->szmemb||st->szmemb<msz)?hpgs_array_safe_resize(sizeof(type),(void **)(&st->pmemb),&st->szmemb,HPGS_MAX(st->szmemb*2,msz)):(0))
    00172
    00173 #ifdef WIN32
    00174 #define HPGS_PATH_SEPARATOR '\\'
    00175 #else
    00176 #define HPGS_PATH_SEPARATOR '/'
    00177 #endif
    00178
    00179 HPGS_API void hpgs_init (const char *prefix);
    00180 HPGS_API const char *hpgs_get_prefix();
    00181 HPGS_API void hpgs_cleanup (void);
    00182 HPGS_API char *hpgs_share_filename(const char *rel_filename);
    00183
    00184 HPGS_API char *hpgs_vsprintf_malloc(const char *fmt, va_list ap);
    00185 HPGS_PRINTF1_API char *hpgs_sprintf_malloc(const char *fmt, ...);
    00186
    00187 HPGS_PRINTF1_API int hpgs_set_error(const char *fmt, ...);
    00188 HPGS_PRINTF1_API int hpgs_error_ctxt(const char *fmt, ...);
    00189 HPGS_API int hpgs_set_verror(const char *fmt, va_list ap);
    00190 HPGS_API int hpgs_verror_ctxt(const char *fmt, va_list ap);
    00191 HPGS_API const char *hpgs_get_error();
    00192 HPGS_API hpgs_bool hpgs_have_error();
    00193 HPGS_API void hpgs_clear_error();
    00194
    00195 HPGS_API int hpgs_next_utf8(const char **p);
    00196 HPGS_API int hpgs_utf8_strlen(const char *p, int n);
    00197
    00198 HPGS_I18N_API const char *hpgs_i18n(const char *msg);
    00199 HPGS_I18N_N_API const char *hpgs_i18n_n(const char *msg,
    00200                                         const char *msg_plural,
    00201                                         unsigned long n);
    00202
    00203 typedef void (*hpgs_logger_func_t) (const char *fmt, va_list ap);
    00204 HPGS_API void hpgs_set_logger(hpgs_logger_func_t func);
    00205 HPGS_PRINTF1_API void hpgs_log(const char *fmt, ...);
    00206 HPGS_API void hpgs_vlog(const char *fmt, va_list ap);
    00207
    00208 HPGS_API hpgs_bool hpgs_get_arg_value(const char *opt, const char *argv[],
    00209                                       const char **value, int *narg);
    00210
    00217 typedef struct hpgs_point_st {
    00218     double x, y;
    00219 } hpgs_point;
    00220
    00228 typedef struct hpgs_color_st {
    00229   double r, g, b;
    00230 } hpgs_color;
    00231
    00232 typedef struct hpgs_palette_color_st hpgs_palette_color;
    00233
    00240 struct hpgs_palette_color_st
    00241 {
    00242   unsigned char r;
    00243   unsigned char g;
    00244   unsigned char b;
    00245 };
    00246
    00247 typedef void (*hpgs_rop3_func_t) (unsigned char *, unsigned char, unsigned char);
    00248
    00249 HPGS_API hpgs_rop3_func_t hpgs_rop3_func(int rop3,
    00250                                          hpgs_bool src_transparency,
    00251                                          hpgs_bool pattern_transparency);
    00252
    00253 typedef unsigned (*hpgs_xrop3_func_t) (unsigned char, unsigned char);
    00254
    00255 HPGS_API hpgs_xrop3_func_t hpgs_xrop3_func(int rop3,
    00256                                            hpgs_bool src_transparency,
    00257                                            hpgs_bool pattern_transparency);
    00258
    00259 typedef struct hpgs_paint_color_st hpgs_paint_color;
    00260
    00272 struct hpgs_paint_color_st
    00273 {
    00274   unsigned char r;
    00275   unsigned char g;
    00276   unsigned char b;
    00277   unsigned char index;
    00278 };
    00279
    00280 typedef struct hpgs_bbox_st hpgs_bbox;
    00281
    00286 struct hpgs_bbox_st
    00287 {
    00288   double llx;
    00289   double lly;
    00290   double urx;
    00291   double ury;
    00292 };
    00293
    00294 HPGS_API hpgs_bool hpgs_bbox_isequal(const hpgs_bbox *bb1, const hpgs_bbox *bb2);
    00295 HPGS_API hpgs_bool hpgs_bbox_isnull (const hpgs_bbox *bb);
    00296 HPGS_API hpgs_bool hpgs_bbox_isempty (const hpgs_bbox *bb);
    00297 HPGS_API void hpgs_bbox_distance  (hpgs_point *d, const hpgs_bbox *bb1, const hpgs_bbox *bb2);
    00298 HPGS_API void hpgs_bbox_null      (hpgs_bbox *bb);
    00299 HPGS_API void hpgs_bbox_expand    (hpgs_bbox *bb1, const hpgs_bbox *bb2);
    00300 HPGS_API void hpgs_bbox_intersect (hpgs_bbox *bb1, const hpgs_bbox *bb2);
    00302 static void hpgs_bbox_addborder (hpgs_bbox *bb, double border);
    00305 static void hpgs_bbox_add (hpgs_bbox *bb, const hpgs_point *p);
    00306
    00307 __inline__ void hpgs_bbox_addborder (hpgs_bbox *bb, double border)
    00308 {
    00309   bb->llx -= border;
    00310   bb->urx += border;
    00311   bb->lly -= border;
    00312   bb->ury += border;
    00313 }
    00314
    00315 __inline__ void hpgs_bbox_add (hpgs_bbox *bb, const hpgs_point *p)
    00316 {
    00317   if (p->x < bb->llx) bb->llx = p->x;
    00318   if (p->x > bb->urx) bb->urx = p->x;
    00319   if (p->y < bb->lly) bb->lly = p->y;
    00320   if (p->y > bb->ury) bb->ury = p->y;
    00321 }
    00322
    00323 typedef struct hpgs_matrix_st hpgs_matrix;
    00324
    00330 struct hpgs_matrix_st
    00331 {
    00332   double dx;
    00333   double dy;
    00334   double mxx;
    00335   double mxy;
    00336   double myx;
    00337   double myy;
    00338 };
    00339
    00340 HPGS_API void hpgs_matrix_set_identity(hpgs_matrix *m);
    00341
    00342 HPGS_API void hpgs_matrix_xform(hpgs_point *res,
    00343                                 const hpgs_matrix *m, const hpgs_point *p);
    00344 HPGS_API void hpgs_matrix_ixform(hpgs_point *res,
    00345                                  const hpgs_point *p, const hpgs_matrix *m);
    00346 HPGS_API void hpgs_matrix_scale(hpgs_point *res,
    00347                                 const hpgs_matrix *m, const hpgs_point *p);
    00348 HPGS_API void hpgs_matrix_iscale(hpgs_point *res,
    00349                                  const hpgs_point *p, const hpgs_matrix *m);
    00350 HPGS_API void hpgs_matrix_concat(hpgs_matrix *res,
    00351                                  const hpgs_matrix *a, const hpgs_matrix *b);
    00352 HPGS_API void hpgs_matrix_invert(hpgs_matrix *res, const hpgs_matrix *m);
    00353
    00354 HPGS_API void hpgs_matrix_xform_bbox(hpgs_bbox *res,
    00355                                      const hpgs_matrix *m, const hpgs_bbox *bb);
    00356 HPGS_API void hpgs_matrix_ixform_bbox(hpgs_bbox *res,
    00357                                       const hpgs_bbox *bb, const hpgs_matrix *m);
    00358
    00360 typedef enum {
    00361   hpgs_cap_butt = 0,
    00362   hpgs_cap_round = 1,
    00363   hpgs_cap_square = 2
    00364 } hpgs_line_cap;
    00365
    00367 typedef enum {
    00368     hpgs_join_miter = 0,
    00369     hpgs_join_round = 1,
    00370     hpgs_join_bevel = 2
    00371 } hpgs_line_join;
    00372
    00373 // input stream
    00374 typedef struct hpgs_istream_st hpgs_istream;
    00375 typedef struct hpgs_istream_vtable_st hpgs_istream_vtable;
    00376
    00377 typedef int  (*hpgs_istream_getc_func_t)(void *);
    00378 typedef int  (*hpgs_istream_ungetc_func_t)(int ,void *);
    00379 typedef int  (*hpgs_istream_close_func_t)(void *);
    00380 typedef int  (*hpgs_istream_iseof_func_t)(void *);
    00381 typedef int  (*hpgs_istream_iserror_func_t)(void *);
    00382 typedef int  (*hpgs_istream_seek_func_t)(void *, size_t);
    00383 typedef int  (*hpgs_istream_tell_func_t)(void *, size_t*);
    00384 typedef size_t (*hpgs_istream_read_func_t)(void *, size_t, size_t, void *);
    00385 typedef int (*hpgs_istream_seekend_func_t)(void *, size_t);
    00386
    00396 struct hpgs_istream_vtable_st
    00397 {
    00398   hpgs_istream_getc_func_t    getc_func;
    00399   hpgs_istream_ungetc_func_t  ungetc_func;
    00400   hpgs_istream_close_func_t   close_func;
    00401   hpgs_istream_iseof_func_t   iseof_func;
    00402   hpgs_istream_iserror_func_t iserror_func;
    00403   hpgs_istream_seek_func_t    seek_func;
    00404   hpgs_istream_tell_func_t    tell_func;
    00405   hpgs_istream_read_func_t    read_func;
    00406   hpgs_istream_seekend_func_t seekend_func;
    00407 };
    00408
    00416 struct hpgs_istream_st
    00417 {
    00418   hpgs_istream_vtable *vtable;
    00419
    00420   void *stream;
    00421 };
    00422
    00423 HPGS_API hpgs_istream *hpgs_new_file_istream (const char *fn);
    00424 HPGS_API hpgs_istream *hpgs_new_mem_istream (const unsigned char *data,
    00425                                              size_t data_size,
    00426                                              hpgs_bool dup);
    00427
    00428
    00430 static int  hpgs_getc   (hpgs_istream *_this);
    00432 static int  hpgs_ungetc (int c, hpgs_istream *_this);
    00435 static int  hpgs_istream_close  (hpgs_istream *_this);
    00437 static int  hpgs_istream_iseof  (hpgs_istream *_this);
    00439 static int  hpgs_istream_iserror(hpgs_istream *_this);
    00441 static int hpgs_istream_seek (hpgs_istream *_this, size_t pos);
    00443 static int hpgs_istream_seekend (hpgs_istream *_this, size_t pos);
    00445 static int hpgs_istream_tell   (hpgs_istream *_this, size_t *pos);
    00447 static size_t hpgs_istream_read (void *ptr, size_t size, size_t nmemb, hpgs_istream *_this);
    00448
    00449 __inline__ int hpgs_getc   (hpgs_istream *_this)
    00450 { return _this->vtable->getc_func(_this->stream); }
    00451
    00452 __inline__ int hpgs_ungetc (int c, hpgs_istream *_this)
    00453 { return _this->vtable->ungetc_func(c,_this->stream); }
    00454
    00455 __inline__ int hpgs_istream_close (hpgs_istream *_this)
    00456 { int ret = _this->vtable->close_func(_this->stream); free(_this); return ret; }
    00457
    00458 __inline__ int hpgs_istream_iseof (hpgs_istream *_this)
    00459 { return _this->vtable->iseof_func(_this->stream); }
    00460
    00461 __inline__ int hpgs_istream_iserror (hpgs_istream *_this)
    00462 { return _this->vtable->iserror_func(_this->stream); }
    00463
    00464 __inline__ int hpgs_istream_seek (hpgs_istream *_this, size_t pos)
    00465 { return _this->vtable->seek_func(_this->stream,pos); }
    00466
    00467 __inline__ int hpgs_istream_seekend (hpgs_istream *_this, size_t pos)
    00468 { return _this->vtable->seekend_func(_this->stream,pos); }
    00469
    00470 __inline__ int hpgs_istream_tell   (hpgs_istream *_this, size_t *pos)
    00471 { return _this->vtable->tell_func(_this->stream,pos); }
    00472
    00473 __inline__ size_t hpgs_istream_read (void *ptr, size_t size, size_t nmemb, hpgs_istream *_this)
    00474 { return _this->vtable->read_func(ptr,size,nmemb,_this->stream); }
    00475
    00476 // output stream
    00477 typedef struct hpgs_ostream_st hpgs_ostream;
    00478 typedef struct hpgs_ostream_vtable_st hpgs_ostream_vtable;
    00479
    00480 typedef int  (*hpgs_ostream_putc_func_t)(int, void *);
    00481 typedef size_t (*hpgs_ostream_write_func_t)(const void *, size_t, size_t, void *);
    00482 typedef int  (*hpgs_ostream_vprintf_func_t)(void *, const char *, va_list);
    00483 typedef int  (*hpgs_ostream_flush_func_t)(void *);
    00484 typedef int  (*hpgs_ostream_close_func_t)(void *);
    00485 typedef int  (*hpgs_ostream_iserror_func_t)(void *);
    00486 typedef hpgs_istream *(*hpgs_ostream_getbuf_func_t)(void *);
    00487 typedef int  (*hpgs_ostream_tell_func_t)(void *, int layer, size_t *);
    00488 typedef int  (*hpgs_ostream_seek_func_t)(void *, size_t);
    00489
    00499 struct hpgs_ostream_vtable_st
    00500 {
    00501   hpgs_ostream_putc_func_t    putc_func;
    00502   hpgs_ostream_write_func_t   write_func;
    00503   hpgs_ostream_vprintf_func_t vprintf_func;
    00504   hpgs_ostream_flush_func_t   flush_func;
    00505   hpgs_ostream_close_func_t   close_func;
    00506   hpgs_ostream_iserror_func_t iserror_func;
    00507   hpgs_ostream_getbuf_func_t  getbuf_func;
    00508   hpgs_ostream_tell_func_t    tell_func;
    00509   hpgs_ostream_seek_func_t    seek_func;
    00510 };
    00511
    00519 struct hpgs_ostream_st
    00520 {
    00521   hpgs_ostream_vtable *vtable;
    00522
    00523   void *stream;
    00524 };
    00525
    00526 HPGS_API hpgs_ostream *hpgs_new_file_ostream (const char *fn);
    00527 HPGS_API hpgs_ostream *hpgs_new_mem_ostream (size_t data_reserve);
    00528 HPGS_API hpgs_ostream *hpgs_new_z_ostream (hpgs_ostream *base, int compression, hpgs_bool take_base);
    00529
    00530 HPGS_API int hpgs_copy_streams (hpgs_ostream *out, hpgs_istream *in);
    00531
    00532 HPGS_PRINTF2_API int  hpgs_ostream_printf (hpgs_ostream *_this, const char *msg, ...);
    00533 HPGS_API int hpgs_ostream_vprintf (hpgs_ostream *_this, const char *msg, va_list ap);
    00534
    00536 static int  hpgs_ostream_putc (int c, hpgs_ostream *_this);
    00538 static size_t hpgs_ostream_write (const void *ptr, size_t size, size_t nmemb, hpgs_ostream *_this);
    00540 static int  hpgs_ostream_flush (hpgs_ostream *_this);
    00543 static int  hpgs_ostream_close (hpgs_ostream *_this);
    00545 static int  hpgs_ostream_iserror(hpgs_ostream *_this);
    00548 static hpgs_istream *hpgs_ostream_getbuf(hpgs_ostream *_this);
    00550 static int hpgs_ostream_tell(hpgs_ostream *_this, int layer, size_t *pos);
    00552 static int hpgs_ostream_seek (hpgs_ostream *_this, size_t pos);
    00553
    00554 __inline__ int hpgs_ostream_putc (int c, hpgs_ostream *_this)
    00555 { return _this->vtable->putc_func(c,_this->stream); }
    00556
    00557 __inline__ size_t hpgs_ostream_write (const void *ptr, size_t size, size_t nmemb, hpgs_ostream *_this)
    00558 { return _this->vtable->write_func(ptr,size,nmemb,_this->stream); }
    00559
    00560 __inline__ int hpgs_ostream_flush (hpgs_ostream *_this)
    00561 { return _this->vtable->flush_func ?  _this->vtable->flush_func(_this->stream) : 0; }
    00562
    00563 __inline__ int hpgs_ostream_close (hpgs_ostream *_this)
    00564 { int ret = _this->vtable->close_func(_this->stream); free(_this); return ret; }
    00565
    00566 __inline__ int hpgs_ostream_iserror (hpgs_ostream *_this)
    00567 { return _this->vtable->iserror_func(_this->stream); }
    00568
    00569 __inline__ hpgs_istream *hpgs_ostream_getbuf (hpgs_ostream *_this)
    00570 { return _this->vtable->getbuf_func ? _this->vtable->getbuf_func(_this->stream) : 0; }
    00571
    00572 __inline__ int hpgs_ostream_tell(hpgs_ostream *_this, int layer, size_t *pos)
    00573 { return _this->vtable->tell_func ? _this->vtable->tell_func(_this->stream,layer,pos) : -1; }
    00574
    00575 __inline__ int hpgs_ostream_seek (hpgs_ostream *_this, size_t pos)
    00576 { return _this->vtable->seek_func ? _this->vtable->seek_func(_this->stream,pos) : -1; }
    00577
    00578 HPGS_API int hpgs_parse_papersize(const char *str, double *pt_width, double *pt_height);
    00579 HPGS_API int hpgs_parse_length(const char *str, double *pt_length);
    00580  /* end of group base */
    00582
    00586 typedef struct hpgs_device_st hpgs_device;
    00587 typedef struct hpgs_plotsize_device_st hpgs_plotsize_device;
    00588 typedef struct hpgs_eps_device_st hpgs_eps_device;
    00589 typedef struct hpgs_gs_device_st hpgs_gs_device;
    00590 typedef struct hpgs_device_vtable_st hpgs_device_vtable;
    00591 typedef struct hpgs_image_st hpgs_image;
    00592 typedef struct hpgs_image_vtable_st hpgs_image_vtable;
    00593 typedef struct hpgs_png_image_st hpgs_png_image;
    00594 typedef struct hpgs_paint_device_st hpgs_paint_device;
    00595 typedef struct hpgs_gstate_st     hpgs_gstate;
    00596 typedef struct hpgs_font_st       hpgs_font;
    00597
    00603 struct hpgs_gstate_st
    00604 {
    00605   hpgs_line_cap    line_cap;
    00606   hpgs_line_join   line_join;
    00607   hpgs_color       color;
    00608   double           miterlimit;
    00609   double           linewidth;
    00610
    00611   int rop3;
    00612   hpgs_bool src_transparency;
    00613   hpgs_bool pattern_transparency;
    00614
    00615   hpgs_color pattern_color;
    00616
    00617   int     n_dashes;
    00618   float  *dash_lengths;
    00619   double  dash_offset;
    00620 };
    00621
    00622 HPGS_API hpgs_gstate *hpgs_new_gstate(void);
    00623 HPGS_API void hpgs_gstate_destroy(hpgs_gstate *gstate);
    00624 HPGS_API int  hpgs_gstate_setdash(hpgs_gstate *gstate,
    00625                                   const float *, unsigned, double);
    00626
    00627
    00628 #define HPGS_DEVICE_CAP_RASTER        (1<<0)
    00629 #define HPGS_DEVICE_CAP_ANTIALIAS     (1<<1)
    00630 #define HPGS_DEVICE_CAP_VECTOR        (1<<2)
    00631 #define HPGS_DEVICE_CAP_MULTIPAGE     (1<<3)
    00632 #define HPGS_DEVICE_CAP_PAGECOLLATION (1<<4)
    00633 #define HPGS_DEVICE_CAP_MULTISIZE     (1<<5)
    00634 #define HPGS_DEVICE_CAP_DRAWIMAGE     (1<<6)
    00635 #define HPGS_DEVICE_CAP_NULLIMAGE     (1<<7)
    00636 #define HPGS_DEVICE_CAP_PLOTSIZE      (1<<8)
    00637 #define HPGS_DEVICE_CAP_ROP3          (1<<9)
    00638
    00639
    00648 struct hpgs_device_vtable_st {
    00649   const char * rtti;
    00650   int (*moveto)      (hpgs_device *_this, const hpgs_point *p);
    00651   int (*lineto)      (hpgs_device *_this, const hpgs_point *p);
    00652   int (*curveto)     (hpgs_device *_this, const hpgs_point *p1,
    00653                       const hpgs_point *p2, const hpgs_point *p3 );
    00654   int (*newpath)     (hpgs_device *_this);
    00655   int (*closepath)   (hpgs_device *_this);
    00656   int (*stroke)      (hpgs_device *_this);
    00657   int (*fill)        (hpgs_device *_this, hpgs_bool winding);
    00658   int (*clip)        (hpgs_device *_this, hpgs_bool winding);
    00659   int (*clipsave)    (hpgs_device *_this);
    00660   int (*cliprestore) (hpgs_device *_this);
    00661   int (*setrgbcolor) (hpgs_device *_this, const hpgs_color *rgb);
    00662   int (*setdash)     (hpgs_device *_this, const float *, unsigned, double);
    00663   int (*setlinewidth)(hpgs_device *_this, double);
    00664   int (*setlinecap)  (hpgs_device *_this, hpgs_line_cap);
    00665   int (*setlinejoin) (hpgs_device *_this, hpgs_line_join);
    00666   int (*setmiterlimit) (hpgs_device *_this, double l);
    00667   int (*setrop3)     (hpgs_device *_this, int rop,
    00668                       hpgs_bool src_transparency, hpgs_bool pattern_transparency);
    00669   int (*setpatcol)   (hpgs_device *_this, const hpgs_color *rgb);
    00670   int (*drawimage)   (hpgs_device *_this, const hpgs_image *img,
    00671                       const hpgs_point *ll, const hpgs_point *lr,
    00672                       const hpgs_point *ur);
    00673   int (*setplotsize) (hpgs_device *_this, const hpgs_bbox *bb);
    00674   int (*getplotsize) (hpgs_device *_this, int i, hpgs_bbox *bb);
    00675   int (*showpage)    (hpgs_device *_this, int i);
    00676   int (*finish)      (hpgs_device *_this);
    00677   int (*capabilities)(hpgs_device *_this);
    00678   void (*destroy)    (hpgs_device *_this);
    00679 };
    00680
    00689 struct hpgs_device_st {
    00690   hpgs_device_vtable *vtable;
    00691 };
    00692
    00693 #define HPGS_BASE_CLASS(d) (&(d->inherited))
    00694
    00695 HPGS_API hpgs_plotsize_device *hpgs_new_plotsize_device(hpgs_bool ignore_ps,
    00696                                                         hpgs_bool do_linewidth);
    00697
    00698 HPGS_API hpgs_eps_device *hpgs_new_eps_device(const char *filename,
    00699                                               const hpgs_bbox *bb,
    00700                                               hpgs_bool do_rop3  );
    00701
    00702 HPGS_API hpgs_eps_device *hpgs_new_ps_device(const char *filename,
    00703                                              const hpgs_bbox *bb,
    00704                                              hpgs_bool do_rop3);
    00705
    00706 typedef int (*hpgs_reader_asset_func_t)(void *, hpgs_device *,
    00707                                         const hpgs_matrix *,
    00708                                         const hpgs_matrix *,
    00709                                         const hpgs_bbox *, int);
    00710
    00711 HPGS_API int hpgs_new_plugin_device( hpgs_device **device,
    00712                                      void **page_asset_ctxt,
    00713                                      hpgs_reader_asset_func_t *page_asset_func,
    00714                                      void **frame_asset_ctxt,
    00715                                      hpgs_reader_asset_func_t *frame_asset_func,
    00716                                      const char *dev_name,
    00717                                      const char *filename,
    00718                                      const hpgs_bbox *bb,
    00719                                      double xres, double yres,
    00720                                      hpgs_bool do_rop3,
    00721                                      int argc, const char *argv[]);
    00722
    00723 HPGS_API const char *hpgs_device_rtti(hpgs_device *_this);
    00724
    00726 static int hpgs_moveto      (hpgs_device *_this, const hpgs_point *p);
    00728 static int hpgs_lineto      (hpgs_device *_this, const hpgs_point *p);
    00730 static int hpgs_curveto     (hpgs_device *_this, const hpgs_point *p1,
    00731                                  const hpgs_point *p2, const hpgs_point *p3 );
    00733 static int hpgs_closepath   (hpgs_device *_this);
    00735 static int hpgs_newpath     (hpgs_device *_this);
    00737 static int hpgs_stroke      (hpgs_device *_this);
    00740 static int hpgs_fill        (hpgs_device *_this, hpgs_bool winding);
    00743 static int hpgs_clip        (hpgs_device *_this, hpgs_bool winding);
    00746 static int hpgs_clipsave    (hpgs_device *_this);
    00748 static int hpgs_cliprestore (hpgs_device *_this);
    00750 static int hpgs_setrgbcolor (hpgs_device *_this, const hpgs_color *rgb);
    00752 static int hpgs_setdash     (hpgs_device *_this, const float *d,
    00753                                  unsigned nd, double s);
    00755 static int hpgs_setlinewidth(hpgs_device *_this, double w);
    00757 static int hpgs_setlinecap  (hpgs_device *_this, hpgs_line_cap c);
    00759 static int hpgs_setlinejoin (hpgs_device *_this, hpgs_line_join j);
    00761 static int hpgs_setmiterlimit (hpgs_device *_this, double l);
    00763 static int hpgs_device_capabilities (hpgs_device *_this);
    00764
    00765 HPGS_API int hpgs_setrop3 (hpgs_device *_this, int rop,
    00766                            hpgs_bool src_transparency, hpgs_bool pattern_transparency);
    00767 HPGS_API int hpgs_setpatcol (hpgs_device *_this, const hpgs_color *rgb);
    00768
    00769 HPGS_API int hpgs_drawimage(hpgs_device *_this, const hpgs_image *img,
    00770                             const hpgs_point *ll, const hpgs_point *lr,
    00771                             const hpgs_point *ur);
    00772
    00773 HPGS_API int hpgs_setplotsize (hpgs_device *_this, const hpgs_bbox *bb);
    00774 HPGS_API int hpgs_getplotsize (hpgs_device *_this, int i, hpgs_bbox *bb);
    00775 HPGS_API int hpgs_showpage    (hpgs_device *_this, int i);
    00776 HPGS_API int hpgs_device_finish   (hpgs_device *_this);
    00777 HPGS_API void hpgs_device_destroy (hpgs_device *_this);
    00778
    00779 __inline__ int hpgs_moveto      (hpgs_device *_this, const hpgs_point *p)
    00780 { return _this->vtable->moveto(_this,p); }
    00781
    00782 __inline__ int hpgs_lineto      (hpgs_device *_this, const hpgs_point *p)
    00783 { return _this->vtable->lineto(_this,p); }
    00784
    00785 __inline__ int hpgs_curveto     (hpgs_device *_this, const hpgs_point *p1,
    00786                              const hpgs_point *p2, const hpgs_point *p3 )
    00787 { return _this->vtable->curveto(_this,p1,p2,p3); }
    00788
    00789 __inline__ int hpgs_closepath   (hpgs_device *_this)
    00790 { return _this->vtable->closepath(_this); }
    00791
    00792 __inline__ int hpgs_newpath   (hpgs_device *_this)
    00793 { return _this->vtable->newpath(_this); }
    00794
    00795 __inline__ int hpgs_stroke      (hpgs_device *_this)
    00796 { return _this->vtable->stroke(_this); }
    00797
    00798 __inline__ int hpgs_fill        (hpgs_device *_this, hpgs_bool winding)
    00799 { return _this->vtable->fill(_this,winding); }
    00800
    00801 __inline__ int hpgs_clip        (hpgs_device *_this, hpgs_bool winding)
    00802 { return _this->vtable->clip(_this,winding); }
    00803
    00804 __inline__ int hpgs_clipsave    (hpgs_device *_this)
    00805 { return _this->vtable->clipsave(_this); }
    00806
    00807 __inline__ int hpgs_cliprestore    (hpgs_device *_this)
    00808 { return _this->vtable->cliprestore(_this); }
    00809
    00810 __inline__ int hpgs_setrgbcolor (hpgs_device *_this, const hpgs_color *rgb)
    00811 { return _this->vtable->setrgbcolor ? _this->vtable->setrgbcolor(_this,rgb) : 0; }
    00812
    00813 __inline__ int hpgs_setdash     (hpgs_device *_this, const float *d,
    00814                                  unsigned nd, double s)
    00815 { return _this->vtable->setdash ? _this->vtable->setdash(_this,d,nd,s) : 0; }
    00816
    00817 __inline__ int hpgs_setlinewidth(hpgs_device *_this, double w)
    00818 { return _this->vtable->setlinewidth ? _this->vtable->setlinewidth(_this,w) : 0; }
    00819
    00820 __inline__ int hpgs_setlinecap  (hpgs_device *_this, hpgs_line_cap c)
    00821 { return _this->vtable->setlinecap ? _this->vtable->setlinecap(_this,c) : 0; }
    00822
    00823 __inline__ int hpgs_setlinejoin (hpgs_device *_this, hpgs_line_join j)
    00824 { return _this->vtable->setlinejoin ? _this->vtable->setlinejoin(_this,j) : 0; }
    00825
    00826 __inline__ int hpgs_setmiterlimit (hpgs_device *_this, double l)
    00827 { return _this->vtable->setmiterlimit ? _this->vtable->setmiterlimit(_this,l) : 0; }
    00828
    00829 __inline__ int hpgs_device_capabilities (hpgs_device *_this)
    00830 { return _this->vtable->capabilities(_this); }
    00831  /* end of group device */
    00833
    00837 typedef struct hpgs_reader_st hpgs_reader;
    00838
    00839 HPGS_API hpgs_reader *hpgs_new_reader(hpgs_istream *in, hpgs_device *dev,
    00840                                       hpgs_bool multipage, int v);
    00841
    00842 HPGS_API void hpgs_reader_set_lw_factor(hpgs_reader *reader, double lw_factor);
    00843
    00844 HPGS_API void hpgs_reader_set_fixed_page(hpgs_reader *reader,
    00845                                          hpgs_bbox *bbox,
    00846                                          double page_width,
    00847                                          double page_height,
    00848                                          double border,
    00849                                          double angle       );
    00850
    00851 HPGS_API void hpgs_reader_set_dynamic_page(hpgs_reader *reader,
    00852                                            hpgs_bbox *bbox,
    00853                                            double max_page_width,
    00854                                            double max_page_height,
    00855                                            double border,
    00856                                            double angle       );
    00857
    00858 HPGS_API void hpgs_reader_set_page_asset_func(hpgs_reader *reader,
    00859                                               void * ctxt,
    00860                                               hpgs_reader_asset_func_t func);
    00861
    00862 HPGS_API void hpgs_reader_set_frame_asset_func(hpgs_reader *reader,
    00863                                                void * ctxt,
    00864                                                hpgs_reader_asset_func_t func);
    00865
    00866 HPGS_API void hpgs_reader_interrupt(hpgs_reader *reader);
    00867 HPGS_API int hpgs_reader_get_current_pen(hpgs_reader *reader);
    00868
    00869 HPGS_API int  hpgs_reader_imbue(hpgs_reader *reader, hpgs_device *dev);
    00870 HPGS_API int  hpgs_reader_attach(hpgs_reader *reader, hpgs_istream *in);
    00871 HPGS_API int  hpgs_reader_stamp(hpgs_reader *reader,
    00872                                 const hpgs_bbox *bb,
    00873                                 const char *stamp, const char *encoding,
    00874                                 double stamp_size);
    00875
    00876 HPGS_API int  hpgs_device_stamp(hpgs_device *dev,
    00877                                 const hpgs_bbox *bb,
    00878                                 const char *stamp, const char *encoding,
    00879                                 double stamp_size);
    00880
    00881 HPGS_API int  hpgs_reader_set_png_dump(hpgs_reader *reader, const char *filename);
    00882 HPGS_API int  hpgs_read(hpgs_reader *reader, hpgs_bool finish);
    00883 HPGS_API void hpgs_destroy_reader(hpgs_reader *reader);
    00884  /* end of group reader */
    00886
    00891 HPGS_API hpgs_font *hpgs_find_font(const char *name);
    00892 HPGS_API void hpgs_destroy_font(hpgs_font *font);
    00893 HPGS_API double hpgs_font_get_ascent(hpgs_font *font);
    00894 HPGS_API double hpgs_font_get_descent(hpgs_font *font);
    00895 HPGS_API double hpgs_font_get_line_gap(hpgs_font *font);
    00896 HPGS_API double hpgs_font_get_cap_height(hpgs_font *font);
    00897 HPGS_API unsigned hpgs_font_get_glyph_count(hpgs_font *font);
    00898 HPGS_API unsigned hpgs_font_get_glyph_id(hpgs_font *font, int uc);
    00899 HPGS_API const char *hpgs_font_get_glyph_name(hpgs_font *font, unsigned gid);
    00900 HPGS_API int hpgs_font_get_glyph_bbox(hpgs_font *font, hpgs_bbox *bb, unsigned gid);
    00901 HPGS_API int hpgs_font_get_glyph_metrics(hpgs_font *font, hpgs_point *m, unsigned gid);
    00902 HPGS_API int hpgs_font_get_kern_metrics(hpgs_font *font, hpgs_point *m, unsigned gid_l, unsigned gid_r);
    00903 HPGS_API int hpgs_font_get_utf8_metrics(hpgs_font *font, hpgs_point *m, const char *str, int strlen);
    00904
    00905 typedef int (*hpgs_moveto_func_t) (void *ctxt, const hpgs_point *p);
    00906 typedef int (*hpgs_lineto_func_t) (void *ctxt, const hpgs_point *p);
    00907 typedef int (*hpgs_curveto_func_t) (void *ctxt, const hpgs_point *p1, const hpgs_point *p2, const hpgs_point *p3);
    00908 typedef int (*hpgs_fill_func_t) (void *ctxt, hpgs_bool winding);
    00909
    00910 HPGS_API int hpgs_font_decompose_glyph(hpgs_font *font,
    00911                                        void *ctxt,
    00912                                        hpgs_moveto_func_t moveto_func,
    00913                                        hpgs_lineto_func_t lineto_func,
    00914                                        hpgs_curveto_func_t curveto_func,
    00915                                        const hpgs_matrix *m,
    00916                                        unsigned gid);
    00917
    00918 HPGS_API int hpgs_font_draw_glyph(hpgs_font *font,
    00919                                   hpgs_device *device,
    00920                                   const hpgs_matrix *m,
    00921                                   unsigned gid);
    00922
    00923 HPGS_API int hpgs_font_decompose_utf8(hpgs_font *font,
    00924                                       void *ctxt,
    00925                                       hpgs_moveto_func_t moveto_func,
    00926                                       hpgs_lineto_func_t lineto_func,
    00927                                       hpgs_curveto_func_t curveto_func,
    00928                                       hpgs_fill_func_t fill_func,
    00929                                       const hpgs_matrix *m,
    00930                                       const char *str, int strlen);
    00931
    00932 HPGS_API int hpgs_font_draw_utf8(hpgs_font *font,
    00933                                  hpgs_device *device,
    00934                                  const hpgs_matrix *m,
    00935                                  const char *str, int strlen);
    00936  /* end of group font */
    00938
    00949 struct hpgs_image_vtable_st {
    00950   int (*get_pixel)   (const hpgs_image *_this,
    00951                       int x, int y, hpgs_paint_color *c, double *alpha);
    00952   int (*put_pixel)   (hpgs_image *_this,
    00953                       int x, int y, const hpgs_paint_color *c, double alpha);
    00954   int (*put_chunk)   (hpgs_image *_this,
    00955                       int x1, int x2, int y, const hpgs_paint_color *c);
    00956   int (*rop3_pixel)  (hpgs_image *_this,
    00957                       int x, int y, const hpgs_paint_color *c, double alpha);
    00958   int (*rop3_chunk)  (hpgs_image *_this,
    00959                       int x1, int x2, int y, const hpgs_paint_color *c);
    00960   int (*setrop3)     (hpgs_image *_this, hpgs_rop3_func_t rop3);
    00961   int (*setpatcol)   (hpgs_image *_this, const hpgs_palette_color *p);
    00962   int (*resize)      (hpgs_image *_this, int w, int h);
    00963   int (*set_resolution)(hpgs_image *pim, double x_dpi, double y_dpi);
    00964   int (*clear)       (hpgs_image *_this);
    00965   int (*write)       (hpgs_image *_this, const char *filename);
    00966   int (*get_data)    (hpgs_image *_this, unsigned char **data, int *stride, int *depth);
    00967   void (*destroy)    (hpgs_image *_this);
    00968 };
    00969
    00979 struct hpgs_image_st {
    00980   hpgs_image_vtable *vtable;
    00981   int  width;
    00982   int  height;
    00983
    00984   hpgs_palette_color *palette;
    00985   unsigned *palette_idx;
    00986   int palette_ncolors;
    00987 };
    00988
    00989 HPGS_API int hpgs_image_define_color_func (hpgs_image *image, hpgs_paint_color *c);
    00990
    00991 static int hpgs_image_define_color (hpgs_image *image, hpgs_paint_color *c);
    00992
    00999 __inline__ int hpgs_image_define_color (hpgs_image *image, hpgs_paint_color *c)
    01000 {
    01001   if (image->palette) return hpgs_image_define_color_func (image,c); else return 0;
    01002 }
    01003
    01004 HPGS_API int hpgs_image_set_palette (hpgs_image *image,
    01005                                      hpgs_palette_color *p, int np);
    01006
    01007 HPGS_API hpgs_png_image *hpgs_new_png_image(int width, int height,
    01008                                             int depth, hpgs_bool palette,
    01009                                             hpgs_bool do_rop3);
    01010
    01011 HPGS_API int hpgs_png_image_set_compression(hpgs_png_image *pim, int compression);
    01012
    01013 HPGS_API int hpgs_image_set_resolution(hpgs_image *pim, double x_dpi, double y_dpi);
    01014
    01015 HPGS_API int hpgs_image_get_data(hpgs_image *_this,
    01016                                  unsigned char **data, int *stride,
    01017                                  int *depth);
    01018
    01021 static int hpgs_image_get_pixel (const hpgs_image *_this,
    01022                                  int x, int y,
    01023                                  hpgs_paint_color *c, double *alpha);
    01026 static int hpgs_image_put_pixel (hpgs_image *_this,
    01027                                  int x, int y,
    01028                                  const hpgs_paint_color *c, double alpha);
    01032 static int hpgs_image_put_chunk (hpgs_image *_this,
    01033                                  int x1, int x2, int y, const hpgs_paint_color *c);
    01034
    01039 static int hpgs_image_rop3_pixel (hpgs_image *_this,
    01040                                   int x, int y,
    01041                                   const hpgs_paint_color *c, double alpha);
    01047 static int hpgs_image_rop3_chunk (hpgs_image *_this,
    01048                                   int x1, int x2, int y, const hpgs_paint_color *c);
    01049
    01050 HPGS_API int hpgs_image_resize (hpgs_image *_this, int w, int h);
    01051 HPGS_API int hpgs_image_clear (hpgs_image *_this);
    01052 HPGS_API int hpgs_image_write (hpgs_image *_this, const char *filename);
    01053 HPGS_API int hpgs_image_setrop3 (hpgs_image *_this, hpgs_rop3_func_t rop3);
    01054 HPGS_API int hpgs_image_setpatcol (hpgs_image *_this, const hpgs_palette_color *p);
    01055
    01056 HPGS_API void hpgs_image_destroy         (hpgs_image *_this);
    01057
    01058 __inline__ int hpgs_image_get_pixel (const hpgs_image *_this,
    01059                                      int x, int y,
    01060                                      hpgs_paint_color *c, double *alpha)
    01061 { return _this->vtable->get_pixel(_this,x,y,c,alpha); }
    01062
    01063 __inline__ int hpgs_image_put_pixel (hpgs_image *_this,
    01064                                      int x, int y,
    01065                                      const hpgs_paint_color *c, double alpha)
    01066 { return _this->vtable->put_pixel(_this,x,y,c,alpha); }
    01067
    01068 __inline__ int hpgs_image_put_chunk (hpgs_image *_this,
    01069                                      int x1, int x2, int y, const hpgs_paint_color *c)
    01070 { return _this->vtable->put_chunk(_this,x1,x2,y,c); }
    01071
    01072 __inline__ int hpgs_image_rop3_pixel (hpgs_image *_this,
    01073                                       int x, int y,
    01074                                       const hpgs_paint_color *c, double alpha)
    01075 { return _this->vtable->rop3_pixel(_this,x,y,c,alpha); }
    01076
    01077 __inline__ int hpgs_image_rop3_chunk (hpgs_image *_this,
    01078                                       int x1, int x2, int y, const hpgs_paint_color *c)
    01079 { return _this->vtable->rop3_chunk(_this,x1,x2,y,c); }
    01080
    01081 HPGS_API int hpgs_image_rop3_clip(hpgs_device *device,
    01082                                   hpgs_palette_color *data,
    01083                                   const hpgs_image *img,
    01084                                   const hpgs_point *ll, const hpgs_point *lr,
    01085                                   const hpgs_point *ur,
    01086                                   const hpgs_palette_color *p,
    01087                                   hpgs_xrop3_func_t xrop3);
    01088  /* end of group image */
    01090
    01095 typedef struct hpgs_path_point_st hpgs_path_point;
    01096 typedef struct hpgs_paint_path_st hpgs_paint_path;
    01097
    01098 #define HPGS_POINT_ROLE_MASK     0xF
    01099 #define HPGS_POINT_UNDEFINED     0x0
    01100 #define HPGS_POINT_LINE          0x1
    01101 #define HPGS_POINT_BEZIER        0x2
    01102 #define HPGS_POINT_CONTROL       0x3
    01103 #define HPGS_POINT_FILL_LINE     0x4
    01104 #define HPGS_POINT_DOT           0x8
    01105
    01106 #define HPGS_POINT_SUBPATH_START   0x10
    01107 #define HPGS_POINT_SUBPATH_END     0x20
    01108 #define HPGS_POINT_SUBPATH_CLOSE   0x40
    01109
    01110
    01115 struct hpgs_path_point_st
    01116 {
    01117   hpgs_point p;
    01118   int flags;
    01119 };
    01120
    01127 struct hpgs_paint_path_st
    01128 {
    01134   hpgs_path_point *points;
    01135   int              n_points;
    01136   int              last_start;
    01137   int              points_malloc_size;
    01140   hpgs_bbox bb;
    01141 };
    01142
    01143 HPGS_API hpgs_paint_path *hpgs_new_paint_path(void);
    01144 HPGS_API void             hpgs_paint_path_destroy(hpgs_paint_path *_this);
    01145 HPGS_API void             hpgs_paint_path_truncate(hpgs_paint_path *_this);
    01146
    01147 HPGS_API int              hpgs_paint_path_moveto(hpgs_paint_path *_this,
    01148                                                  const hpgs_point *p  );
    01149
    01150 HPGS_API int              hpgs_paint_path_lineto(hpgs_paint_path *_this,
    01151                                                  const hpgs_point *p  );
    01152
    01153 HPGS_API int              hpgs_paint_path_curveto(hpgs_paint_path *_this,
    01154                                                   const hpgs_point *p1,
    01155                                                   const hpgs_point *p2,
    01156                                                   const hpgs_point *p3  );
    01157
    01158 HPGS_API int              hpgs_paint_path_closepath(hpgs_paint_path *_this);
    01159
    01160 HPGS_API int              hpgs_paint_path_buldgeto(hpgs_paint_path *_this,
    01161                                                    const hpgs_point *p,
    01162                                                    double buldge);
    01163
    01164 HPGS_API hpgs_paint_path *hpgs_paint_path_stroke_path(const hpgs_paint_path *_this,
    01165                                                                const hpgs_gstate *gstate);
    01166
    01167 HPGS_API hpgs_paint_path *hpgs_paint_path_decompose_dashes(const hpgs_paint_path *_this,
    01168                                                            const hpgs_gstate *gstate);
    01169
    01170 HPGS_API double hpgs_bezier_path_x (const hpgs_paint_path *path, int i, double t);
    01171 HPGS_API double hpgs_bezier_path_y (const hpgs_paint_path *path, int i, double t);
    01172 HPGS_API double hpgs_bezier_path_delta_x (const hpgs_paint_path *path, int i, double t);
    01173 HPGS_API double hpgs_bezier_path_delta_y (const hpgs_paint_path *path, int i, double t);
    01174
    01175 HPGS_API double hpgs_bezier_path_xmin (const hpgs_paint_path *path, int i);
    01176 HPGS_API double hpgs_bezier_path_xmax (const hpgs_paint_path *path, int i);
    01177 HPGS_API double hpgs_bezier_path_ymin (const hpgs_paint_path *path, int i);
    01178 HPGS_API double hpgs_bezier_path_ymax (const hpgs_paint_path *path, int i);
    01179
    01180 HPGS_API void hpgs_bezier_path_point(const hpgs_paint_path *path, int i,
    01181                                      double t, hpgs_point *p);
    01182
    01183 HPGS_API void hpgs_bezier_path_delta(const hpgs_paint_path *path, int i,
    01184                                      double t, hpgs_point *p);
    01185
    01186 HPGS_API void hpgs_bezier_path_tangent(const hpgs_paint_path *path, int i,
    01187                                        double t, int orientation,
    01188                                        double ytol,
    01189                                        hpgs_point *p);
    01190
    01191 HPGS_API void hpgs_bezier_path_singularities(const hpgs_paint_path *path, int i,
    01192                                              double t0, double t1,
    01193                                              int *nx, double *tx);
    01194
    01195 HPGS_API void hpgs_bezier_path_to_quadratic(const hpgs_paint_path *path, int i,
    01196                                             double t0, double t1,
    01197                                             int *nx, hpgs_point *points);
    01198  /* end of group path */
    01200
    01204 HPGS_API hpgs_paint_device *hpgs_new_paint_device(hpgs_image *image,
    01205                                                   const char *filename,
    01206                                                   const hpgs_bbox *bb,
    01207                                                   hpgs_bool antialias);
    01208
    01209 HPGS_API void hpgs_paint_device_set_image_interpolation (hpgs_paint_device *pdv, int i);
    01210 HPGS_API void hpgs_paint_device_set_thin_alpha (hpgs_paint_device *pdv, double a);
    01211  /* end of group paint_device */
    01213
    01214 #ifdef __cplusplus
    01215 } // end of extern "C"
    01216 #endif
    01217
    01218 #endif /* ! __HPGS_H */