Open Bug 1066416 Opened 6 years ago Updated 6 years ago

Add ability to specify stroke scaling style.

Categories

(Core :: Canvas: 2D, defect)

x86
macOS
defect
Not set
normal

Tracking

()

People

(Reporter: mbx, Unassigned)

References

Details

(Keywords: feature)

This is motivated by bug 1064110. The Flash stroking model supports 4 stroke scaling modes: none, horizontal, vertical and normal. These modes scale the current lineWidth based on the current transformation matrix and apply it uniformly to a transformed path in global coordinate space. The result is a lot more useful than what Canvas 2D does by default, which is to transform the stroke along with the path.

I propose adding a `lineScaleMode` property on the Canvas2DRenderingContext, which would have the following possible values: "default" | "none" | "normal" (I don't know how useful having, horizontal and vertical scale modes is).

"default" - does what stroke normally does.

"none" - only the path is transformed by the current transformation matrix, the lineWidth is unaffected and is applied uniformly to the transformed path.

"normal" - same as "none", but the lineWidth is scaled by the average of the scaleX and scaleY properties of the current transformation matrix.
Blocks: 927828
"normal" is somewhat normative, I suppose. Also not really descriptive. How about "uniform"?
Yes, makes a lot more sense.
Keywords: feature
Whiteboard: [shumway]
Not a Shumway blocker. Shumway's workaround is pretty fast, but this would be a nice feature for Canvas2D.
Whiteboard: [shumway]
You need to log in before you can comment on or make changes to this bug.