/usr/share/common-lisp/source/mcclim/Extensions/Bitmap-formats/tiff.lisp is in cl-mcclim 0.9.6.dfsg.cvs20100315-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ;;; -*- Mode: Lisp; Package: MCCLIM-IMAGES -*-
;;; (c) copyright 2009 by
;;; Cyrus Harmon (ch-lisp@bobobeach.com)
;;;
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Library General Public
;;; License as published by the Free Software Foundation; either
;;; version 2 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; Library General Public License for more details.
;;;
;;; You should have received a copy of the GNU Library General Public
;;; License along with this library; if not, write to the
;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;;; Boston, MA 02111-1307 USA.
(in-package :clim-internals)
(define-bitmap-file-reader :tiff (pathname)
(let ((tiff-image (tiff:read-tiff-file pathname)))
(with-accessors ((height tiff:tiff-image-length)
(width tiff:tiff-image-width)
(ncomp tiff:tiff-image-samples-per-pixel)
(data tiff:tiff-image-data))
tiff-image
(let* ((array (make-array (list height width)
:element-type '(unsigned-byte 32))))
(case ncomp
(3
(dotimes (x width)
(dotimes (y height)
(let ((red (aref data (+ (* x 3) (* y width 3))))
(green (aref data (+ (* x 3) (* y width 3) 1)))
(blue (aref data (+ (* x 3) (* y width 3) 2))))
(setf (aref array y x)
(dpb red (byte 8 0)
(dpb green (byte 8 8)
(dpb blue (byte 8 16)
(dpb (- 255 0) (byte 8 24) 0)))))))))
(1
(dotimes (x width)
(dotimes (y height)
(let ((gray (aref data (+ x (* y width)))))
(setf (aref array y x)
(dpb gray (byte 8 0)
(dpb gray (byte 8 8)
(dpb gray (byte 8 16)
(dpb (- 255 0) (byte 8 24) 0))))))))))
array))))
(define-bitmap-file-reader :tif (pathname)
(read-bitmap-file pathname :format :tiff))
|