The position of the surface shouldn't matter for a mask, though. The value is curious. It also works with a positive offset. Perhaps these will give some clues as to what's happening:
print [m1.overlap_mask(m2, (x, x)).count() for x in range(50)] [10000, 9702, 9408, 9118, 8832, 8550, 8272, 7998, 7728, 7462, 7200, 6942, 6688, 6438, 6192, 5950, 5712, 5478, 5248, 5022, 4800, 4582, 4368, 4158, 3952, 3750, 3552, 3358, 3168, 2982, 2800, 2622, 2448, 2278, 2112, 1950, 1792, 1701, 1612, 1525, 1440, 1357, 1276, 1197, 1120, 1045, 972, 901, 832, 765] prev = 10000 for y in [m1.overlap_mask(m2, (x, x)).count() for x in range(50)]: print(prev - y, end=', ') prev = y 0, 298, 294, 290, 286, 282, 278, 274, 270, 266, 262, 258, 254, 250, 246, 242, 238, 234, 230, 226, 222, 218, 214, 210, 206, 202, 198, 194, 190, 186, 182, 178, 174, 170, 166, 162, 158, 91, 89, 87, 85, 83, 81, 79, 77, 75, 73, 71, 69, 67, You can file a bug at the link below, I couldn't find any existing issues mentioning overlap_mask with a quick search. https://bitbucket.org/pygame/pygame/issues Russell On 5 July 2014 21:26, Russell Jones <russell.jo...@gmail.com> wrote: > 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 <siebenhundertz...@gmail.com> 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 >> > >