Note that the examples/pixel_array.py shows you a bunch of examples of how to use PixelArray.
cheers, On Tue, Apr 15, 2008 at 6:14 PM, Marcus von Appen <[EMAIL PROTECTED]> wrote: > On, Tue Apr 15, 2008, Brian Fisher wrote: > > > My bad, I always assumed implementing the buffer interface would make > > the BufferProxy object give python code the ability to modify the > > contents of the surface just like through array.array... > > > > I dislike adding numpy/numeric as a dependency, and previously I sped > > some stuff up by making an array from a string, modifying the array, > > then making a new surface from the modified array as a string vs. > > getting and setting pixels, so I would love it if I could just do > > stuff like: > > --- > > surface = Surface((1,1), 32) > > surface_contents = surface.get_buffer() > > surface_contents[3] = 0 > > --- > > or whatever... > > > > does that seem like something that would be sensible to add to the > > buffer proxy? is there a C python interface thing that makes providing > > that kind of access real easy? > > That's what the PixelArray is for. Due to the alignment, pitch, etc. of > the surface data, you cannot easily operate directly on the > buffer. BufferProxy is just a simple interface to the surface pixels so > other systems like e.g. numpy can (ab)use surfaces pixels easily without > the need to write C code for them. > > Regards > Marcus >
