[Openmcl-devel] XFillPolygon

Taoufik Dachraoui taoufik at mazeboard.com
Sun Mar 7 00:50:07 PST 2010


Good Morning,


I am trying to write x/fillpolygon macro (see below) to call XFillPolygon as
defined below:

XFillPolygon(*display*, *d*, *gc*, *points*, *npoints*, *shape*, *mode*)
      Display <http://tronche.com/gui/x/xlib/display/opening.html#Display>
**display*;
      Drawable *d*;
      GC <http://tronche.com/gui/x/xlib/GC/manipulating.html> *gc*;
      XPoint <http://tronche.com/gui/x/xlib/graphics/drawing/#XPoint> **points*;
      int *npoints*;
      int *shape*;
      int *mode*;



(defmacro x/fillpolygon (points &key (shape #$Complex) (mode
#$CoordModeOrigin))
"points is a list of pairs, shape is one of Complex, Convex,  or Nonconvex,
and
mode is one of CoordModeOrigin or CoordModePrevious."
    `(rlet ((xpoints (:array :<XP>oint ,(length points))))
       (let ((i 0))
 (dolist (p ,points)
   (rlet ((xpoint :<XP>oint))
 (setf (pref xpoint :<XP>oint.x) (car p))
 (setf (pref xpoint :<XP>oint.y) (cdr p))
 (setf (paref xpoints (:array :<XP>oint ,(length points)) i) xpoint)
 (incf i)))
 (#_XFillPolygon *display*
 (window *context*)
 (graphics-context *context*)
 xpoints
 ,(length points)
 ,shape
 ,mode
 ))))


I am not sure if I am correctly defining xpoints, what is the correct code
to call #_XFillPolygon?

example of usage:

> (x/fillpolygon '((100 40) (140 50) (130 60)))


Kind regards
Taoufik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20100307/7cdd8411/attachment.htm>


More information about the Openmcl-devel mailing list