00001 #ifndef _KERNEL_GO_H_
00002 #define _KERNEL_GO_H_
00003
00015
00016
00017
00018
00019
00020
00021 SCHEME SO_go_group go_group_new(void) STRANS ;
00022
00023 SCHEME SO_go_path go_path_new(void) STRANS ;
00024
00025
00026
00027
00028
00029
00030 struct go_empty
00031 {
00032 struct go go;
00033 struct geom_callback_item geom;
00034 struct anchor a[0];
00035 struct hanger h[0];
00036 };
00037
00038 enum go_empty_subtype
00039 {
00040 GOST_EMPTY,
00041 GOST_EMPTY_MAX,
00042 };
00043
00045 SCHEME SO_go_empty go_empty_new(void) STRANS ;
00046
00047
00048
00049
00050
00051
00052 struct go_point
00053 {
00054 struct go go;
00055 struct geom_point_item geom;
00056 struct anchor a[1];
00057 struct hanger h[1];
00058 u8 unit_coordinate_x, unit_coordinate_y;
00059 };
00060
00061 enum go_point_subtype
00062 {
00063 GOST_POINT,
00064 GOST_POINT_MAX,
00065 };
00066
00068 SCHEME SO_go_point go_point_new(SHANGER h) STRANS ;
00069
00070
00071
00072
00073
00074
00075
00076 struct go_segment
00077 {
00078 struct go go;
00079 struct geom_segment geom;
00080 struct anchor a[2];
00081 struct hanger h[3];
00082 uns fill_color, stroke_color, stroke_cap, stroke_join, stroke_style;
00083 real stroke_width;
00084 u8 unit_stroke_width, unit_start_x, unit_start_y, unit_end_x, unit_end_y;
00085 };
00086
00087 enum go_segment_subtype
00088 {
00089 GOST_SEGMENT,
00090 GOST_SEGMENT_MAX,
00091 };
00092
00094 SCHEME SO_go_segment go_segment_new(SHANGER starting_point, SHANGER end_point) STRANS ;
00095
00096
00097
00098
00099
00100
00101
00102 struct go_bezier
00103 {
00104 struct go go;
00105 struct geom_bezier geom;
00106 struct anchor a[4];
00107 struct hanger h[3];
00108 uns fill_color, stroke_color, stroke_cap, stroke_join, stroke_style;
00109 real stroke_width;
00110 u8 unit_stroke_width,
00111 unit_control_0_x, unit_control_0_y, unit_control_1_x, unit_control_1_y,
00112 unit_control_2_x, unit_control_2_y, unit_control_3_x, unit_control_3_y;
00113 };
00114
00115 enum go_bezier_subtype
00116 {
00117 GOST_BEZIER_QUADRATIC,
00118 GOST_BEZIER_CUBIC,
00119 GOST_BEZIER_MAX,
00120 };
00121
00123 SCHEME SO_go_bezier go_bezier_new_cubic(SHANGER control_1, SREAL weight_1, SHANGER control_2, SREAL weight_2, SHANGER control_3, SREAL weight_3, SHANGER control_4, SREAL weight_4) STRANS ;
00124
00126 SCHEME SO_go_bezier go_bezier_new_quadratic(SHANGER control_1, SREAL weight_1, SHANGER control_2, SREAL weight_2, SHANGER control_3, SREAL weight_3) STRANS ;
00127
00128
00129
00130
00131
00132
00133
00134 struct go_elarc
00135 {
00136 struct go go;
00137 struct geom_elliptic_arc geom;
00138 struct anchor a[3];
00139 struct hanger h[4];
00140 real ecc;
00141 uns conic;
00142 uns fill_color, stroke_color, stroke_cap, stroke_join, stroke_style;
00143 real stroke_width;
00144 u8 unit_stroke_width, unit_center_x, unit_center_y, unit_rotation, unit_a_radius, unit_b_radius, unit_start, unit_dif, unit_ecc;
00145 };
00146
00147 enum go_elarc_subtype
00148 {
00149 GOST_ELARC_XYR,
00150 GOST_ELARC_FOCI,
00151 GOST_ELARC_3SMALL,
00152 GOST_ELARC_3ECC,
00153 GOST_ELARC_XY1ECC,
00154 GOST_ELARC_MAX,
00155 };
00156
00158 SCHEME SO_go_elarc go_elarc_new_xyr(SHANGER center, SREAL rotation, SREAL horizontal_radius, SREAL vertical_radius, SREAL start, SREAL dif, SUNS conic) STRANS ;
00159
00161 SCHEME SO_go_elarc go_elarc_new_foci(SHANGER focus1, SHANGER focus2, SHANGER point, SUNS conic) STRANS ;
00162
00164 SCHEME SO_go_elarc go_elarc_new_3small(SHANGER point1, SHANGER point2, SHANGER point3, SUNS conic) STRANS ;
00165
00167 SCHEME SO_go_elarc go_elarc_new_3ecc(SHANGER point1, SHANGER point2, SHANGER point3, SREAL rotation, SREAL eccentricity, SUNS conic) STRANS ;
00168
00170 SCHEME SO_go_elarc go_elarc_new_xy1ecc(SHANGER center, SHANGER point, SREAL rotation, SREAL eccentricity, SUNS conic) STRANS ;
00171
00172
00173
00174
00175
00176
00177
00178 struct go_parametric_point
00179 {
00180 struct go go;
00181 struct geom_point_item geom;
00182 real parameter;
00183 struct anchor a[1];
00184 struct hanger h[1];
00185 u8 unit_coordinate_x, unit_coordinate_y, unit_parameter;
00186 };
00187
00188 enum go_parametric_point_subtype
00189 {
00190 GOST_PARAMETRIC_POINT,
00191 GOST_PARAMETRIC_POINT_MAX,
00192 };
00193
00195 SCHEME SO_go_parametric_point go_parametric_point_new(SO_go go, SREAL parameter) STRANS ;
00196
00197 SCHEME SO_go_parametric_point go_parametric_point_new_on_hanger(SHANGER h, SREAL parameter, SBOOL position_important, SREAL x, SREAL y); STRANS
00198
00200 SCHEME static inline SBOOL go_parametric_point_is_valid(SO_go_parametric_point p)
00201 { return hanger_get_go(p->a[0].h)->type != GOT_GROUP; }
00202
00204 SCHEME static inline SBOOL go_parametric_point_is_position_important(SO_go_parametric_point p)
00205 { return p->go.flags & GOF_PARPOINT_INVALID_X; }
00206
00207
00208
00209
00210
00211
00212
00213 struct go_intersection
00214 {
00215 struct go go;
00216 struct geom_point_item geom;
00217 real parameter;
00218 struct anchor a[2];
00219 struct hanger h[1];
00220 u8 unit_coordinate_x, unit_coordinate_y, unit_parameter;
00221 };
00222
00223 enum go_intersection_subtype
00224 {
00225 GOST_INTERSECTION,
00226 GOST_INTERSECTION_MAX,
00227 };
00228
00229 SCHEME SO_go_intersection go_intersection_new(SO_go go1, SO_go go2, SREAL parameter) STRANS ;
00230
00231 SCHEME SO_go_intersection go_intersection_new_on_hanger(SHANGER h1, SHANGER h2, SREAL parameter, SBOOL position_important, SREAL x, SREAL y) STRANS ;
00232
00234 SCHEME SBOOL go_intersection_is_valid(SO_go_intersection i);
00235
00237 SCHEME static inline SBOOL go_intersection_is_position_important(SO_go_intersection i)
00238 { return i->go.flags & GOF_INTERSECTION_INVALID_X; }
00239
00240
00241
00242
00243
00244 struct go_text
00245 {
00246 struct go go;
00247 struct geom_point_item geom;
00248 struct anchor a[1];
00249 struct geom_point apos, rpos;
00250 struct geom_transform *transformation;
00251 int font_id;
00252 real font_size;
00253 string text;
00254 uns fill_color;
00255 struct geom_rectangle string_bbox,
00256 text_bbox;
00257 uns alignment_x, alignment_y;
00258 u8 unit_rpos_x, unit_rpos_y, unit_apos_x, unit_apos_y, unit_coordinate_x, unit_coordinate_y, unit_size;
00259 struct hanger h[];
00260 };
00261
00262 enum go_text_subtype
00263 {
00264 GOST_TEXT,
00265 GOST_TEXT_MAX,
00266 };
00267
00268 SCHEME SO_go_text go_text_new(SHANGER refpoint, SREAL rpos_x, SREAL rpos_y, SREAL apos_x, SREAL apos_y, SSTRINGS text, SINT fontid, SREAL fntsize) STRANS ;
00269
00270 static inline void go_text_get_string_bbox(struct go_text *t, struct geom_rectangle *bbox)
00271 { *bbox = t->string_bbox; }
00272
00273 static inline void go_text_get_text_bbox(struct go_text *t, struct geom_rectangle *bbox)
00274 { *bbox = t->text_bbox; }
00275
00276 static inline void go_text_get_visualisation_point(struct go_text *t, struct geom_point *gp)
00277 { *gp = (struct geom_point) { t->transformation->coef[0][2], t->transformation->coef[1][2] }; }
00278
00279 static inline void go_text_get_transformation(struct go_text *t, struct geom_transform *tr)
00280 { *tr = *t->transformation; }
00281
00282
00283
00284
00285
00286
00287 struct tex_process
00288 {
00289 uns ref_count;
00290 struct garr *glyphs;
00291 uns glyphs_cnt;
00292 struct geom_rectangle bbox;
00293 string text;
00294 };
00295
00296 static inline struct tex_process* tex_process_ref(struct tex_process *tp)
00297 { tp->ref_count++; return tp; }
00298
00299 static inline void tex_process_unref(struct tex_process *tp)
00300 { tp->ref_count--; if(tp->ref_count) return; garr_destroy(tp->glyphs); string_unref(tp->text); xfree(tp); }
00301
00302 struct go_tex_text
00303 {
00304 struct go go;
00305 struct geom_point_item geom;
00306 struct anchor a[1];
00307 struct geom_point apos, rpos;
00308 struct geom_transform *transformation;
00309 struct tex_process *process;
00310 struct geom_rectangle text_bbox;
00311 uns alignment_x, alignment_y;
00312 uns fill_color;
00313 u8 unit_rpos_x, unit_rpos_y, unit_apos_x, unit_apos_y, unit_coordinate_x, unit_coordinate_y;
00314 struct hanger h[];
00315 };
00316
00317 enum go_tex_text_subtype
00318 {
00319 GOST_TEX_TEXT,
00320 GOST_TEX_TEXT_MAX,
00321 };
00322
00323 SCHEME SO_go_tex_text go_tex_text_new(SHANGER refpoint, SREAL rpos_x, SREAL rpos_y, SREAL apos_x, SREAL apos_y, SSTRINGS text) STRANS ;
00324
00325 struct go_tex_text* go_tex_text_new_process(struct hanger* ll, real refp_x, real refp_y, real marg_x, real marg_y, struct tex_process *process);
00326
00327 static inline void go_tex_text_get_text_bbox(struct go_tex_text *t, struct geom_rectangle *bbox)
00328 { *bbox = t->text_bbox; }
00329
00330 static inline void go_tex_text_get_string_bbox(struct go_tex_text *t, struct geom_rectangle *bbox)
00331 { *bbox = t->process->bbox; }
00332
00333 static inline void go_tex_text_get_visualisation_point(struct go_tex_text *t, struct geom_point *gp)
00334 { *gp = (struct geom_point) { t->transformation->coef[0][2], t->transformation->coef[1][2] }; }
00335
00336 static inline void go_tex_text_get_transformation(struct go_tex_text *t, struct geom_transform *tr)
00337 { *tr = *t->transformation; }
00338
00339 void go_tex_text_rerun_tex_process(struct go_tex_text *t);
00340 void group_rerun_tex_process(struct go_group *group);
00341
00342
00343
00344
00345
00346
00347 #define GO_DECORATOR_POINT_MAX_VERTICES 100
00348
00349 struct go_decorator_point
00350 {
00351 struct go go;
00352 struct geom_callback_item geom;
00353 struct anchor a[1];
00354 struct hanger h[1];
00355 struct geom_point x;
00356 uns n;
00357 real radius, rotation;
00358 uns fill_color, stroke_color, stroke_cap, stroke_join, stroke_style;
00359 real stroke_width;
00360 u8 unit_stroke_width, unit_radius, unit_rotation, unit_coordinate_x, unit_coordinate_y;
00361 };
00362
00363 enum go_decorator_point_subtype
00364 {
00365 GOST_DECORATOR_POINT,
00366 GOST_DECORATOR_POINT_MAX,
00367 };
00368
00369 SCHEME SO_go_decorator_point go_decorator_point_new(SHANGER point, SUNS n, SREAL radius, SREAL rotation) STRANS ;
00370
00371
00372
00373
00374
00375
00376 struct go_arrow
00377 {
00378 struct go go;
00379 struct geom_callback_item geom;
00380 struct anchor a[1];
00381 struct geom_point x;
00382 uns reversed;
00383 real rotation, parameter;
00384 real arrow_length;
00385 real arrow_angle;
00386 real front_curvature;
00387 real back_distance;
00388 uns arrow_alignment;
00389 uns arrow_front;
00390 uns arrow_back;
00391 uns fill_color, stroke_color, stroke_cap, stroke_join, stroke_style;
00392 real stroke_width;
00393 u8 unit_stroke_width, unit_arrow_length, unit_rotation, unit_coordinate_x, unit_coordinate_y, unit_arrow_angle, unit_parameter, unit_front_curvature, unit_back_distance;
00394 struct hanger h[];
00395 };
00396
00397 enum go_arrow_subtype
00398 {
00399 GOST_ARROW,
00400 GOST_ARROW_MAX,
00401 };
00402
00403 SCHEME SO_go_arrow go_arrow_new(SO_go go, SREAL parameter, SREAL arrow_length, SREAL rotation) STRANS ;
00404
00405 SCHEME SO_go_arrow go_arrow_new_on_hanger(SHANGER point, SREAL parameter, SREAL arrow_length, SREAL rotation) STRANS ;
00406
00407
00408
00409
00410
00411
00412 struct go_user_description
00413 {
00414 void (* call_dump)(struct go*);
00415 struct go* (* call_duplicate)(struct go*);
00416 void (* call_finish)(struct go*);
00417 void (* call_recompute)(struct go*, struct geom_rectangle*);
00418 void (* call_transform)(struct go*, struct geom_transform*, struct geom_rectangle*);
00419 int (* call_expand)(struct geom_callback_item*, struct geom_fpath*);
00420 int (* call_bbox)(struct go*, const struct geom_transform*, struct geom_rectangle*);
00421 };
00422
00423 extern struct go_user_description *go_user_desc;
00424 extern int go_user_count;
00425
00426 int go_user_register(
00427 string name,
00428 struct go_info *gi,
00429 void (* call_dump)(struct go*),
00430 struct go* (* call_duplicate)(struct go*),
00431 void (* call_finish)(struct go*),
00432 void (* call_recompute)(struct go*, struct geom_rectangle*),
00433 void (* call_transform)(struct go*, struct geom_transform*, struct geom_rectangle*),
00434 int (* call_expand)(struct geom_callback_item*, struct geom_fpath*),
00435 int (* call_bbox)(struct go*, const struct geom_transform*, struct geom_rectangle*));
00436
00437 enum go_user_subtype
00438 {
00439 GOST_USER_MAX,
00440 };
00441
00442 #endif