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

Re: [pygame] subsurfaces outside of their parents



On Tue, 2005-11-08 at 00:46 -0500, Forest Darling wrote:
> I would like to see a feature where you could have a subsurface take a
> rect that covered an area that was partially or completely outside
> parent surface's rect...
>
> s = pygame.Surface((100, 100))
> sub = s.subsurface(Rect(-10, -10, 20, 20)

This has been suggested before. If it is ok for the returned subsurface
to be smaller than requested, this would be easy to implement. The
surface would still use the right offset so that drawing to it would
appear where you expected.

sub = s.subsurface(Rect(-10, -10, 20, 20)
print sub.get_size()
(10, 10)

I'll think about it some more, it can lead to strange cases, but for the
most part I think it would do the right thing.