For Programmers: Free Programming Magazines  


Home > Archive > Lisp > May 2005 > capi/cocoa capturing









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author capi/cocoa capturing
robbiefcarlton@hotmail.com

2005-05-29, 8:56 pm

I'm having problems capturing images from a canvas using LispWorks capi
gui on mac os x. This is the relevant code.

(defpackage :capture-test
(:add-use-defaults t)
(:use :capi))

(in-package :capture-test)

(defun sv (pane x y)
(save-port-image pane "/Users/robbie/test.bmp"))

(define-interface image-capture-test ()
()
(:panes
(mainpane output-pane
:input-model
'(((:button-1 :press)
sv))
:display-callback
'display-function)))

(defun save-port-image (port file)
(let ((img (gp:externalize-image port (gp:make-image-from-port
port))))
(gp:compress-external-image img)
(gp:write-external-image img
file)))

I'm not sure if I'm using the various external-image manipulation
functions correctly because the documnetation runs a bit dry at that
point, and there's nothing on the internet. When I call save-port-image
I get an error in the externalize-image function saying "in ZEROP of
(NIL) arguments should be of tyoe NUMBER"
If anyone has encountered this problem before, or has experience with
the capi, or even the source code for externalize-image (that'd be
nice) I'd love some help. Thanks, and sorry to the 99% of you for whom
this is completely tedious.
rob c

Raffael Cavallaro

2005-05-31, 4:01 pm

On 2005-05-29 15:24:21 -0400, robbiefcarlton@hotmail.com said:

> I'm having problems capturing images from a canvas using LispWorks capi
> gui on mac os x. This is the relevant code.


You are much more likely to get a useful response to this request on
<mailto://lisp-hug@lispworks.com> which you will need to subscribe to
at <http://www.lispworks.com/community/lisp-hug.html>. FWIW I use LWM
and cocoa, but I don't use CAPI - I just load .nib files and call the
relevant cocoa framework calls using objc:invoke. BTW,
performSelectorOnMainThread:withObject:w
aitUntilDone: is crucial for
anything that diddles a gui element directly (setTitle:,
makeKeyAndOrderFront:, etc.) since the cocoa frameworks are not
generally thread safe.

regards

robbiefcarlton@hotmail.com

2005-05-31, 8:58 pm

I just found lisp-hug today so I've asked them now.
Thanks for the help

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com