Re: region-polygon

Espen S Johnsen <[email protected]> 25 Aug 2006 12:58:51 +0200
Newsgroups gmane.lisp.clg.devel
Message-ID <[email protected]>
[email protected] writes:

> I want to define a binding for the region-polygon function
> 
> (defbinding region-polygon () pointer
>    (points (vector point))
>    (howmany int)
>    (fill int))
> 
> It seems work fine but want I call it I get a crash
> 
> I have tried with
> 
> (gdk::region-polygon  #((0 0) (1 1) (0 1) (0 0)) 4 0)
> 
> and
> 
> (gdk::region-polygon  #(#(0 0) #(1 1) #(0 1) #(0 0)) 4 0)

This crashes because (vector points) is interpreted as a vector of
pointers to points and not a vector of points. The correct (and
improved) definition would be

(defbinding region-polygon () region
   (points (vector (inlined point)))
   ((length points) int)
   (fill-rule fill-rule))

but I haven't added this as the code in CVS already contains an
alternative method to create rectangles:

GDK> (make-instance 'region :polygon #((0 0) (1 1) (0 1) (0 0)) :fill-rule :even-odd-rule)
#<REGION at 0x829C7F0>

-- 
Espen

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642