CodePudding user response:
& lt; CanvasId canvas id="" width=" 400 "height=" 350 "& gt; & lt;/canvas>
& lt; script type="text/javascript">
Var canvas=document. GetElementById (" canvasId ");
Var CTX=canvas. GetContext (" 2 d ");
CTX. StrokeStyle="# 999";
50,50,200,200 CTX. The rect ();
CTX. Stroke ();
CTX. Clip ();
CTX. FillStyle="# 000";
CTX. FillRect (100100200200);
& lt;/script>
CodePudding user response:
May question is this: the black squares represent an image, the image copy to clipboard, and then use the data on the clipboard, according to the topic carefully and understand clearly, don't ring is difficult,CodePudding user response:
The sky who is right, you use his code, comments about the clip that, see the effect, just see.//CTX. Clip ();