diff options
Diffstat (limited to 'otherlibs/graph/draw.c')
-rw-r--r-- | otherlibs/graph/draw.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/otherlibs/graph/draw.c b/otherlibs/graph/draw.c index 8b6efac0d..485e3828b 100644 --- a/otherlibs/graph/draw.c +++ b/otherlibs/graph/draw.c @@ -36,13 +36,14 @@ value gr_moveto(value vx, value vy) return Val_unit; } -value gr_current_point(void) +value gr_current_x(void) { - value res; - res = alloc_small(2, 0); - Field(res, 0) = Val_int(grx); - Field(res, 1) = Val_int(gry); - return res; + return Val_int(grx); +} + +value gr_current_y(void) +{ + return Val_int(gry); } value gr_lineto(value vx, value vy) @@ -63,6 +64,25 @@ value gr_lineto(value vx, value vy) return Val_unit; } +value gr_draw_rect(value vx, value vy, value vw, value vh) +{ + int x = Int_val(vx); + int y = Int_val(vy); + int w = Int_val(vw); + int h = Int_val(vh); + + gr_check_open(); + if(grremember_mode) + XDrawRectangle(grdisplay, grbstore.win, grbstore.gc, + x, Bcvt(y) - h + 1, w, h); + if(grdisplay_mode) { + XDrawRectangle(grdisplay, grwindow.win, grwindow.gc, + x, Wcvt(y) - h + 1, w, h); + XFlush(grdisplay); + } + return Val_unit; +} + value gr_draw_arc_nat(value vx, value vy, value vrx, value vry, value va1, value va2) { int x = Int_val(vx); |