[cello-cvs] CVS cello/cl-magick

ktilton ktilton at common-lisp.net
Thu Aug 31 17:34:48 UTC 2006


Update of /project/cello/cvsroot/cello/cl-magick
In directory clnet:/tmp/cvs-serv29491/cl-magick

Modified Files:
	cl-magick.lisp cl-magick.lpr wand-image.lisp 
Log Message:
important fixes to cl-magick and cello demo nehe-06

--- /project/cello/cvsroot/cello/cl-magick/cl-magick.lisp	2006/08/28 21:45:25	1.10
+++ /project/cello/cvsroot/cello/cl-magick/cl-magick.lisp	2006/08/31 17:34:48	1.11
@@ -20,7 +20,7 @@
 ;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
 ;;; IN THE SOFTWARE.
 
-;;; $Id: cl-magick.lisp,v 1.10 2006/08/28 21:45:25 ktilton Exp $
+;;; $Id: cl-magick.lisp,v 1.11 2006/08/31 17:34:48 ktilton Exp $
 
 
 (defpackage :cl-magick
@@ -34,7 +34,7 @@
      #+kt-opengl
      #:kt-opengl ;; wands as opengl textures
      )
-  (:export #:wand-manager #:wand-ensure-typed
+  (:export #:cl-magick-init #:cl-magick-reset #:wand-manager #:wand-ensure-typed
     #:wands-clear #:wand-pixels #:wand-texture 
     #:wand-render
     #:image-size #:wand-texture-activate #:xim
@@ -77,27 +77,23 @@
 (cffi:define-foreign-library Wand
   (:darwin (:or "/usr/local/lib/libWand.dylib")))
 
-;-------------------------------------------------------------------
+;; Order matters! First, load Wand then Magick on Darwin
 
-(defun cl-magick-init ()
-  (or *imagick-dll-loaded*
-    (progn
-      ;(print "clearing magick wands")
-      ;(wands-clear)
-
-      ;; Order matters! First, load Wand then Magick on Darwin
-      #+macosx
-      (cffi:use-foreign-library Wand)
+#+macosx
+(cffi:use-foreign-library Wand)
       
-      (assert (setq *imagick-dll-loaded*
-		    (cffi:use-foreign-library Magick))
-        () "Unable to load imagick" )
-      (print `(magick-copyright ,(magick-get-copyright)))
-      (print `(magick-version ,(magick-get-version *mgk-version*)))
-      *imagick-dll-loaded*)))
+(cffi:use-foreign-library Magick)
+
+;-------------------------------------------------------------------
 
-#+test
-(cl-magick-init)
+(defun cl-magick-init ()) ;; vestigial
+
+(defun cl-magick-reset ()
+  (wands-clear)
+  #+shhh (progn
+           (print `(magick-copyright ,(magick-get-copyright)))
+           (print `(magick-version ,(magick-get-version *mgk-version*))))
+  )
 
 (defun wands-loaded () *wands-loaded*)
 
@@ -113,14 +109,14 @@
   (when file-path$
     (cl-magick-init)
     (let ((key (list* wand-type (namestring file-path$) iargs)))
-      (or (let ((old nil #+nope (cdr (assoc key (wands-loaded) :test 'equal)))) ;;/// primitive test
-            (when old
+      (or (let ((old (cdr (assoc key (wands-loaded) :test 'equal)))) ;;/// primitive test
+           #+shhhh (when old
               (print `(wand-ensure-typed re-using prior load ,wand-type ,file-path$)))
             old)
         (let ((wi (apply 'make-instance wand-type
                     :file-path$ file-path$
                     iargs)))
-          ;;(print `(wand-ensure-typed forced to load ,wand-type ,file-path$))
+          (print `(wand-ensure-typed forced-to-load ,wand-type ,file-path$))
           (push (cons key wi) (wands-loaded))
           wi)
         (error "Unable to load image file ~a" file-path$)))))
--- /project/cello/cvsroot/cello/cl-magick/cl-magick.lpr	2006/08/21 04:28:28	1.6
+++ /project/cello/cvsroot/cello/cl-magick/cl-magick.lpr	2006/08/31 17:34:48	1.7
@@ -1,4 +1,4 @@
-;; -*- lisp-version: "8.0 [Windows] (Jul 24, 2006 15:27)"; cg: "1.81"; -*-
+;; -*- lisp-version: "8.0 [Windows] (Aug 24, 2006 21:48)"; cg: "1.81"; -*-
 
 (in-package :cg-user)
 
--- /project/cello/cvsroot/cello/cl-magick/wand-image.lisp	2006/08/28 18:42:26	1.6
+++ /project/cello/cvsroot/cello/cl-magick/wand-image.lisp	2006/08/31 17:34:48	1.7
@@ -99,7 +99,7 @@
     (let* ((columns (- last-col first-col))
            (rows (- last-row first-row))
            (pixels (fgn-alloc :unsigned-char (* 3 columns rows) :wand-image)))
-      
+      (assert (not (zerop pixels))() "wand-get-image-pixels > fgn-alloc of ~a bytes failed" (* 3 columns rows))
       ;;(print (list "wand-get-image-pixels got" wand (* 3 columns rows) pixels)) ;; frgo: debug ...
       ;;(cells:trc "image format" wand (magick-get-image-format wand)) ;; frgo:debug...
       (magick-get-image-pixels wand first-col first-row columns rows "RGB" 0 pixels )




More information about the Cello-cvs mailing list