[Openmcl-devel] iSight progress

Ron Garret ron at awun.net
Tue Jan 29 21:35:06 PST 2008

I've made some progress on the iSight camera front.  This kinda-sorta  
works. (You'll probably need to update the path to the Cam.qtz file,  
which I'm including as an attachment to this email.)

(defun nsstr (s) (make-instance 'gui::ns-lisp-string :string s))

(defparameter +standard-window-style-mask+
   (logior #$NSTitledWindowMask

(defun make-window (x y &optional (title "Untitled"))
   (bind (w (make-instance 'ns:ns-window
              :with-content-rect (ns:make-ns-rect 0 0 x y)
              :style-mask +standard-window-style-mask+
              :backing #$NSBackingStoreBuffered
              :defer t))
     (#/setContentView: w (make-instance 'ns:ns-view))
     (#/setTitle: w (nsstr title))
     (#/center w)
     (#/orderFront: w nil)

(setf w (make-window 300 200))

(objc:load-framework "Quartz" :quartz)
(setf qcv (make-instance 'ns:q-c-view))
(#/loadCompositionFromFile: qcv #@"Cam.qtz")
(#/startRendering qcv)
(#/setContentView: w qcv)

(setf bmrep (#/bitmapImageRepForCachingDisplayInRect:
              (ns:make-ns-rect 0 0 300 200)))

Now whenever I do this:

(#/cacheDisplayInRect:toBitmapImageRep: qcv (ns:make-ns-rect 0 0 300  

it updates the window with the current camera image.  Trick is, the  
resulting image SHOULD be in the bmrep bitmap, but it isn't.  bmrep is  
filled with zeros:

(let ((ptr (#/bitmapData bmrep)))
   (loop for i from 0 below (* 300 200 4) sum (%get-byte ptr i)))  --> 0

This also kinda-sorta works

(#/valueForOutputKey: qcv #@"ImageOutput")

The resulting image resembles the current camera image, but with some  
very weird artifacts.

Any hints on how to proceed from here would be much appreciated.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cam.qtz
Type: application/x-quartzcomposer
Size: 2167 bytes
Desc: not available
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20080129/d5357638/attachment.bin>
-------------- next part --------------

More information about the Openmcl-devel mailing list