[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

subsurfaces origin attribute Re: [pygame] PixelArray question



Hi,

I'm not sure I understand how that would work?  Could you please
explain it with code?

I think it sounds useful though - just not sure I understand.


On 8/24/07, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
> Lenard Lindstrom wrote:
> > As for slicing, that is just a generalized form of Surface.subsurface
> > (with the parent locked for consistency with surfarray).
>
> Speaking of subsurfaces, there is one thing that I wish
> they had, and that's the ability for the origin of the
> subsurface's coordinate system to be somewhere other than
> its top left corner.
>
> This would have been useful in a small GUI library I wrote
> recently, where to draw a subwidget I get a subsurface from
> the parent widget's surface and pass it to the subwidget's
> draw() method. But this means that a subwidget can't hang
> outside the bounds of its parent widget, as that causes
> subsurface() to throw a wobbly.
>
> If surfaces had an "origin" attribute, subsurface() could
> simply clip the subsurface and set its origin appropriately.
>
> --
> Greg Ewing, Computer Science Dept, +--------------------------------------+
> University of Canterbury,          | Carpe post meridiem!                 |
> Christchurch, New Zealand          | (I'm not a morning person.)          |
> greg.ewing@xxxxxxxxxxxxxxxx        +--------------------------------------+
>