[cl-gd-devel] Adding get-pixel
Alan Shields
Alan-Shields at omrf.ouhsc.edu
Fri May 6 23:33:37 UTC 2005
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
More information about the Cl-gd-devel
mailing list