X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=convert.lisp;h=f6daab1836fce334f8652dd5fdaca3ea06fb6355;hb=647acda15d0d197a829dbdb928afeadd8800c381;hp=34eac1b69e05ea4442fe518a51ab7036bcdac07f;hpb=0c8ab037b4267adebe22e07249e0e36fe7ca5f17;p=cl-photo.git diff --git a/convert.lisp b/convert.lisp index 34eac1b..f6daab1 100755 --- a/convert.lisp +++ b/convert.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: April 2005 ;;;; -;;;; $Id: package.lisp 8596 2004-02-03 18:32:50Z kevin $ +;;;; $Id$ ;;;; ;;;; This file, part of cl-photo, is Copyright (c) 2005 by Kevin Rosenberg. ;;;; Rights of modification and redistribution are in the LICENSE file. @@ -17,17 +17,52 @@ (in-package #:photo) (defconstant +radian->degrees+ (/ 360d0 pi 2)) -(defconstant +inches->mm+ 25.4) +(defconstant +inches->mm+ 25.4d0) +(declaim (inline diagonal)) (defun diagonal (x y) (sqrt (+ (* x x) (* y y)))) +(declaim (inline radians->degrees)) (defun radians->degrees (r) (* +radian->degrees+ r)) +(declaim (inline degrees->radians)) +(defun degrees->radians (r) + (/ r +radian->degrees+)) + +(declaim (inline mm->feet)) (defun mm->feet (d) (/ d +inches->mm+ 12)) +(declaim (inline feet->mm)) (defun feet->mm (d) (* d 12 +inches->mm+)) +(declaim (inline inches->mm)) +(defun inches->mm (d) + (* d +inches->mm+)) + +(defun format-dimensions (format) + "Returns format dimensions in mm." + (ecase format + (:aps-c (cons 22.7 15.1)) + ((:aps :dx) (cons 24 16)) + ((:35 :35mm) (cons 36 24)) + ((:645 :6x4.5cm) (cons 60 45)) + ((:6x6 :6x6cm) (cons 60 60)) + ((:6x7 :6x7cm) (cons 60 70)) + ((:6x9 :6x9cm) (cons 60 90)) + ((:4x5 :4x5in) (cons (* 4 +inches->mm+) (* 5 +inches->mm+))) + ((:5x7 :5x7in) (cons (* 5 +inches->mm+) (* 7 +inches->mm+))) + ((:8x10 :8x10in) (cons (* 8 +inches->mm+) (* 10 +inches->mm+))) + (:11x13.75in (cons (* 11 +inches->mm+) (* 13.75 +inches->mm+))) + (:11x16.5in (cons (* 11 +inches->mm+) (* 16.5 +inches->mm+))) + (:13x19in (cons (* 13 +inches->mm+) (* 19 +inches->mm+))) + (:16x20in (cons (* 13 +inches->mm+) (* 19 +inches->mm+))) + (:16x24in (cons (* 13 +inches->mm+) (* 19 +inches->mm+))) + (:18x22.5in (cons (* 13 +inches->mm+) (* 19 +inches->mm+))) + (:18x24in (cons (* 13 +inches->mm+) (* 19 +inches->mm+))) + (:24x30in (cons (* 13 +inches->mm+) (* 19 +inches->mm+))) + (:24x36in (cons (* 13 +inches->mm+) (* 19 +inches->mm+))) + ))