From jeffrey at cunningham.net Sat Oct 20 01:51:43 2007 From: jeffrey at cunningham.net (Jeff Cunningham) Date: Fri, 19 Oct 2007 18:51:43 -0700 Subject: [cl-gd-devel] fill shapes with transformation? Message-ID: <47195F2F.9080509@cunningham.net> Hi; I'm probably doing something wrong, but I can't figure out how to draw rectangles with a fill color using a transformation. The code below illustrates the problem I'm having. The first draw-rectangle should be filled in red. It isn't drawn at all. The second rectangle is outlined in blue as it should be. Both these two use a transformation to place the rectangle. The third does not and it fills just fine. Is this expected behavior? Or am I doing something wrong? Thanks. --Jeff (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)))) From edi at agharta.de Sat Oct 20 14:25:55 2007 From: edi at agharta.de (Edi Weitz) Date: Sat, 20 Oct 2007 16:25:55 +0200 Subject: [cl-gd-devel] fill shapes with transformation? In-Reply-To: <47195F2F.9080509@cunningham.net> (Jeff Cunningham's message of "Fri, 19 Oct 2007 18:51:43 -0700") References: <47195F2F.9080509@cunningham.net> Message-ID: On Fri, 19 Oct 2007 18:51:43 -0700, Jeff Cunningham 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. From jeffrey at cunningham.net Sun Oct 21 14:29:49 2007 From: jeffrey at cunningham.net (Jeff Cunningham) Date: Sun, 21 Oct 2007 07:29:49 -0700 Subject: [cl-gd-devel] fill shapes with transformation? In-Reply-To: References: <47195F2F.9080509@cunningham.net> Message-ID: <471B625D.4050204@cunningham.net> Edi Weitz wrote: > On Fri, 19 Oct 2007 18:51:43 -0700, Jeff Cunningham 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