[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Mask problem
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Mask problem
- From: inigo delgado <inigo.delgado@xxxxxxxxx>
- Date: Mon, 23 Aug 2010 14:29:26 +0200
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 23 Aug 2010 08:29:33 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=oNi6cHLLdl4SLxYjkTOMIgSXu+4xBg8GO3gNaGqggsA=; b=YeDjJTRXElztW31k7C2ICF1OvV121Ak4ugbcjE/BI4Ol5HynyTQUgs0MMkldUWGMla WV0AyM3Yqxf5qfiEvgfgIAG+DOwi3lQ/OSp7NtoIbQ9ApRcATg0n1uu5DDoksp3aw+RW vAWKykw8VO4orqy6PP8vU5jOvev2Ouj3//aFw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ALo6276XNSyj1w03Wik6ZXyAUf7be/a+xKzOrpQRY0QAPtZ4SSNmcdbQ9+UbfMi8ee R104oqh3IuaWv6Qyvuf1i9eKS4QVElyAk3EmuuPM363XgaeOiFKQjoEcY5jwKFdI/jXh zgmhKDloViMEm3Ds9rDymUwF/TY8/YdZT1Vf0=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi all:
I have missunderstand something from masks, this is my problem:
I have a program that rounds frames in a minimum rects and saves the coordinates of them in a file, that way I know where, in a picture, are the frames of a animation and can get them easily.
I took all the frames of an animation in this way (been an animation the secuence of images of p.e. a spaceship images turning in Y-axis to go left or rigth in X-axis)
# Gets all the frames of a animation from the image
def __getFrameImages__(self, image, imagesIndexInY, coords):
indexes = coords.getCoordsInY(imagesIndexInY) # This works fine, the images are getted and drawed well
for index in indexes: # Only to show that I get many subsurfaces from a big surface (a .bmp file)
self.images += [image.subsurface(index)]
After take all images I make masks for each image that way:
# Makes masks for all the frames
def __makeMasks__(self):
for image in self.images:
mask = pygame.mask.from_surface(image, consts.MAGENTA)
temp = "" # LOG
for x in mask.outline(): # LOG
temp += `mask.get_at(x)` # LOG
print `temp` #LOG
self.masks += [mask]
been consts.MAGENTA = 0xFF00FF the key color of the image.
Well, when running it, the output are allways that way:
'111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'
So I undestand that, been no 0's, the mask is all the rect... so I'm doing something wrong, any ideas?
--
Nota: Tildes omitidas para evitar incompatibilidades.
:wq