WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
45277
Canvas api: c.createPattern(img,...) does not work if image is SVG
https://bugs.webkit.org/show_bug.cgi?id=45277
Summary
Canvas api: c.createPattern(img,...) does not work if image is SVG
Thaddee Tyl
Reported
2010-09-06 15:41:03 PDT
Created
attachment 66671
[details]
Canvas with an SVG image drawn as a pattern Reproducibility: always. Steps: 1. Go to a page that invokes c.createPattern(img, "repeat"); with an SVG image and draws the pattern onto a canvas. 2. Consider the fact that it does not appear. Notes: * c.fill() do not work. * c.stroke() do not work. * It is not an image loading issue. * It is not linked to the "repeat" part -- "no-repeat", "repeat-x", "repeat-y", "", and null, all yield the same result.
Attachments
Canvas with an SVG image drawn as a pattern
(546 bytes, text/html)
2010-09-06 15:41 PDT
,
Thaddee Tyl
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
stml
Comment 1
2015-04-22 04:56:30 PDT
I have also independently encountered this bug, with comparable results. var img = new Image(); img.onload = function() { var pattern = badge.createPattern(img, 'repeat'); badge.fillStyle = pattern; // draw 'badge' shape badge.fill(); }; img.src = '../flags/iso/'+country+'.svg'; This works as expected in Firefox and Chrome, but in Safari (7.0.3) the background is blank (white). Using a png or jpg for the pattern works as expected in Safari et al - it's only SVGs that render incorrectly. DrawImage also works in Safari for SVGs - it's only createPattern that fails.
knuts763
Comment 2
2021-04-23 08:18:01 PDT
Looks like this is still broken
Ahmad Saleem
Comment 3
2024-05-22 09:32:45 PDT
Changed above and only changed from SRC to newer placeholder SVG -
https://jsfiddle.net/Lp1uvqoe/
All browsers (Safari 17.5, Chrome Canary 127 and Firefox Nightly 128) looks same here. @Karl - any input?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug