O thanks, it's true I have test and appears to be well, I will send output to a file to analize it. Thanks :)
2010/8/23 jug <j...@fantasymail.de> > "mask.outline(): Returns a list of points of the outline of the first > object it comes across in a Mask" (docs) > -> this method gives you all points that build the outline of an object on > the mask. Thus, all these > points are set on the mask. If you want to print all pixels of the mask, > you need to loop over the size: > > w, h = mask.get_size() > for x in xrange(w): > ....for y in xrange(h): > ........print mask.get_at(x,y), > ....print #(optional) > > Julian > > > 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 >> > > -- Nota: Tildes omitidas para evitar incompatibilidades. :wq