How to remove clip area in html 5 canvas

I work with clip () in canvas.

I made an area for the clip () as below

this.svgRenderer.ctx.rect(positionX, positionY, Width, Height);
this.svgRenderer.ctx.clip();

After painting a little on the same canvas, I try to remove the clip for this region using save () and restore ().

But I am making mistakes and cannot understand this. Therefore, suggest any other way to remove the clip for the specified area without using save () and restore ()

+4
source share
1 answer

.clip is a constant change in the state of the context.

It can be removed by wrapping it in .saveand .restore.

Changing the width of the canvas element will clear the state of the context (and remove cropping), but also delete existing drawings.

+5

All Articles