00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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
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
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;
00244 double y0;
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
00282
00283 #ifdef __cplusplus
00284 }
00285 #endif
00286
00287 #endif