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

Re: [pygame] Issue with pygame.mask



It seems super unlikely that code in the wild would depend on the
nonfunctional default value unless they use it as a hack to purposely
get an empty mask.  I think making the default threshold=(1,1,1,255)
would be the most diplomatic solution.

On Mon, May 14, 2012 at 9:32 AM, Peter Finlayson <frnknstn@xxxxxxxxxxx> wrote:
> On 14/05/2012 15:54, Nicholas Seward wrote:
>>
>> I wrote the top comment but I didn't need perfect matching at the
>> time.  I just dug through the source and found what is going on for
>> real.  It seem that I was right except you don't get to include the
>> endpoints.
>
>
> Yeah, I had a look too. I would still call this is a bug. The similar
> from_surface() function tests if the value crosses the threshold and uses
> 'if (a > threshold)'. This function tests if the value is WITHIN the
> threshold, and should use the complementary 'if (abs((b - a) <= threshold)'.
>
> Regardless, since there is code out in the wild that probably depends on
> this behaviour it is probably best to just note the quirk in the
> documentation. Changing the default may also be an option, because I can't
> think of any reason someone would want the function to be non-functional by
> default.
>
> Regards,
> Peter Finlayson