Accessing image pixels
Hi,
I am banging my head on the following problem since a couple of days
now, maybe someone else knows what I am missing:
I try to read a bmp image from a file and do some simple image
processing on it. For this I took examples/capi/graphics/images.lisp as
a basis. This displays a bmp just fine. However, how can I access
individual pixels of this image (I mean how can I get RGB or some other
color information for a pixel)? I tried the following:
(defun calculate-outline (interface)
(with-slots (viewer image) interface
(when image
(let ((access (gp:make-image-access viewer image)))
...
(unwind-protect
(progn
(gp:image-access-transfer-from-image access)
(dotimes (i (gp:image-access-height access))
(dotimes (j (gp:image-access-width access))
(format t "~A~%" (gp:image-access-pixel access i
j)))))
(progn
(gp:free-image-access access)))
...
))))
but all I get error "Image access not supported for this image" in the
Cocoa event loop (I use Personal edition for Mac). I did not find
anything in the documentation on gp:make-image-access and friends, so I
am lost here.
All input is welcome!
Thanks,
Thomas