From edi at agharta.de Fri May 6 21:36:10 2005 From: edi at agharta.de (Edi Weitz) Date: Fri, 06 May 2005 23:36:10 +0200 Subject: [cl-gd-devel] Re: cl-gd: random access to pixels? In-Reply-To: <4811.69.195.13.42.1115395433.squirrel@www.clearspot.net> (Cameron MacKinnon's message of "Fri, 6 May 2005 12:03:53 -0400 (EDT)") References: <4811.69.195.13.42.1115395433.squirrel@www.clearspot.net> Message-ID: [Cc to mailing list] Hi Cameron! On Fri, 6 May 2005 12:03:53 -0400 (EDT), "Cameron MacKinnon" wrote: > I'm trying to use cl-gd to get random access to an image's pixels; > in my code, I won't be processing every pixel, so row and column > iterators that cover the whole image are no good to me. > > I tried using a clipping rectangle: > (cl-gd:with-clipping-rectangle* (mask :image old) > (cl-gd:do-rows (y old) > (cl-gd:do-pixels-in-row (x) > ... > ... but that didn't work; every pixel was processed. Yes, DO-ROWS doesn't observe clipping rectangles yet. It'd probably be a good idea to do that in the future. > There appears to be no function exposed in cl-gd to get the raw > value of an arbitrarily located pixel. Is this true? Yes. > Where would I start if I needed to hack in such functionality? > gdImageGetPixel? Depending on the type of the image you have to look into the PIXELS or T-PIXELS slot of the GD-IMAGE structure - see file gd-uffi.lisp. Probably the best way to proceed is to look how DO-ROWS is defined. Cheers, Edi. PS: I'll be on vacation next week so I won't be able to answer further questions at that time. From Alan-Shields at omrf.ouhsc.edu Fri May 6 23:33:37 2005 From: Alan-Shields at omrf.ouhsc.edu (Alan Shields) Date: Fri, 6 May 2005 18:33:37 -0500 Subject: [cl-gd-devel] Adding get-pixel Message-ID: <20050506233337.GX14800@inquisitor.omrf.org> Please find enclosed a patch which adds a lisp interface to get-pixel. I have attempted to conform to your style, I hope I have succeeded. Thank you for the great work, Alan Shields diff -u cl-gd-0.4.6-old/drawing.lisp cl-gd-0.4.6/drawing.lisp --- cl-gd-0.4.6-old/drawing.lisp 2005-03-09 08:17:56.000000000 -0600 +++ cl-gd-0.4.6/drawing.lisp 2005-05-06 17:29:49.000000000 -0500 @@ -39,6 +39,14 @@ (gd-image-set-pixel (img image) x y color))) (values x y)) +(defun get-pixel (x y &key (image *default-image*)) + "Gets the color associated with point \(X,Y)." + (check-type image image) + (with-transformed-alternative + ((x x-transformer) + (y y-transformer)) + (gd-image-get-pixel (img image) x y))) + (defgeneric set-pixels (points &key color image) (:documentation "Draws a list \(X1 Y1 X2 Y2 ...) or vector #\(X1 Y1 X2 Y2 ...) of pixels.")) diff -u cl-gd-0.4.6-old/packages.lisp cl-gd-0.4.6/packages.lisp --- cl-gd-0.4.6-old/packages.lisp 2005-03-09 03:11:30.000000000 -0600 +++ cl-gd-0.4.6/packages.lisp 2005-05-06 17:38:25.432847326 -0500 @@ -51,6 +51,7 @@ #:draw-line #:set-pixel #:set-pixels + #:get-pixel #:draw-rectangle #:draw-rectangle* #:draw-arc From edi at agharta.de Sat May 7 00:09:56 2005 From: edi at agharta.de (Edi Weitz) Date: Sat, 07 May 2005 02:09:56 +0200 Subject: New version 0.4.7 (Was: [cl-gd-devel] Adding get-pixel) In-Reply-To: <20050506233337.GX14800@inquisitor.omrf.org> (Alan Shields's message of "Fri, 6 May 2005 18:33:37 -0500") References: <20050506233337.GX14800@inquisitor.omrf.org> Message-ID: On Fri, 6 May 2005 18:33:37 -0500, Alan Shields wrote: > Please find enclosed a patch which adds a lisp interface to get-pixel. Thanks Alan, I've released a new version (0.4.7) which includes your patch. Cheers, Edi. From edi at agharta.de Sun May 15 13:12:41 2005 From: edi at agharta.de (Edi Weitz) Date: Sun, 15 May 2005 15:12:41 +0200 Subject: [cl-gd-devel] Re: GIF support in CL-GD In-Reply-To: <200505120025.52684.ygingras@ygingras.net> (Yannick Gingras's message of "Thu, 12 May 2005 00:25:48 -0400") References: <200505120025.52684.ygingras@ygingras.net> Message-ID: [Cc to mailing list] Hi! Sorry for the late reply - I was on vacation. On Thu, 12 May 2005 00:25:48 -0400, Yannick Gingras wrote: > Hi, had to install CL-GD on a machine that didn't have the GIF > support. I incorporated a test in the Makefile of the wrapper code > to remove the dependency on GIF related functions if GIF support was > not detected on the host machine: > > http://adn.bioinfo.uqam.ca/~gingras_y/cl-gd-0.4.7-test.tar.bz2 > > It is probably too ugly to be realesed but I hope it can help you in > doing a version of CL-GD that would work on machines with and > without the GIF support. Thanks for this. As you already guessed I'm a bit reluctant to incorporate this into the release. This is mainly because the Makefile is a contributed file that I don't plan to maintain. With your addition the .asd system defition might be modified by make. I had a very simple "solution" up to version 0.4.1 of CL-GD where you had to manually add a keyword to *FEATURES* in order to build GIF support. I've removed this because I thought that GIF support should be available to all GD users by now. Maybe the easiest way to cope with old GD libs is to revert to the 0.4.1 situation but with GIF support being the default now? Cheers, Edi. From edi at agharta.de Tue May 17 17:02:21 2005 From: edi at agharta.de (Edi Weitz) Date: Tue, 17 May 2005 19:02:21 +0200 Subject: [cl-gd-devel] New version 0.4.8 (Was: GIF support in CL-GD) In-Reply-To: (Edi Weitz's message of "Sun, 15 May 2005 15:12:41 +0200") References: <200505120025.52684.ygingras@ygingras.net> Message-ID: On Sun, 15 May 2005 15:12:41 +0200, Edi Weitz wrote: > Maybe the easiest way to cope with old GD libs is to revert to the > 0.4.1 situation but with GIF support being the default now? I've now uploaded 0.4.8 which does that. No other changes so happy users of 0.4.7 don't need to upgrade. Cheers, Edi.