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

Re: [pygame] Surface problem



On Sat, 15 Feb 2003 11:47:56 +0100
"mrfaro@libero.it" <mrfaro@libero.it> wrote:

> Hi, I got a problem, but I don't know if I can explain it rightly
> because of my cursed english...but I'll try...
> 
> I got a function that load a surface from an Image. I call It
> 
> self.surface = load_surface('image.jpg')
> 
> adn after I copy self.surface in a new var:
> 
> self.base = self.surface.

here the problem, I think. With this assignment you create a new object called
"self.base", that hold the reference to self.surface (both self.base and 
self.surface are pointer to the same memory area). Maybe you want to create a 
real copy of self.surface, the only way coming in my mind is:

# Create a new surface (optional flags and depth must be the same of self.surface
self.base = pygame.Surface((self.surface.width(), self.surface.height()))
# Blit self.surface to new surface
self.base.blit(self.surface, (0,0))


see you


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org