00001 #ifndef DRAW_H_HEADER_INCLUDED
00002 #define DRAW_H_HEADER_INCLUDED
00003
00004 typedef struct ASDrawTool
00005 {
00006 int width;
00007 int height;
00008 int center_x, center_y ;
00009 CARD32 *matrix ;
00010 }ASDrawTool;
00011
00012 typedef struct ASDrawContext
00013 {
00014 #define ASDrawCTX_UsingScratch (0x01<<0)
00015 #define ASDrawCTX_CanvasIsARGB (0x01<<1)
00016 #define ASDrawCTX_ToolIsARGB (0x01<<2)
00017 ASFlagType flags ;
00018
00019 ASDrawTool *tool ;
00020
00021 int canvas_width, canvas_height ;
00022 CARD32 *canvas ;
00023 CARD32 *scratch_canvas ;
00024
00025 int curr_x, curr_y ;
00026
00027 void (*apply_tool_func)( struct ASDrawContext *ctx, int curr_x, int curr_y, CARD32 ratio );
00028 void (*fill_hline_func)( struct ASDrawContext *ctx, int x_from, int y, int x_to, CARD32 ratio );
00029 }ASDrawContext;
00030
00031 #define AS_DRAW_BRUSHES 3
00032
00033 ASDrawContext *create_asdraw_context( unsigned int width, unsigned int height );
00034 Bool apply_asdraw_context( ASImage *im, ASDrawContext *ctx, ASFlagType filter );
00035 void destroy_asdraw_context( ASDrawContext *ctx );
00036
00037 Bool asim_set_brush( ASDrawContext *ctx, int brush );
00038 Bool asim_set_custom_brush( ASDrawContext *ctx, ASDrawTool *brush);
00039 Bool asim_set_custom_brush_colored( ASDrawContext *ctx, ASDrawTool *brush);
00040
00041 Bool asim_start_path( ASDrawContext *ctx );
00042 Bool asim_apply_path( ASDrawContext *ctx, int start_x, int start_y, Bool fill, int fill_start_x, int fill_start_y, CARD8 fill_threshold );
00043
00044 void asim_move_to( ASDrawContext *ctx, int dst_x, int dst_y );
00045 void asim_line_to( ASDrawContext *ctx, int dst_x, int dst_y );
00046 void asim_line_to_aa( ASDrawContext *ctx, int dst_x, int dst_y );
00047 void asim_cube_bezier( ASDrawContext *ctx, int x1, int y1, int x2, int y2, int x3, int y3 );
00048
00049 void asim_straight_ellips( ASDrawContext *ctx, int x, int y, int rx, int ry, Bool fill );
00050 void asim_circle( ASDrawContext *ctx, int x, int y, int r, Bool fill );
00051 void asim_ellips( ASDrawContext *ctx, int x, int y, int rx, int ry, int angle, Bool fill );
00052 void asim_ellips2( ASDrawContext *ctx, int x, int y, int rx, int ry, int angle, Bool fill );
00053 void asim_rectangle( ASDrawContext *ctx, int x, int y, int width, int height );
00054
00055 void asim_flood_fill( ASDrawContext *ctx, int x, int y, CARD32 min_val, CARD32 max_val );
00056
00057 #endif