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

Re: [pygame] blit-add to white bug?



Hi

Yes, that makes sense, why didn't I see that myself!

I will check the colors in the images and make an example for each combination.

Thanks for the eye opener.

~DR0ID

On 2015-08-05 20:34, Christopher Night wrote:
Pretty sure that's the expected/desired behavior. When you do this, for each pixel, any of the rgb channels that's 0 will remain at 0, and any that's nonzero will get maxed out to 255. The orange starts at r,g,b = 255,102,0. When you blit it over itself 255 times, the green channel gets maxed out to 255, so you wind up with 255, 255, 0, which is yellow. You'd get something similar for pixels with a color that had a 0 value in the red or green channels. You've got some blue color in the rainbow wheel, but none of the blue pixels actually have 0 values in red and green.

Same thing with the tomato. In addition to black and white pixels, you're seeing red, cyan, or yellow, depending on which values were exactly 0 in the original image.

On Wed, Aug 5, 2015 at 2:19 PM DR0ID <dr0id@xxxxxxxxxx> wrote:
Hello

I have been experimenting with the blit method and its blend options. I
think I have stumbled over a bug either in pygame or SDL (I can't tell).
Its when adding a surface with itself. When adding it 255 times all
color values that were > 0 will be maxed out to 255. It works most of
the time. But surprisingly for colors in the orange tones do not work.
At least it looks like that, but I can't tell the exact conditions when
it will behave strange.

To demonstrate the strange behavior I have written a small demo. It can
be downloaded here:

https://bitbucket.org/dr0id/pyknic/downloads/2015-08-05-blit_to_white.zip

There are two images displayed: the one on the left if the original, the
one on the right is the blitted to white image. The only parts that
don't get white are the ones that were either black or transparent (in
both cases the values were (0, 0, 0, a) or (r, g, b, 0)). That is
expected. The orange colored regions should be white on the right images.

Can someone explain what is going on? I could not find any clue in the
pygame C-blitting code.

Maybe this has already been reported, but I could not find any matching
entries on the pygame issue tracker on bitbucket.

Thanks.

~DR0ID