[Openmcl-devel] iSight progress

R. Matthew Emerson rme at clozure.com
Tue Jan 29 23:25:27 PST 2008


On Jan 30, 2008, at 12:35 AM, Ron Garret wrote:

> (setf qcv (make-instance 'ns:q-c-view))

It might not matter in this case, but NSView and subclasses need to be  
initialized with initWithFrame:.  Something like:

(setf qcv (make-instance 'ns:q-c-view :with-frame (ns:make-ns-rect 0 0  
100 100)))


> (#/loadCompositionFromFile: qcv #@"Cam.qtz")

> (#/startRendering qcv)
> (#/setContentView: w qcv)
>

If I put in (#/setAutostartsRendering: qcv t) and then minimize and  
restore the window, it shows the live camera view.

> (setf bmrep (#/bitmapImageRepForCachingDisplayInRect:
>             qcv
>             (ns:make-ns-rect 0 0 300 200)))
>
>
>
> Now whenever I do this:
>
>
>
> (#/cacheDisplayInRect:toBitmapImageRep: qcv (ns:make-ns-rect 0 0 300  
> 200)
>                                        bmrep)
>

Does -[QCView createSnapshotImageOfType:] work any better?  Since QC  
is drawing to an OpenGL context, maybe the NSView method doesn't do  
the job.



>
>
> 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.
>
> rg
>
> <Cam.qtz>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel




More information about the Openmcl-devel mailing list