15. Bezier Arrow

Like an arrow, but with a bezier curved line.

<<funcdefs>>=
void btprnt_draw_bezier_arrow(btprnt_region *r,
                              int start_x, int start_y,
                              int end_x, int end_y,
                              int ctrl_x, int ctrl_y,
                              int arrow_start,
                              int arrow_end,
                              int c);

Internally, this is done by drawing two arrowheads pointing away from a control point, then drawing a bezier curve connecting those two points.

<<funcs>>=
void btprnt_draw_bezier_arrow(btprnt_region *r,
                              int start_x, int start_y,
                              int end_x, int end_y,
                              int ctrl_x, int ctrl_y,
                              int arrow_start,
                              int arrow_end,
                              int c)
{
    btprnt_draw_arrow(r,
                      start_x, start_y,
                      ctrl_x, ctrl_y,
                      1, 0, 0, c);

    btprnt_draw_arrow(r,
                      end_x, end_y,
                      ctrl_x, ctrl_y,
                      1, 0, 0, c);

    btprnt_draw_bezier(r,
                       start_x, start_y,
                       ctrl_x, ctrl_y,
                       end_x, end_y,
                       c);
}



prev | home | next