[Image-SIG] PIL video capture extension type problem
Sun, 10 Feb 2002 15:04:48 -0800
Fredrik Lundh wrote:
>"im.im" is the ImagingObject, "im.im.id" is a pointer to the
>Imaging structure, cast to a long integer.
>("im.im" might be None, if the raster image hasn't been loaded.
>if you cannot be sure that the image was created by a call to
>Image.new, call "im.load()" before accessing the "im.im" attribute)
>and yes, if you're going to fill the entire image anyway, you can
>pass in None as the third argument (fill colour):
> im = Image.new("RGB", (160,120), None)
You have me on the right track now. Thanks! However . . .
>also see the snap function in Sane/sane.py and Sane/_sanemodule.c
It seems like it would be more natural for the python code to pass the
plain "im" (not im.im or im.im.id) and then have the C code access the
actual Imaging portion of the structure itself. The _sanemodule.c
doesn't do this though--it passes in the im.im.id from Python, and the C
code has to accept that pointer as an int and typecast it to a pointer .
. . all kind of ugly. Why do it this way instead of passing in the "im"
and letting the C code find the Imaging portion of the structure?