To do proper blending easily in TiKz, I need to do be able to have a special blend mode. (this is relevant to anything dealing with graphics and not tiks/tex)
When you plot a pixel with an alpha channel the graphics package or graphics card will mix the pixel color below it with the new one. eg., suppose we have (100,0,0,255) and we plot (50,50,0,50) on top of it. The new pixel will be (100*(255 - 50)/255 + 50*50/255, 50*50/255, 0, 255) = (80, 10, 0, 255).
Now when you have a white background you always end up mixing with white for the initial pixel. So if you plot any pixel for the first time with an alpha channel it will get blended with white and become washed out. (255, 255, 255, 255) blended with (255, 0, 0, 50) = (255, 205, 205, 255)
This is the default behavior of tikz and most graphics packages that plot with alpha channel(you just mix pixels)
I would like, instead, to plot where the first color does not mix. Basically if it is the first pixel to be plotted then it's alpha channel will always be set to 255. This prevents colors from being washed out and allows for complex geometrical conditions that break others.
Anyone know if TiKz can do this or be modified to do it? Basically one has to keep a bit buffer where each bit represents if a pixel has been plotted for the first time or not(sort of a like a z-buffer). Blending mode - This mode is basically "Set Alpha channel to 255 for new pixels"
One can do the test on the primitive level in tikz BUT this does not get partial overlapped objects. Think of two circles that overlap but not totally. One circle is "new"(in the sense that all pixels are new) and the other is partially new(some pixels, the overlapped ones) are not new while the others are. Using tikz's fill opacity cannot handle this case(although you could do some clipping and stuff that becomes very complex quickly).
One way to see this at http://www.texample.net/tikz/examples/venn-diagram/
notice the last diagram and how washed out all the colors are. In my mode they will not be washed out because none of the circles pixels will be blended with white but all blend with themselves.
Again, one can achieve my effect in a very complex manner by using clipping and changing alpha values but it can be achieved much easier given the method I have described = if new pixel then force alpha channel = 255.