Abstract
XPM is a image format in which the image's data is represented using text. XPM files are commonly used as a simple way to load graphics into C programs.
This complete XPM library, with the help of SKIPPY, will let you convert XPM files directly to GIFs. Also, and this is where the real fun comes in, you can load your XPM files to a SKIPPY canvas and create animated GIFs.
The code comes with a BSD-style license so you can do with it whatever you want.Download shortcut: http://www.jeremyenglish.org/packs/xpm-to-gif.tar.gz.
(defun walk-ghost (output-file) (let* ((color-table (make-color-table)) (red-ghost-1 (canvas-image (xpm-file-to-canvas #p"ghost-r2.xpm" color-table))) (red-ghost-2 (canvas-image (xpm-file-to-canvas #p"ghost-r1.xpm" color-table))) (data-stream (make-data-stream :height 100 :width 384 :color-table color-table))) (dotimes (i 74) (let ((image (make-image :height (height red-ghost-1) :width (width red-ghost-1) :delay-time 5 :image-data (if (zerop (mod i 2)) (image-data red-ghost-1) (image-data red-ghost-2)) :transparency-index (ensure-color 0 color-table) :disposal-method :restore-previous :top-position 18 :left-position (* 5 i)))) (add-image image data-stream))) (setf (loopingp data-stream) t) (output-data-stream data-stream output-file)))
[Function]
xpm-file-to-canvas file-name color-table &key none-color => result
The none-color is the color that is used in place of XPM's transparent color.
[Function]
xpm-file-to-gif input-file output-file &key none-color => result
Takes the name of a gif input file, XPM output file and a optional none-color. The none-color is the color that is used in place of XPM's transparent color.
This documentation was prepared with DOCUMENTATION-TEMPLATE.
BACK TO MY HOMEPAGE