- Main Page
- Modules
- Data Structures
- Files

# hpgspaint.h

Go to the documentation of this file.

    00001 /***********************************************************************
    00002  *                                                                     *
    00003  * $Id: hpgspaint.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 declarations for the pixel painter.                             *
    00031  *                                                                     *
    00032  ***********************************************************************/
    00033
    00034 #ifndef __HPGS_PAINT_H
    00035 #define __HPGS_PAINT_H
    00036
    00037 #include<hpgs.h>
    00038
    00039 #ifdef __cplusplus
    00040 extern "C" {
    00041 #endif
    00042
    00051 typedef struct hpgs_scanline_point_st hpgs_scanline_point;
    00052 typedef struct hpgs_paint_scanline_st hpgs_paint_scanline;
    00053 typedef struct hpgs_paint_clipper_st  hpgs_paint_clipper;
    00054
    00059 #define HPGS_PAINT_MAX_CLIP_DEPTH 16
    00060
    00077 struct hpgs_paint_device_st
    00078 {
    00079   hpgs_device inherited;
    00081   hpgs_image *image;
    00083   char *filename;
    00085   hpgs_bbox page_bb;
    00088   double xres;
    00089   double yres;
    00091   hpgs_bool overscan;
    00093   double thin_alpha;
    00095   hpgs_paint_path *path;
    00097   hpgs_paint_clipper *path_clipper;
    00100   hpgs_paint_clipper *clippers[HPGS_PAINT_MAX_CLIP_DEPTH];
    00104   int current_clipper;
    00105   int clip_depth;
    00109   hpgs_gstate *gstate;
    00111   hpgs_paint_color color;
    00112   hpgs_palette_color patcol;
    00114   int image_interpolation;
    00115 };
    00116
    00117 HPGS_INTERNAL_API int hpgs_paint_device_fill(hpgs_paint_device *pdv,
    00118                                              hpgs_paint_path *path,
    00119                                              hpgs_bool winding,
    00120                                              hpgs_bool stroke);
    00121
    00122 HPGS_INTERNAL_API int hpgs_paint_device_clip(hpgs_paint_device *pdv,
    00123                                              hpgs_paint_path *path,
    00124                                              hpgs_bool winding);
    00125
    00126 HPGS_INTERNAL_API int hpgs_paint_device_drawimage(hpgs_paint_device *pdv,
    00127                                                   const hpgs_image *img,
    00128                                                   const hpgs_point *ll, const hpgs_point *lr,
    00129                                                   const hpgs_point *ur);
    00130  /* end of group paint_device */
    00132
    00137 #define HPGS_BEZIER_NSEGS 16
    00138
    00139 typedef struct hpgs_bezier_length_st     hpgs_bezier_length;
    00140
    00148 struct hpgs_bezier_length_st
    00149 {
    00150   double l[HPGS_BEZIER_NSEGS+1];
    00151   double dl[HPGS_BEZIER_NSEGS+1];
    00152 };
    00153
    00154 HPGS_INTERNAL_API void hpgs_bezier_length_init(hpgs_bezier_length *b,
    00155                                                const hpgs_paint_path *path, int i);
    00156 HPGS_INTERNAL_API double hpgs_bezier_length_param(const hpgs_bezier_length *b, double l);
    00157  /* end of group path */
    00159
    00169 struct hpgs_scanline_point_st
    00170 {
    00171   double x;
    00174   int    order;
    00183 };
    00184
    00190 struct hpgs_paint_scanline_st
    00191 {
    00195   hpgs_scanline_point *points;
    00196   int points_malloc_size;
    00197   int n_points;
    00199 };
    00200
    00228 struct hpgs_paint_clipper_st
    00229 {
    00233   hpgs_paint_scanline *scanlines;
    00234   int n_scanlines;
    00237   hpgs_bbox bb;
    00239
    00243   double yfac; // height of a single scanline.
    00244   double y0;   // y for scanline 0
    00247   hpgs_bool overscan;
    00248   int height;
    00250   int iscan0;
    00251   int iscan1;
    00252 };
    00253
    00254 HPGS_INTERNAL_API hpgs_paint_clipper *hpgs_new_paint_clipper(const hpgs_bbox *bb,
    00255                                                              int height,
    00256                                                              int scanline_msize,
    00257                                                              int overscan);
    00258
    00259 HPGS_INTERNAL_API hpgs_paint_clipper *hpgs_paint_clipper_clip(const hpgs_paint_clipper *orig,
    00260                                                               const hpgs_paint_clipper *clip,
    00261                                                               hpgs_bool winding);
    00262
    00263 HPGS_INTERNAL_API int hpgs_paint_clipper_cut(hpgs_paint_clipper *c,
    00264                                              hpgs_paint_path *path);
    00265
    00266 HPGS_INTERNAL_API int hpgs_paint_clipper_thin_cut(hpgs_paint_clipper *c,
    00267                                                   hpgs_paint_path *path,
    00268                                                   const hpgs_gstate *gstate);
    00269
    00270 HPGS_INTERNAL_API int hpgs_paint_clipper_emit (hpgs_image *image,
    00271                                                const hpgs_paint_clipper *img,
    00272                                                const hpgs_paint_clipper *clip,
    00273                                                const hpgs_paint_color *c,
    00274                                                hpgs_bool winding,
    00275                                                hpgs_bool stroke);
    00276
    00277 HPGS_INTERNAL_API int  hpgs_paint_clipper_reset(hpgs_paint_clipper *c, double llx, double urx);
    00278 HPGS_INTERNAL_API void hpgs_paint_clipper_clear(hpgs_paint_clipper *c);
    00279 HPGS_INTERNAL_API void hpgs_paint_clipper_destroy(hpgs_paint_clipper *c);
    00280  /* end of group scanline */
    00282
    00283 #ifdef __cplusplus
    00284 } // end of extern "C"
    00285 #endif
    00286
    00287 #endif /* ! __HPGS_PAINT_H */