CLIM mail archive

[Prev][Next][Index][Thread]

arrows & your answer



    Date: Fri, 7 Aug 1992 03:26 EDT
    From: Ralph.Hensel@gmd.de

    Hi,
    I`m working on Sun with Framz Allegro 4.01 and CLIM 1.0

You need CLIM 1.1

    You wrote that the following will work on SUN as draw-arrow:

    (in-package :clim)
    (define-graphics-operation draw-arrow (x1 y1 x2 y2
					   &key (from-head nil) (to-head t)
						(head-length 10) (head-width 5))
      :arguments ((point x1 y1 x2 y2))
      :drawing-options :line-cap
      :method-body
	(with-transformed-arguments
	  (let* ((dx (- x2 x1))
		 (dy (- y2 y1))
		 (norm (if (zerop dx)
			   (if (zerop dy) nil (/ 1.0 (abs dy)))
			   (if (zerop dy) (/ 1.0 (abs dx)) (/ (sqrt (+ (* dx dx) (* dy dy))))))))
	    (when norm
	      (let* ((length-norm (* head-length norm))
		     (ldx (* dx length-norm))
		     (ldy (* dy length-norm))
		     (base-norm (* head-width norm 0.5))
		     (bdx (* dy base-norm))
		     (bdy (* dx base-norm))
		     (ink (medium-ink stream))
		     (line-style (medium-line-style stream)))
		(draw-line-internal stream 0 0 x1 y1 x2 y2 ink line-style)
		(when from-head
		  (let ((xa (+ x1 ldx)) (ya (+ y1 ldy)))
		    (with-stack-list (points x1 y1 (+ xa bdx) (- ya bdy) (- xa bdx) (+ ya bdy))
		      (draw-polygon-internal stream 0 0 points t ink nil))
		    (setq x1 xa y1 ya)))
		(when to-head
		  (let ((xa (- x2 ldx)) (ya (- y2 ldy)))
		    (with-stack-list (points x2 y2 (+ xa bdx) (- ya bdy) (- xa bdx) (+ ya bdy))
		      (draw-polygon-internal stream 0 0 points t ink nil)
		      (setq x2 xa y2 ya)))))))))

    But what is (with-transformed-arguments ...). It seems that it doesn't work under CLIM 1.0
 
    Ralph Hensel                            
    German National Research Center for Computer Science (GMD-FIT.KI)
    P.O. Box 1316, D-5205 Sankt Augustin, Germany
    mail:hensel@gmdzi.gmd.de fax:+49-2241-14-2889 phone:+49-2241-14-1


References:

Main Index | Thread Index