From 86085a3e5bf29afceb1f49d5c5bfeedf4f80cc62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=A0=E6=89=8B=E6=8D=A7=E9=B2=9C=E8=8A=B1?= <157215725@qq.com> Date: Tue, 21 Mar 2023 23:24:33 +0800 Subject: [PATCH] fix: svg+xml image decoding in Safari and Firefox (close #15) --- index.html | 9 ++--- src/context.ts | 6 +-- src/converts/dom-to-canvas.ts | 2 +- src/converts/dom-to-foreign-object-svg.ts | 4 +- src/create-context.ts | 8 ++-- src/destroy-context.ts | 1 - src/embed-css-style-image.ts | 4 ++ src/embed-image-element.ts | 45 ++++++++++++++--------- src/fetch.ts | 6 +-- src/image-to-canvas.ts | 26 +++++++------ src/utils.ts | 1 + 11 files changed, 63 insertions(+), 49 deletions(-) diff --git a/index.html b/index.html index a740842..cdd5180 100644 --- a/index.html +++ b/index.html @@ -13,16 +13,15 @@ } #root { - display: inline-flex; - font-size: .875rem; - font-family: "Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; - line-height: 1.5; + width: 300px; + height: 300px; + background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1080 1080"%3E%3Cpath fill="none" d="M0,657C0,438,0,219,0,0c360,0,720,0,1080,0c0,360,0,720,0,1080c-186.7,0-373.3,0-560,0c0.3-1.5,0.4-3.2,0.9-4.6 c19.7-58.2,24.6-117.7,13.7-178.2c-13.7-76.2-48.2-141.9-104.9-194.5c-90.3-83.8-196.9-113-317.7-90.1C71.9,620.2,34.8,635.9,0,657z"%3E%3C/path%3E%3Cpath fill="%23182430" d="M0,657c34.8-21.1,71.9-36.8,112-44.4c120.8-22.9,227.4,6.3,317.7,90.1C486.5,755.4,521,821,534.6,897.2 c10.9,60.5,6,119.9-13.7,178.2c-0.5,1.5-0.6,3.1-0.9,4.6c-173.2,0-346.5,0-520,0C0,939,0,798,0,657z"%3E%3C/path%3E%3C/svg%3E'); }
-
前缀 after
+