If I say a rectangular line line = 2 and then scale it to double the size of the rectangle, The rectangular get its border doubled in the size of the initial linewidth size.
Is there any way to keep the edge of the line in shape or size of the original size?
In short, I want to measure the size of the rectangular shape only, but keep the size of the line visually blind.
I tried to set linewidth before and after scale (2,2) but limit width is also increased.
The linewidth is to be divided by the factor on an option scale and if it is identical to the X and Y scalar factors it will work.
I do not have the option of measuring the width and height of the rectangle and I need to use the scale command because I have other objects inside the rectangle which require scaling.
You can define the path with no change and stroke without the width of the line like this Will not be changed
Example:
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Body & gt; & Lt; Canvas id = "mikevas" width = "300" height = "150" style = "border: 1px solid #d3d3d3;" & Gt; Your browser does not support HTML5 Canvas tags. & Lt; / Canvas & gt; & Lt; Script & gt; Var c = document.getElementById ("myCanvas"); Var ctx = c.getContext ("2D"); Ctx.save (); // save context without conversion ctx.scale (2.0.5); // change ctx.beginPath (); // defined path ctx.arc (100,75,50,0,2 * Math.PI); Ctx.restore (); // References without references reference ctx.stroke (); // stroke path & lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;
Comments
Post a Comment