[Openmcl-devel] XFillPolygon

Taoufik Dachraoui taoufik at mazeboard.com
Sun Mar 7 10:42:30 UTC 2010


I found what is wrong in the code to fill a polygon, actually I had many
errors in the code and I corrected it as follows:

(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."
    `(let ((i 0) (npoints (length ,points)))
       (ccl::%stack-block ((xpoints (* (ccl::foreign-size :<XP>oint :bytes)
       (1+ npoints))))
 (dolist (p ,points)
   (rlet ((xpoint :<XP>oint))
 (setf (pref xpoint :<XP>oint.x) (car p))
 (setf (pref xpoint :<XP>oint.y) (cadr p))
 (setf (paref xpoints (:* :<XP>oint) i) xpoint)
 (incf i)))
 (#_XFillPolygon *display*
 (window *context*)
 (graphics-context *context*)
 xpoints
 npoints
 ,shape
 ,mode
 ))))


Kind regards
Taoufik

On Sun, Mar 7, 2010 at 9:50 AM, Taoufik Dachraoui <taoufik at mazeboard.com>wrote:

> 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: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20100307/62260ee9/attachment.html>


More information about the Openmcl-devel mailing list