[cl-gd-devel] Re: cl-gd: random access to pixels?

Edi Weitz edi at agharta.de
Fri May 6 21:36:10 UTC 2005


[Cc to mailing list]

Hi Cameron!

On Fri, 6 May 2005 12:03:53 -0400 (EDT), "Cameron MacKinnon" <cmackin at clearspot.net> wrote:

> I'm trying to use cl-gd to get random access to an image's pixels;
> in my code, I won't be processing every pixel, so row and column
> iterators that cover the whole image are no good to me.
>
> I tried using a clipping rectangle:
>       (cl-gd:with-clipping-rectangle* (mask :image old)
> 	(cl-gd:do-rows (y old)
> 	  (cl-gd:do-pixels-in-row (x)
>             ...
> ... but that didn't work; every pixel was processed.

Yes, DO-ROWS doesn't observe clipping rectangles yet.  It'd probably
be a good idea to do that in the future.

> There appears to be no function exposed in cl-gd to get the raw
> value of an arbitrarily located pixel. Is this true?

Yes.

> Where would I start if I needed to hack in such functionality?
> gdImageGetPixel?

Depending on the type of the image you have to look into the PIXELS or
T-PIXELS slot of the GD-IMAGE structure - see file gd-uffi.lisp.
Probably the best way to proceed is to look how DO-ROWS is defined.

Cheers,
Edi.

PS: I'll be on vacation next week so I won't be able to answer further
    questions at that time.



More information about the Cl-gd-devel mailing list