From: Mark B. <mb...@0x...> - 2000-04-12 23:39:35
|
On Wed, 12 Apr 2000, "David Clark wrote: > I have the video subsystem documentation in what I consider a nearly > finished state. Comments appreciated. > > http://www3.telus.net/futility/futility/docs/pysdl/video.html Great work. I removed surface_from(), though, because it seemed obsolete. get_palette() now returns a list of rgb tuples, instead of a tuple of tuples. There's also a new set_palette() method that takes a list of rgb tuples, as well as pal_set_at(index, (r, g, b)) pal_get_at(index) -> (r, g, b) methods. There should be no more compatability problems with the video subsystem. get_pitch() has less than novelty value at this point, since all of the surface manipulation routines work at the color and pixel level, as opposed to the chunk of memory level. In a C application, where the programmer would be accessing the surface memory directly, the pitch value is used to determine the length, in bytes, of the difference between each line of video memory (if it's in hardware). This is because not all video cards treat a video surface, in memory, as a linearly accessible chunk of memory. So in order to determine the offset at which to start writing the linear X component, you would do something like y * pitch + x. As you can see from the routines I wrote, it's just slightly more complicated than that, but you get the idea. In PySDL, since this calculation of the location in memory is done for you, you often times wouldn't need to even know the pitch. I just added it for completeness, and perhaps someone might want to output the pitch of the video display, for some perverse and obscure reason. the blit() method does clipping (really SDL does) before the low level blit is performed. So if the rectangle is bigger than the destination, it shouldn't matter. If the source is smaller, the same is true. |