[cl-gd-devel] fill shapes with transformation?
Edi Weitz
edi at agharta.de
Sat Oct 20 14:25:55 UTC 2007
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.
More information about the Cl-gd-devel
mailing list