HPGS - HPGl Script
hpgspaint.h
Go to the documentation of this file.
1 /***********************************************************************
2  * *
3  * $Id: hpgspaint.h 607 2011-03-10 10:43:05Z hpgs $
4  * *
5  * hpgs - HPGl Script, a hpgl/2 interpreter, which uses a Postscript *
6  * API for rendering a scene and thus renders to a variety of *
7  * devices and fileformats. *
8  * *
9  * (C) 2004-2009 ev-i Informationstechnologie GmbH http://www.ev-i.at *
10  * *
11  * Author: Wolfgang Glas *
12  * *
13  * hpgs is free software; you can redistribute it and/or *
14  * modify it under the terms of the GNU Lesser General Public *
15  * License as published by the Free Software Foundation; either *
16  * version 2.1 of the License, or (at your option) any later version. *
17  * *
18  * hpgs is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
21  * Lesser General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU Lesser General Public *
24  * License along with this library; if not, write to the *
25  * Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
26  * Boston, MA 02111-1307 USA *
27  * *
28  ***********************************************************************
29  * *
30  * The declarations for the pixel painter. *
31  * *
32  ***********************************************************************/
33 
34 #ifndef __HPGS_PAINT_H
35 #define __HPGS_PAINT_H
36 
37 #include<hpgs.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
54 
59 #define HPGS_PAINT_MAX_CLIP_DEPTH 16
60 
78 {
83  char *filename;
85  hpgs_bbox page_bb;
88  double xres;
89  double yres;
91  hpgs_bool overscan;
93  double thin_alpha;
100  hpgs_paint_clipper *clippers[HPGS_PAINT_MAX_CLIP_DEPTH];
115 };
116 
117 HPGS_INTERNAL_API int hpgs_paint_device_fill(hpgs_paint_device *pdv,
119  hpgs_bool winding,
120  hpgs_bool stroke);
121 
122 HPGS_INTERNAL_API int hpgs_paint_device_clip(hpgs_paint_device *pdv,
124  hpgs_bool winding);
125 
126 HPGS_INTERNAL_API int hpgs_paint_device_drawimage(hpgs_paint_device *pdv,
127  const hpgs_image *img,
128  const hpgs_point *ll, const hpgs_point *lr,
129  const hpgs_point *ur);
130  /* end of group paint_device */
132 
137 #define HPGS_BEZIER_NSEGS 16
138 
140 
149 {
150  double l[HPGS_BEZIER_NSEGS+1];
151  double dl[HPGS_BEZIER_NSEGS+1];
152 };
153 
154 HPGS_INTERNAL_API void hpgs_bezier_length_init(hpgs_bezier_length *b,
155  const hpgs_paint_path *path, int i);
156 HPGS_INTERNAL_API double hpgs_bezier_length_param(const hpgs_bezier_length *b, double l);
157 
162 HPGS_INTERNAL_API void hpgs_bezier_minmax_comp (double c0, double c1,
163  double c2, double c3,
164  double *cmin, double *cmax);
165  /* end of group path */
167 
178 {
179  double x;
182  int order;
191 };
192 
199 {
204  int points_malloc_size;
205  int n_points;
207 };
208 
237 {
242  int n_scanlines;
245  hpgs_bbox bb;
247 
251  double yfac; // height of a single scanline.
252  double y0; // y for scanline 0
255  hpgs_bool overscan;
256  int height;
258  int iscan0;
259  int iscan1;
260 };
261 
262 HPGS_INTERNAL_API hpgs_paint_clipper *hpgs_new_paint_clipper(const hpgs_bbox *bb,
263  int height,
264  int scanline_msize,
265  int overscan);
266 
267 HPGS_INTERNAL_API hpgs_paint_clipper *hpgs_paint_clipper_clip(const hpgs_paint_clipper *orig,
268  const hpgs_paint_clipper *clip,
269  hpgs_bool winding);
270 
271 HPGS_INTERNAL_API int hpgs_paint_clipper_cut(hpgs_paint_clipper *c,
273 
274 HPGS_INTERNAL_API int hpgs_paint_clipper_thin_cut(hpgs_paint_clipper *c,
276  const hpgs_gstate *gstate);
277 
278 HPGS_INTERNAL_API int hpgs_paint_clipper_emit (hpgs_image *image,
279  const hpgs_paint_clipper *img,
280  const hpgs_paint_clipper *clip,
281  const hpgs_paint_color *c,
282  hpgs_bool winding,
283  hpgs_bool stroke);
284 
285 HPGS_INTERNAL_API int hpgs_paint_clipper_reset(hpgs_paint_clipper *c, double llx, double urx);
286 HPGS_INTERNAL_API void hpgs_paint_clipper_clear(hpgs_paint_clipper *c);
287 HPGS_INTERNAL_API void hpgs_paint_clipper_destroy(hpgs_paint_clipper *c);
288  /* end of group scanline */
290 
291 #ifdef __cplusplus
292 } // end of extern "C"
293 #endif
294 
295 #endif /* ! __HPGS_PAINT_H */
int clip_depth
Definition: hpgspaint.h:105
A screen RGB color as stored in a palette.
Definition: hpgs.h:250
HPGS_INTERNAL_API int hpgs_paint_clipper_cut(hpgs_paint_clipper *c, hpgs_paint_path *path)
Definition: hpgsscanline.c:1991
hpgs_paint_clipper * path_clipper
Definition: hpgspaint.h:97
A stored vector path.
Definition: hpgs.h:1137
A collection of scanlines for mapping paths onto images.
Definition: hpgspaint.h:236
int current_clipper
Definition: hpgspaint.h:104
double thin_alpha
Definition: hpgspaint.h:93
hpgs_palette_color patcol
Definition: hpgspaint.h:112
A 2D point.
Definition: hpgs.h:227
int image_interpolation
Definition: hpgspaint.h:114
An intersection point of a path with a scanline.
Definition: hpgspaint.h:177
HPGS_INTERNAL_API hpgs_paint_clipper * hpgs_paint_clipper_clip(const hpgs_paint_clipper *orig, const hpgs_paint_clipper *clip, hpgs_bool winding)
Definition: hpgsscanline.c:2199
hpgs_bool overscan
Definition: hpgspaint.h:91
HPGS_INTERNAL_API void hpgs_bezier_length_init(hpgs_bezier_length *b, const hpgs_paint_path *path, int i)
Definition: hpgsbezier.c:473
hpgs_paint_clipper * clippers[HPGS_PAINT_MAX_CLIP_DEPTH]
Definition: hpgspaint.h:100
The vector graphics state.
Definition: hpgs.h:613
HPGS_INTERNAL_API int hpgs_paint_device_clip(hpgs_paint_device *pdv, hpgs_paint_path *path, hpgs_bool winding)
Definition: hpgspaint.c:665
HPGS_INTERNAL_API int hpgs_paint_device_fill(hpgs_paint_device *pdv, hpgs_paint_path *path, hpgs_bool winding, hpgs_bool stroke)
Definition: hpgspaint.c:626
The pixel rendering vector graphics device.
Definition: hpgspaint.h:77
hpgs_paint_path * path
Definition: hpgspaint.h:95
A structure for holding intermediate values for length calculations of a bezier spline.
Definition: hpgspaint.h:148
HPGS_INTERNAL_API int hpgs_paint_device_drawimage(hpgs_paint_device *pdv, const hpgs_image *img, const hpgs_point *ll, const hpgs_point *lr, const hpgs_point *ur)
Definition: hpgspaintimage.c:221
HPGS_INTERNAL_API void hpgs_paint_clipper_clear(hpgs_paint_clipper *c)
Definition: hpgsscanline.c:2696
HPGS_INTERNAL_API void hpgs_paint_clipper_destroy(hpgs_paint_clipper *c)
Definition: hpgsscanline.c:2713
double yfac
Definition: hpgspaint.h:251
An abstract pixel image.
Definition: hpgs.h:989
hpgs_paint_scanline * scanlines
Definition: hpgspaint.h:241
hpgs_device inherited
Definition: hpgspaint.h:79
HPGS_INTERNAL_API int hpgs_paint_clipper_thin_cut(hpgs_paint_clipper *c, hpgs_paint_path *path, const hpgs_gstate *gstate)
Definition: hpgsscanline.c:1255
double yres
Definition: hpgspaint.h:89
double x
Definition: hpgspaint.h:179
char * filename
Definition: hpgspaint.h:83
hpgs_gstate * gstate
Definition: hpgspaint.h:109
A virtual vector graphics device for the HPGL reader.
Definition: hpgs.h:699
int height
Definition: hpgspaint.h:256
hpgs_image * image
Definition: hpgspaint.h:81
HPGS_INTERNAL_API int hpgs_paint_clipper_reset(hpgs_paint_clipper *c, double llx, double urx)
Definition: hpgsscanline.c:2654
hpgs_paint_color color
Definition: hpgspaint.h:111
hpgs_bool overscan
Definition: hpgspaint.h:255
HPGS_INTERNAL_API hpgs_paint_clipper * hpgs_new_paint_clipper(const hpgs_bbox *bb, int height, int scanline_msize, int overscan)
Definition: hpgsscanline.c:2595
int iscan0
Definition: hpgspaint.h:258
int iscan1
Definition: hpgspaint.h:259
hpgs_scanline_point * points
Definition: hpgspaint.h:203
HPGS_INTERNAL_API double hpgs_bezier_length_param(const hpgs_bezier_length *b, double l)
Definition: hpgsbezier.c:503
A bounding box.
Definition: hpgs.h:296
int order
Definition: hpgspaint.h:182
A scanline of the pixel renderer.
Definition: hpgspaint.h:198
The public interfaces.
HPGS_INTERNAL_API int hpgs_paint_clipper_emit(hpgs_image *image, const hpgs_paint_clipper *img, const hpgs_paint_clipper *clip, const hpgs_paint_color *c, hpgs_bool winding, hpgs_bool stroke)
Definition: hpgsscanline.c:2530
HPGS_INTERNAL_API void hpgs_bezier_minmax_comp(double c0, double c1, double c2, double c3, double *cmin, double *cmax)
Definition: hpgsbezier.c:582
double xres
Definition: hpgspaint.h:88
An image RGB color with an optional palette index.
Definition: hpgs.h:282