[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] blit problem (bug?)

Guillaume Proux wrote:
> My screen is a 1024x768 bitmap. I created an off-screen buffer of
> 1024x832 and want to blit a part of this buffer into my screen BUT if i
> use
>     screen.blit(offscreenbuffer,(0,0)) # it works
> but
>     screen.blit(offscreebuffer,(0,0),(0,64,1024,768))
> Then only the first 704 pixels (in height) are blitted to the
> screen.... as well,
>     screen.blit(offscreebuffer,(0,0),(0,64,1024,832))
> gives the same result
> It seems pygame clipped the blit to the dest_h-src_y!!!!

from what i read it sounds like it's doing what it should. all i can think
there's a misunderstanding in how it's supposed to work?

the last argument to blit is a "source rectangle/area". in your argument of
(0, 64, 1024, 768) there must be some clipping. you are asking for the
pixels in rows 64 - 832. your image only has 768 rows, so it clips down to
what you actually have.

so the final result is you are blitting a source of 1024x704 to a screen
that is slightly taller. there's no way it can completely fill the screen.
if you want it to 'wrap around' you'll need to do it with two blits.

not sure if this really helps. if you are trying to get some sort of effect
i'm sure we can get that figured out.

pygame mailing list