Go to the documentation of this file.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
00162 HPGS_INTERNAL_API void hpgs_bezier_minmax_comp (double c0, double c1,
00163 double c2, double c3,
00164 double *cmin, double *cmax);
00165
00167
00177 struct hpgs_scanline_point_st
00178 {
00179 double x;
00182 int order;
00191 };
00192
00198 struct hpgs_paint_scanline_st
00199 {
00203 hpgs_scanline_point *points;
00204 int points_malloc_size;
00205 int n_points;
00207 };
00208
00236 struct hpgs_paint_clipper_st
00237 {
00241 hpgs_paint_scanline *scanlines;
00242 int n_scanlines;
00245 hpgs_bbox bb;
00247
00251 double yfac;
00252 double y0;
00255 hpgs_bool overscan;
00256 int height;
00258 int iscan0;
00259 int iscan1;
00260 };
00261
00262 HPGS_INTERNAL_API hpgs_paint_clipper *hpgs_new_paint_clipper(const hpgs_bbox *bb,
00263 int height,
00264 int scanline_msize,
00265 int overscan);
00266
00267 HPGS_INTERNAL_API hpgs_paint_clipper *hpgs_paint_clipper_clip(const hpgs_paint_clipper *orig,
00268 const hpgs_paint_clipper *clip,
00269 hpgs_bool winding);
00270
00271 HPGS_INTERNAL_API int hpgs_paint_clipper_cut(hpgs_paint_clipper *c,
00272 hpgs_paint_path *path);
00273
00274 HPGS_INTERNAL_API int hpgs_paint_clipper_thin_cut(hpgs_paint_clipper *c,
00275 hpgs_paint_path *path,
00276 const hpgs_gstate *gstate);
00277
00278 HPGS_INTERNAL_API int hpgs_paint_clipper_emit (hpgs_image *image,
00279 const hpgs_paint_clipper *img,
00280 const hpgs_paint_clipper *clip,
00281 const hpgs_paint_color *c,
00282 hpgs_bool winding,
00283 hpgs_bool stroke);
00284
00285 HPGS_INTERNAL_API int hpgs_paint_clipper_reset(hpgs_paint_clipper *c, double llx, double urx);
00286 HPGS_INTERNAL_API void hpgs_paint_clipper_clear(hpgs_paint_clipper *c);
00287 HPGS_INTERNAL_API void hpgs_paint_clipper_destroy(hpgs_paint_clipper *c);
00288
00290
00291 #ifdef __cplusplus
00292 }
00293 #endif
00294
00295 #endif