GeneCode
GeneCode

Reputation: 7588

CGContext erase with some alpha value

I can easily draw and erase on a UIImage using CGContext.

For erasing, I use

CGContextSetBlendMode(ctx, kCGBlendModeClear);

and draw along the path. This erases whatever drawing that is on the image, completely.

What I want to do is to have it erase softly, so user must stroke at the same place 3-4-5 times before it is completely gone.

Any idea how to do this and is it possible, even?

Upvotes: 0

Views: 357

Answers (1)

Scrooch
Scrooch

Reputation: 303

Haven't tried it myself but how about using blend mode kCGBlendModeMultiply then drawing with the color (r:1, g:1, b:1, a:0.5)?

Upvotes: 1

Related Questions