SVG as Image src drawn on 2D Context are not scaled according to `drawImage` parameters (differs from Webkit/Chromium)
Categories
(Core :: Graphics: Canvas2D, defect, P2)
Tracking
()
People
(Reporter: hello, Unassigned)
Details
Attachments
(1 file)
|
1.01 MB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Steps to reproduce:
Create an SVG image with a viewBox attribute but no preserveAspectRatio attribute set
Set the SVG as an HTMLImageElement tag src attribute
Create an HTML Canvas Element and get the 2d context
Use the drawImage method on the 2d context to draw the HTMLImageElement and set the "destination" width to be larger than the viewBox width (so you would non-uniformly scale the SVG image)
Actual results:
SVG Image is drawn with the preserveAspectRatio default setting applied and the image is scaled uniformly
Codesandbox Example https://codesandbox.io/s/eager-cartwright-ksm22w?file=/src/index.js
Expected results:
SVG image should be drawn scaled non-uniformly on the canvas.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•2 years ago
|
Comment 2•2 years ago
|
||
Have you checked #1547776 and is this the same problem?
| Reporter | ||
Comment 3•2 years ago
|
||
(In reply to Mark Hills from comment #2)
Have you checked #1547776 and is this the same problem?
I didn't find that in my search but you're right this is a duplicate of that issue.
Description
•