llgcode / draw2d

2D rendering for different output (raster, pdf, svg)
BSD 2-Clause "Simplified" License
1.09k stars 105 forks source link

Fixed ClearRect unable to clear transparent image #165

Closed ph1048 closed 3 years ago

ph1048 commented 3 years ago

Hello!

I am using draw2dimg to draw things on a transparent html5 canvas, and current implementation of ClearRect uses draw.Over operation, which is unable to clear image to a fully transparent state. I suggest using draw.Src, as it allows users to clear area with transparent pixels. IMO, for transparent images this behaviour is somewhat intuitive. Also, this behaviour would not break existing behaviour for fully opaque clear operations.

llgcode commented 3 years ago

You are right @ph1048, it's correct. It seems to not break anything. Thanks for your contribution. I'll merge your change.