test 2 pls disregard
Joeish W
joeish80829 at yahoo.com
Sat Oct 5 11:12:50 UTC 2013
(cffi:defcstruct (cv-size :classcv-size-type)(width :int)(height :int))(defmethod cffi:translate-from-foreign (p (type cv-size-type))(let((plist (call-next-method)))(make-size :width (getf plist 'width) :height (getf plist 'height))))
and my opencv wrappers for CvGetSize and cvCreateImage, get-size and create-image, are defined like this
;;CvSizecvGetSize(constCvArr*arr)(cffi:defcfun ("cvGetSize"get-size)(:structcv-size)(arr cv-arr));;IplImage*cvCreateImage(CvSizesize,intdepth,intchannels)(cffi:defcfun ("cvCreateImage"%create-image)ipl-image (size :int64)(depth :int)(channels :int))(defun create-image (size depth channels)"Create an image with dimensions given by SIZE, DEPTH bits per channel, and CHANNELS number of channels."(let((nsize (size->int64 size)))(%create-image nsize depth channels)))
here is the definition of size->int64
(DEFUN SIZE->INT64 (S)(+(SIZE-WIDTH S)(ASH (SIZE-HEIGHT S)32)))it converts get-size output which isa structure here:#S(SIZE :WIDTH 640 :HEIGHT 480)into64-bit integer,which CFFI can handle
but i love the idea of the translate-foreign defmethod's
so i was wondering if you can show my how to make the
translate-into-foreign version of the below from method this would
really make my library awesome
(defmethod cffi:translate-from-foreign (p (type cv-size-type))(let((plist (call-next-method)))(make-size :width (getf plist 'width) :height (getf plist 'height))))
I was going to try stuff and add it but for the get-size output
structure, it isnt a plist so not really sure what to put there for the
(let((plist (call-next-method)))
part, for the
(make-size :width (getf plist 'width) :height (getf plist 'height))))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20131005/fcac97ae/attachment.html>
More information about the cffi-devel
mailing list