From: Stephen Adams Date: Fri, 12 Jul 1996 20:12:15 +0000 (+0000) Subject: Fixed X-GRAPHICS-DRAW-ARC to do the right thing when the X and/or Y X-Git-Tag: 20090517-FFI~5483 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=c22626c842cdf7e9fd6a481413541f44cf95a2f7;p=mit-scheme.git Fixed X-GRAPHICS-DRAW-ARC to do the right thing when the X and/or Y axes are flipped. --- diff --git a/v7/src/microcode/x11graph.c b/v7/src/microcode/x11graph.c index f48f1ff90..9d2f77f00 100644 --- a/v7/src/microcode/x11graph.c +++ b/v7/src/microcode/x11graph.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: x11graph.c,v 1.35 1996/07/12 17:52:28 adams Exp $ +$Id: x11graph.c,v 1.36 1996/07/12 20:12:15 adams Exp $ Copyright (c) 1989-95 Massachusetts Institute of Technology @@ -482,15 +482,33 @@ If FILL? is true, the arc is filled.") float angle_start = arg_real_number (6); float angle_sweep = arg_real_number (7); + /* we assume a virtual coordinate system with X increasing left to + * right and Y increasing top to bottom. If we are wrong then we + * have to flip the axes and adjust the angles */ + int x1 = X_COORDINATE (virtual_device_x - radius_x, xw); int x2 = X_COORDINATE (virtual_device_x + radius_x, xw); - int y1 = Y_COORDINATE (virtual_device_y - radius_y, xw); - int y2 = Y_COORDINATE (virtual_device_y + radius_y, xw); + int y1 = Y_COORDINATE (virtual_device_y + radius_y, xw); + int y2 = Y_COORDINATE (virtual_device_y - radius_y, xw); int width, height; - int angle1 = ((int)(angle_start * 64)); + int angle1 = ((int)(angle_start * 64)) % (64*360); int angle2 = ((int)(angle_sweep * 64)); - if (x2 a b2)) + (graphics-draw-text g (fx a) (fy a) "."))) + + (graphics-draw-text g (fx a1) (fy a1) ".Start") + (graphics-draw-text g (fx (+ a1 a2)) (fy (+ a1 a2)) ".End"))) + +;; Test axes +(test 1 1 30 90) +(test -1 1 30 90) +(test 1 -1 30 90) +(test -1 -1 30 90) + +;; Test angles +(test 1 1 30 90) +(test 1 1 30 -90) +(test 1 1 -30 90) +(test 1 1 -30 -90) + ***********************************************************************/ + DEFINE_PRIMITIVE ("X-GRAPHICS-DRAW-STRING", Prim_x_graphics_draw_string, 4, 4, "(X-GRAPHICS-DRAW-STRING WINDOW X Y STRING)\n\ Draw characters in the current font at the given coordinates.")