[Openmcl-devel] iSight progress
gb at clozure.com
Tue Jan 29 22:26:09 PST 2008
This is a stab in the dark, but ...
A lot of the stuff associated with Quartz Composer seems to (somewhat
confusingly) use OpenGL (instead of Quartz).
If you minimize the window to the dock, is the image still there ?
Or do you just see a black rectangle ?
On Tue, 29 Jan 2008, Ron Garret wrote:
> 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 200)
> 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
> (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.
More information about the Openmcl-devel