00001 #ifndef _VDL_CONTEXT_H_
00002 #define _VDL_CONTEXT_H_
00003
00004 struct vdl_context
00005 {
00006 struct vdl_surface *surface;
00007 short int *command_buffer_cids;
00008 int *command_buffer_offsets;
00009 int command_buffer_used;
00010 int command_buffer_size;
00011 void *command_buffer_args;
00012 int command_buffer_args_used;
00013 int command_buffer_args_size;
00014 xxxnum_t *curve_approx_buffer;
00015 int curve_approx_buffer_size;
00016 };
00017
00018 extern struct vdl_context * vdl_new_context (struct vdl_surface *sf);
00019 extern void vdl_flush_context (struct vdl_context *ct);
00020
00021 extern void vdl_add_point (struct vdl_context *ct, xxxnum_t x, xxxnum_t y);
00022 extern void vdl_add_line (struct vdl_context *ct);
00023
00024 extern void vdl_add_cubic_bezier (struct vdl_context *ct, xxxnum_t x1, xxxnum_t y1, xxxnum_t x2, xxxnum_t y2);
00025 extern void vdl_add_cubic_rational_bezier (struct vdl_context *ct, xxxnum_t x1, xxxnum_t y1, xxxnum_t x2, xxxnum_t y2, xxxnum_t wi, xxxnum_t w1, xxxnum_t w2, xxxnum_t wo);
00026 extern void vdl_add_quadratic_bezier (struct vdl_context *ct, xxxnum_t x1, xxxnum_t y1);
00027 extern void vdl_add_quadratic_rational_bezier (struct vdl_context *ct, xxxnum_t x1, xxxnum_t y1, xxxnum_t wi, xxxnum_t w1, xxxnum_t wo);
00028
00029 extern void vdl_start_path (struct vdl_context *ct);
00030 extern void vdl_close_path (struct vdl_context *ct);
00031
00032 #ifdef _VDL_INTERNAL_
00033
00034 #define CI_ADDR(CT, ID) ((CT) -> command_buffer_args + (CT) -> command_buffer_offsets [ID])
00035 #define CI_TYPE(CT, ID) ((CT) -> command_buffer_cids [ID])
00036
00037 extern short int vdl_cid_add_point;
00038 extern short int vdl_cid_add_line;
00039 extern short int vdl_cid_add_bezier_2n;
00040 extern short int vdl_cid_add_bezier_2r;
00041 extern short int vdl_cid_add_bezier_3n;
00042 extern short int vdl_cid_add_bezier_3r;
00043 extern short int vdl_cid_start_path;
00044 extern short int vdl_cid_close_path;
00045
00046 struct ci_point
00047 {
00048 xxxnum_t x, y;
00049 };
00050
00051 struct ci_bezier_2n
00052 {
00053 xxxnum_t x1, y1;
00054 };
00055
00056 struct ci_bezier_2r
00057 {
00058 xxxnum_t x1, y1, wi, w1, wo;
00059 };
00060
00061 struct ci_bezier_3n
00062 {
00063 xxxnum_t x1, y1, x2, y2;
00064 };
00065
00066 struct ci_bezier_3r
00067 {
00068 xxxnum_t x1, y1, x2, y2, wi, w1, w2, wo;
00069 };
00070
00071 extern void vdl_context_init (void);
00072 extern void vdl_fill_bezier (struct vdl_context *ct, struct geom_bezier *b, int offset, double x1, double y1, double x2, double y2);
00073 extern int vdl_register_context_item (const char *name, int size);
00074 extern int vdl_new_context_item (struct vdl_context *ct, short int cid);
00075
00076 #endif
00077 #endif