Skip to content
Advertisement

Why don’t three R, G and B circles blend correctly?

I am trying to represent the RGB color model using python + pygame.

I wanted to get the following: So then, I wrote the following code:

JavaScript

But instead of getting the RGB color model, I got this, with colors incorrectly blended: Does anybody know what it could be? Thanks!

Advertisement

Answer

This should work:

JavaScript

You want to add the colors at the intersections of the circles, hence use the BLEND_RGB_ADD flag.

I created a fourth surface since you wanted a white background.

Advertisement