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

Re: [pygame] subsurfaces outside of their parents



That wont work if you use any pygame.draw functions or get_at or
set_at, but I like that origin idea. That would fix the problem, and
even though the width/height would be smaller, in my widget system I
have it determine its supposed height/width from another rect, and the
drawing width/height could be different.

On 11/10/05, Kris Schnee <kschnee@xxxxxxxxxx> wrote:
> Forest Darling wrote:
> > I want a subsurface to be the size/location that you ask it, even if
> > it overlaps/is outside of the parent surface. Any pixels that are
> > outside of the surface would be "dummy" pixels and any drawing to them
> > would be ignored. The idea is to be able to draw to a surface (0,
> > 0)through(10, 10) and on the parent surface have it be drawing (-5,
> > -5)through(5, 5), and only (5, 5) --> (10, 10), which is (0, 0)
> > through(5, 5) on the parent surface, would actually be drawing to
> > non-dummy pixels. This might be really hackish though because what
> > then if you were to blit this subsurface to another surface, with its
> > dummy pixels? what would the dummy pixels show up as? I guess it
> > simply wouldn't copy them... as if you had asked it to blit a smaller
> > rect. I am mostly thinking about drawing aspect though...
>
> I'm not sure why you'd want to do this, but maybe you could create a
> class that contains a surface and an offset marker, which affects where
> it's blitted onto its parent surface. So, make it whatever size you
> want, and when you call its Blit() function, it just blits onto the
> parent surface, harmlessly ignoring anything outside its own surface. I
> don't think the "harmlessly ignoring" part requires any special code;
> I've been messing with sprites that can get drawn outside the display
> surface.
>
> (Why does the concept of "putting subsurfaces outside of their parents"
> sound like something a preacher would denounce as against God's will?)
>
> Kris
>
>