In a CoreGraphics drawing, how can I keep the overlap point darker than the rest of the line?

My application uses basic graphics to draw custom fingers. I allow the user to change the alpha of the line, and a new line is constantly drawn when the touches are moved. When I make alpha below 1.0, the overlap point is darker than the rest of the line. I know why this is happening, but how can I stop it?

+4
source share
1 answer

I suppose you need one hit so as not to overshadow yourself, but nonetheless to obscure the previous touches (which works in most drawing applications).

To do this, you will need two views / buffers, one for the "current background" and one for the current stroke. Combine the last background with the background when you release your finger.

You always draw with alpha-1 in the current stroke buffer, but you show and combine it with lower alpha.

+3
source

All Articles