[cl-gd-devel] fill shapes with transformation?

Jeff Cunningham jeffrey at cunningham.net
Sun Oct 21 14:29:49 UTC 2007


Edi Weitz wrote:
> On Fri, 19 Oct 2007 18:51:43 -0700, Jeff Cunningham <jeffrey at cunningham.net> wrote:
>
>   
>> (with-image* (200 200)
>>   (allocate-color 68 70 85)
>>   (let ((fn "test.png")
>>     (red (allocate-color 255 0 0))
>>     (white (allocate-color 255 255 255))
>>     (blue (allocate-color 0 0 100)))
>>     (with-transformation (:x1 -100 :x2 100 :y1 -100 :y2 100)
>>       (draw-rectangle* -30 -30 30 30 :color red :filled t)
>>       (draw-rectangle* -20 -20 20 20 :color blue :filled nil))
>>     (without-transformations
>>       (draw-rectangle* 95 95 105 105 :color white :filled t))
>>     (write-image-to-file fn :if-exists :supersede)
>>     (sb-ext:run-program "/usr/bin/xv" (list fn))))
>>     
>
> This works for me:
>
>   (with-image* (200 200)
>     (allocate-color 68 70 85)
>     (let ((fn "test.png")
>       (red (allocate-color 255 0 0))
>       (white (allocate-color 255 255 255))
>       (blue (allocate-color 0 0 100)))
>       (with-transformation (:x1 -100 :x2 100 :y1 -100 :y2 100)
>         (draw-rectangle* -30 30 30 -30 :color red :filled t)
>         (draw-rectangle* -20 20 20 -20 :color blue :filled nil))
>       (without-transformations
>         (draw-rectangle* 95 95 105 105 :color white :filled t))
>       (write-image-to-file fn :if-exists :supersede)
>       (sb-ext:run-program "/usr/bin/display" (list fn))))
>
> Note that the docstring for DRAW-RECTANGLE* explicitely talks about
> the "upper left" corner and the "lower right" corner.
>
> Cheers,
> Edi.
>   
Ah-ha! - I see it now on closer reading. I was blinded by the usual 
graphing convention y1 < y2. It is curious that it would draw the 
unfilled rectangle at all.

Thank you.
--Jeff




More information about the Cl-gd-devel mailing list