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

Re: [pygame] BUG: Mask.overlap_mask



Might it be that one method assumes a position of (0,0) if none is set, and the other does not? Is the result consistent for the unexpected result? If not, that would suggest the values have not been initialised.

Russell


On 19 June 2014 16:14, Florian Krause <siebenhundertzehn@xxxxxxxxx> wrote:
Hello together,

Mask.overlap_mask does not what it is supposed to do. In the following example, the two counts that are output should be the same. The second one is the one from overlap_mask. I have no clue what goes wrong there, since the results does not make any sense to me.

Please let me know how I can get the correct overlap mask in the case below.

Thanks,
Florian



import pygame

pygame.init()
pygame.display.init()
pygame.display.set_mode((800, 600))
s1 = pygame.Surface((100, 100)).convert_alpha()
s2 = pygame.Surface((200, 200)).convert_alpha()
s1.fill((0,0,0))
s2.fill((0,0,0))

m1 = pygame.mask.from_surface(s1)
m2 = pygame.mask.from_surface(s2)

print m1.overlap_area(m2, (-150, 50))
print m1.overlap_mask(m2, (-150, 50)).count()




--
www.fladd.de - Homepage of Florian Krause