Skip to content
Browse files

export do-pixels and friends, clean up :: usage, get rid of some magi…

…c numbers in gif writing
  • Loading branch information...
1 parent 010958a commit 5381afb72a50f2cd432b760caea26356675f6239 @slyrus slyrus committed Mar 13, 2011
Showing with 24 additions and 12 deletions.
  1. +13 −10 gif.lisp
  2. +9 −0 package.lisp
  3. +2 −2 tiff.lisp
View
23 gif.lisp
@@ -53,20 +53,23 @@
(* (round (/ b (/ max-val (1- b-levels))))
(/ max-val (1- b-levels)))))
+(defparameter *red-levels* 6)
+(defparameter *green-levels* 6)
+(defparameter *blue-levels* 6)
+
(defun 8-bit-rgb-image-to-skippy-image (image color-table)
(with-image-bounds (height width)
image
(let ((gif-image (skippy:make-image :height height :width width)))
- (let ((color-map (uniform-color-map 6 6 6)))
- (do-pixels (i j) image
- (multiple-value-bind (r g b)
- (pixel image i j)
- (multiple-value-bind (assigned-r assigned-g assigned-b)
- (assign-color r g b 6 6 6)
- (let ((color-index (skippy:ensure-color
- (skippy:rgb-color assigned-r assigned-g assigned-b)
- color-table)))
- (setf (skippy:pixel-ref gif-image j i) color-index))))))
+ (do-pixels (i j) image
+ (multiple-value-bind (r g b)
+ (pixel image i j)
+ (multiple-value-bind (assigned-r assigned-g assigned-b)
+ (assign-color r g b *red-levels* *green-levels* *blue-levels*)
+ (let ((color-index (skippy:ensure-color
+ (skippy:rgb-color assigned-r assigned-g assigned-b)
+ color-table)))
+ (setf (skippy:pixel-ref gif-image j i) color-index)))))
gif-image)))
(defun write-gif-stream (stream image)
View
9 package.lisp
@@ -9,6 +9,12 @@
#:pixel
#:pixel*
+ #:do-pixels
+ #:set-pixels
+
+ #:do-region-pixels
+ #:set-region-pixels
+
#:1-bit-gray-image #:make-1-bit-gray-image
#:2-bit-gray-image #:make-2-bit-gray-image
#:4-bit-gray-image #:make-4-bit-gray-image
@@ -44,6 +50,8 @@
#:sharpen-image
#:blur-image
+ #:clear-image
+
;; Drawing primitives
#:fill-image
#:fill-image*
@@ -111,6 +119,7 @@
#:convert-image-to-grayscale-luminance
#:convert-image-to-rgb
#:convert-image-to-rgba
+ #:convert-image-to-8-bit-grayscale
))
View
4 tiff.lisp
@@ -15,8 +15,8 @@ image or an 8-bit grayscale image"
(samples-per-pixel tiff:tiff-image-samples-per-pixel)
(bits-per-sample tiff:tiff-image-bits-per-sample)
(image-data tiff:tiff-image-data)
- (color-map tiff::tiff-image-color-map)
- (min-is-white tiff::tiff-image-min-is-white))
+ (color-map tiff:tiff-image-color-map)
+ (min-is-white tiff:tiff-image-min-is-white))
tiff-image
(cond

0 comments on commit 5381afb

Please sign in to comment.
Something went wrong with that request. Please try again.