@onekeyfe/react-native-image 6.7.0-3 → 6.7.0-30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OneKeyImage.podspec +1 -1
- package/README.md +12 -0
- package/android/build.gradle +3 -1
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyBlockieAvatarLoader.kt +1 -1
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyIcon.kt +93 -0
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImageCache.kt +12 -0
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImageGlideRegistry.kt +19 -1
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImagePackage.kt +2 -1
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImageSafety.kt +1 -1
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyMediaPreviewCache.kt +199 -0
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyNamedSVG.kt +217 -0
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeySVG.kt +264 -0
- package/android/src/test/java/com/margelo/nitro/onekeyimage/OneKeyBlockieAvatarLoaderTest.kt +2 -1
- package/android/src/test/java/com/margelo/nitro/onekeyimage/OneKeyImageSafetyTest.kt +1 -1
- package/android/src/test/java/com/margelo/nitro/onekeyimage/OneKeySVGForeignObjectTest.kt +130 -0
- package/ios/OneKeyIcon.swift +90 -0
- package/ios/OneKeyImageCache.swift +23 -5
- package/ios/OneKeyImageCoderBridge.h +4 -0
- package/ios/OneKeyImageCoderBridge.m +361 -1
- package/ios/OneKeyImageRequestContext.swift +1 -1
- package/ios/OneKeyMediaPreviewCache.swift +201 -0
- package/ios/OneKeyNamedSVG.swift +282 -0
- package/ios/tests/OneKeyIconTests.swift +484 -0
- package/ios/tests/OneKeyImageInfrastructureTests.swift +3 -3
- package/ios/tests/OneKeyMediaPreviewCacheTests.swift +90 -0
- package/ios/tests/OneKeySVGForeignObjectTests.swift +267 -0
- package/lib/module/OneKeyIcon.nitro.js +4 -0
- package/lib/module/icon/assetUrls.js +13 -0
- package/lib/module/icon/dom.js +21 -0
- package/lib/module/icon/index.js +29 -0
- package/lib/module/icon/index.web.js +32 -0
- package/lib/module/icon/props.js +22 -0
- package/lib/module/package.json +6 -1
- package/lib/nitrogen/generated/android/c++/JHybridOneKeyIconSpec.cpp +67 -0
- package/lib/nitrogen/generated/android/c++/JHybridOneKeyIconSpec.hpp +66 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridOneKeyIconStateUpdater.cpp +79 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridOneKeyIconStateUpdater.hpp +54 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/HybridOneKeyIconSpec.kt +65 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/views/HybridOneKeyIconManager.kt +96 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/views/HybridOneKeyIconStateUpdater.kt +23 -0
- package/lib/nitrogen/generated/android/onekeyimage+autolinking.cmake +4 -0
- package/lib/nitrogen/generated/android/onekeyimageOnLoad.cpp +18 -0
- package/lib/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Bridge.cpp +17 -0
- package/lib/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Bridge.hpp +32 -15
- package/lib/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Umbrella.hpp +5 -0
- package/lib/nitrogen/generated/ios/OneKeyImageAutolinking.mm +8 -0
- package/lib/nitrogen/generated/ios/OneKeyImageAutolinking.swift +12 -0
- package/lib/nitrogen/generated/ios/c++/HybridOneKeyIconSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridOneKeyIconSpecSwift.hpp +89 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridOneKeyIconComponent.mm +150 -0
- package/lib/nitrogen/generated/ios/swift/HybridOneKeyIconSpec.swift +56 -0
- package/lib/nitrogen/generated/ios/swift/HybridOneKeyIconSpec_cxx.swift +193 -0
- package/lib/nitrogen/generated/shared/c++/HybridOneKeyIconSpec.cpp +24 -0
- package/lib/nitrogen/generated/shared/c++/HybridOneKeyIconSpec.hpp +66 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridOneKeyIconComponent.cpp +36 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridOneKeyIconComponent.hpp +88 -0
- package/lib/nitrogen/generated/shared/json/OneKeyIconConfig.json +11 -0
- package/lib/typescript/src/OneKeyIcon.nitro.d.ts +7 -0
- package/lib/typescript/src/icon/assetUrls.d.ts +2 -0
- package/lib/typescript/src/icon/dom.d.ts +3 -0
- package/lib/typescript/src/icon/index.d.ts +12 -0
- package/lib/typescript/src/icon/index.web.d.ts +6 -0
- package/lib/typescript/src/icon/props.d.ts +8 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/nitro.json +10 -0
- package/nitrogen/generated/android/c++/JHybridOneKeyIconSpec.cpp +67 -0
- package/nitrogen/generated/android/c++/JHybridOneKeyIconSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/views/JHybridOneKeyIconStateUpdater.cpp +79 -0
- package/nitrogen/generated/android/c++/views/JHybridOneKeyIconStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/HybridOneKeyIconSpec.kt +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/views/HybridOneKeyIconManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/views/HybridOneKeyIconStateUpdater.kt +23 -0
- package/nitrogen/generated/android/onekeyimage+autolinking.cmake +4 -0
- package/nitrogen/generated/android/onekeyimageOnLoad.cpp +18 -0
- package/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Bridge.hpp +32 -15
- package/nitrogen/generated/ios/OneKeyImage-Swift-Cxx-Umbrella.hpp +5 -0
- package/nitrogen/generated/ios/OneKeyImageAutolinking.mm +8 -0
- package/nitrogen/generated/ios/OneKeyImageAutolinking.swift +12 -0
- package/nitrogen/generated/ios/c++/HybridOneKeyIconSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridOneKeyIconSpecSwift.hpp +89 -0
- package/nitrogen/generated/ios/c++/views/HybridOneKeyIconComponent.mm +150 -0
- package/nitrogen/generated/ios/swift/HybridOneKeyIconSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridOneKeyIconSpec_cxx.swift +193 -0
- package/nitrogen/generated/shared/c++/HybridOneKeyIconSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridOneKeyIconSpec.hpp +66 -0
- package/nitrogen/generated/shared/c++/views/HybridOneKeyIconComponent.cpp +36 -0
- package/nitrogen/generated/shared/c++/views/HybridOneKeyIconComponent.hpp +88 -0
- package/nitrogen/generated/shared/json/OneKeyIconConfig.json +11 -0
- package/package.json +48 -15
- package/scripts/configure-icon-imports.mjs +7 -0
- package/scripts/icon-fixtures.test.mjs +398 -0
- package/src/OneKeyIcon.nitro.ts +8 -0
- package/src/icon/assetUrls.ts +13 -0
- package/src/icon/dom.ts +21 -0
- package/src/icon/index.tsx +38 -0
- package/src/icon/index.web.tsx +36 -0
- package/src/icon/props.ts +38 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
package com.margelo.nitro.onekeyimage
|
|
2
|
+
|
|
3
|
+
import android.graphics.Bitmap
|
|
4
|
+
import android.graphics.Canvas
|
|
5
|
+
import android.graphics.BitmapFactory
|
|
6
|
+
import com.caverock.androidsvg.SVG
|
|
7
|
+
import java.io.InputStream
|
|
8
|
+
import java.io.IOException
|
|
9
|
+
import java.io.StringWriter
|
|
10
|
+
import javax.xml.parsers.DocumentBuilderFactory
|
|
11
|
+
import javax.xml.parsers.SAXParserFactory
|
|
12
|
+
import javax.xml.transform.TransformerFactory
|
|
13
|
+
import javax.xml.transform.OutputKeys
|
|
14
|
+
import javax.xml.transform.dom.DOMSource
|
|
15
|
+
import javax.xml.transform.stream.StreamResult
|
|
16
|
+
import kotlin.io.encoding.Base64
|
|
17
|
+
import kotlin.io.encoding.ExperimentalEncodingApi
|
|
18
|
+
import org.w3c.dom.Element
|
|
19
|
+
import org.w3c.dom.Node
|
|
20
|
+
import org.xml.sax.SAXException
|
|
21
|
+
import org.xml.sax.Attributes
|
|
22
|
+
import org.xml.sax.helpers.DefaultHandler
|
|
23
|
+
|
|
24
|
+
/** Synchronous per-request document; loaders retain scheduling and cancellation. */
|
|
25
|
+
object OneKeySVG {
|
|
26
|
+
fun decode(source: InputStream): OneKeySVGDocument = OneKeySVGDocument(parse(source))
|
|
27
|
+
internal fun parse(source: InputStream): SVG {
|
|
28
|
+
val data = OneKeyLimitedInputStream(source).readBytes()
|
|
29
|
+
val normalized = normalize(data) { png, readPixels ->
|
|
30
|
+
val decoded = BitmapFactory.decodeByteArray(png, 0, png.size)
|
|
31
|
+
?: throw IOException("Invalid PNG in SVG foreignObject")
|
|
32
|
+
try {
|
|
33
|
+
if (readPixels) IntArray(decoded.width * decoded.height).also {
|
|
34
|
+
decoded.getPixels(it, 0, decoded.width, 0, 0, decoded.width, decoded.height)
|
|
35
|
+
} else null
|
|
36
|
+
} finally { decoded.recycle() }
|
|
37
|
+
}
|
|
38
|
+
return SVG.getFromInputStream(normalized.inputStream())
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@OptIn(ExperimentalEncodingApi::class)
|
|
42
|
+
internal fun normalize(data: ByteArray, decodePNG: (ByteArray, Boolean) -> IntArray?): ByteArray {
|
|
43
|
+
val xml = when {
|
|
44
|
+
data.size >= 2 && ((data[0] == 0xff.toByte() && data[1] == 0xfe.toByte()) ||
|
|
45
|
+
(data[0] == 0xfe.toByte() && data[1] == 0xff.toByte())) -> String(data, Charsets.UTF_16)
|
|
46
|
+
data.size >= 4 && data[0] == '<'.code.toByte() && data[1] == 0.toByte() &&
|
|
47
|
+
data[2] != 0.toByte() && data[3] == 0.toByte() -> String(data, Charsets.UTF_16LE)
|
|
48
|
+
data.size >= 4 && data[0] == 0.toByte() && data[1] == '<'.code.toByte() &&
|
|
49
|
+
data[2] == 0.toByte() && data[3] != 0.toByte() -> String(data, Charsets.UTF_16BE)
|
|
50
|
+
else -> String(data, Charsets.UTF_8)
|
|
51
|
+
}
|
|
52
|
+
if (!xml.contains("foreignObject")) return data
|
|
53
|
+
fun unsupported(): Nothing = throw IOException("Unsupported SVG foreignObject")
|
|
54
|
+
if (data.size > 8 * 1024 * 1024 || xml.contains("<!DOCTYPE", ignoreCase = true) ||
|
|
55
|
+
xml.contains("<!ENTITY", ignoreCase = true)) unsupported()
|
|
56
|
+
var elementCount = 0
|
|
57
|
+
var elementDepth = 0
|
|
58
|
+
SAXParserFactory.newInstance().newSAXParser().parse(data.inputStream(), object : DefaultHandler() {
|
|
59
|
+
override fun startElement(uri: String?, localName: String?, qName: String?, attributes: Attributes?) {
|
|
60
|
+
if (++elementCount > 10000 || ++elementDepth > 64) unsupported()
|
|
61
|
+
}
|
|
62
|
+
override fun endElement(uri: String?, localName: String?, qName: String?) { elementDepth-- }
|
|
63
|
+
})
|
|
64
|
+
val factory = DocumentBuilderFactory.newInstance().apply {
|
|
65
|
+
isNamespaceAware = true
|
|
66
|
+
isExpandEntityReferences = false
|
|
67
|
+
}
|
|
68
|
+
val builder = factory.newDocumentBuilder()
|
|
69
|
+
builder.setEntityResolver { _, _ -> throw SAXException("External SVG entities are disabled") }
|
|
70
|
+
val document = builder.parse(data.inputStream())
|
|
71
|
+
if (document.documentElement.localName != "svg") unsupported()
|
|
72
|
+
if (document.getElementsByTagNameNS("*", "foreignObject").length == 0) return data
|
|
73
|
+
var nodes = 0
|
|
74
|
+
var objects = 0
|
|
75
|
+
var imageBytes = 0L
|
|
76
|
+
var imagePixels = 0L
|
|
77
|
+
var hasImageRendering = false
|
|
78
|
+
var nearestNeighbor = false
|
|
79
|
+
var pixelRuns = 0
|
|
80
|
+
var pathCharacters = 0
|
|
81
|
+
val allowed = setOf("x", "y", "width", "height", "transform", "opacity", "clip-path", "mask", "id")
|
|
82
|
+
val imageAllowed = setOf("xmlns", "src", "width", "height", "alt")
|
|
83
|
+
fun children(node: Node) = (0 until node.childNodes.length).map { node.childNodes.item(it) }
|
|
84
|
+
fun validateStyle(element: Element) {
|
|
85
|
+
val css = children(element).joinToString("") {
|
|
86
|
+
if (it.nodeType != Node.TEXT_NODE && it.nodeType != Node.CDATA_SECTION_NODE) unsupported()
|
|
87
|
+
it.nodeValue
|
|
88
|
+
}
|
|
89
|
+
val rule = Regex("([^{}]+)\\{([^{}]*)\\}")
|
|
90
|
+
// These selectors cannot match converted containers or generated pixel paths.
|
|
91
|
+
val svgSelectors = setOf("rect", "circle", "ellipse", "line", "polyline", "polygon", "text", "tspan", "stop")
|
|
92
|
+
var cursor = 0
|
|
93
|
+
while (cursor < css.length) {
|
|
94
|
+
val match = rule.matchAt(css, cursor) ?: run {
|
|
95
|
+
if (css.substring(cursor).isBlank()) return
|
|
96
|
+
unsupported()
|
|
97
|
+
}
|
|
98
|
+
cursor = match.range.last + 1
|
|
99
|
+
val selector = match.groupValues[1].trim()
|
|
100
|
+
if (selector.split(',').all { it.trim() in svgSelectors }) continue
|
|
101
|
+
if (selector != "img") unsupported()
|
|
102
|
+
val body = match.groupValues[2]
|
|
103
|
+
for (declaration in body.split(';').map(String::trim).filter(String::isNotEmpty)) {
|
|
104
|
+
val parts = declaration.split(':').map(String::trim)
|
|
105
|
+
if (parts.size != 2) unsupported()
|
|
106
|
+
val (key, value) = parts
|
|
107
|
+
if (key in setOf("width", "height") && value == "100%") continue
|
|
108
|
+
if (key == "image-rendering") {
|
|
109
|
+
val smooth = value in setOf("auto", "smooth", "optimizeQuality")
|
|
110
|
+
val nearest = value in setOf("optimizeSpeed", "-moz-crisp-edges",
|
|
111
|
+
"-o-crisp-edges", "-webkit-optimize-contrast", "optimize-contrast", "crisp-edges", "pixelated")
|
|
112
|
+
if (!smooth && !nearest) unsupported()
|
|
113
|
+
hasImageRendering = true
|
|
114
|
+
nearestNeighbor = nearest
|
|
115
|
+
continue
|
|
116
|
+
}
|
|
117
|
+
if (key == "-ms-interpolation-mode" && value == "nearest-neighbor") {
|
|
118
|
+
if (!hasImageRendering) nearestNeighbor = true
|
|
119
|
+
continue
|
|
120
|
+
}
|
|
121
|
+
unsupported()
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
fun collectStyles(node: Node) {
|
|
126
|
+
if (node is Element && node.localName == "style") validateStyle(node)
|
|
127
|
+
else children(node).forEach(::collectStyles)
|
|
128
|
+
}
|
|
129
|
+
collectStyles(document)
|
|
130
|
+
fun convert(node: Node, depth: Int) {
|
|
131
|
+
if (depth > 64) unsupported()
|
|
132
|
+
if (node.nodeType == Node.PROCESSING_INSTRUCTION_NODE) unsupported()
|
|
133
|
+
if (node !is Element) return
|
|
134
|
+
if (++nodes > 10000) unsupported()
|
|
135
|
+
for (key in listOf("fill", "stroke", "stop-color", "flood-color", "lighting-color", "color")) {
|
|
136
|
+
val value = node.getAttribute(key)
|
|
137
|
+
if (!Regex("#[0-9a-fA-F]{8}").matches(value)) continue
|
|
138
|
+
val rgba = value.substring(1).toLong(16)
|
|
139
|
+
val alpha = (rgba and 255) / 255.0
|
|
140
|
+
node.setAttribute(key, "rgba(${(rgba shr 24) and 255},${(rgba shr 16) and 255},${(rgba shr 8) and 255},$alpha)")
|
|
141
|
+
}
|
|
142
|
+
if (node.localName == "style") return
|
|
143
|
+
if (node.localName != "foreignObject") {
|
|
144
|
+
children(node).forEach { convert(it, depth + 1) }
|
|
145
|
+
return
|
|
146
|
+
}
|
|
147
|
+
if (++objects > 16) unsupported()
|
|
148
|
+
for (index in 0 until node.attributes.length) {
|
|
149
|
+
if (node.attributes.item(index).nodeName !in allowed) unsupported()
|
|
150
|
+
}
|
|
151
|
+
for (key in listOf("width", "height")) {
|
|
152
|
+
val number = node.getAttribute(key).toDoubleOrNull() ?: unsupported()
|
|
153
|
+
if (!number.isFinite() || number <= 0 || number > 32768) unsupported()
|
|
154
|
+
}
|
|
155
|
+
val content = children(node).filter {
|
|
156
|
+
when (it.nodeType) {
|
|
157
|
+
Node.COMMENT_NODE -> false
|
|
158
|
+
Node.TEXT_NODE, Node.CDATA_SECTION_NODE -> {
|
|
159
|
+
if (it.nodeValue.isNotBlank()) unsupported()
|
|
160
|
+
false
|
|
161
|
+
}
|
|
162
|
+
else -> true
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
val image = content.singleOrNull() as? Element ?: unsupported()
|
|
166
|
+
if (image.tagName != "img" || image.namespaceURI != "http://www.w3.org/1999/xhtml") unsupported()
|
|
167
|
+
for (index in 0 until image.attributes.length) {
|
|
168
|
+
if (image.attributes.item(index).nodeName !in imageAllowed) unsupported()
|
|
169
|
+
}
|
|
170
|
+
for (key in listOf("width", "height")) {
|
|
171
|
+
if (image.hasAttribute(key) && image.getAttribute(key) != "100%") unsupported()
|
|
172
|
+
}
|
|
173
|
+
if (children(image).any { it.nodeType != Node.TEXT_NODE || it.nodeValue.isNotBlank() }) unsupported()
|
|
174
|
+
val source = image.getAttribute("src")
|
|
175
|
+
val prefix = "data:image/png;base64,"
|
|
176
|
+
if (!source.startsWith(prefix, ignoreCase = true) || source.length - prefix.length > 11184812) unsupported()
|
|
177
|
+
val png = try { Base64.Default.decode(source.substring(prefix.length)) }
|
|
178
|
+
catch (_: IllegalArgumentException) { unsupported() }
|
|
179
|
+
imageBytes += png.size
|
|
180
|
+
if (imageBytes > 8 * 1024 * 1024 || png.size < 24 ||
|
|
181
|
+
!png.copyOfRange(0, 8).contentEquals(byteArrayOf(137.toByte(), 80, 78, 71, 13, 10, 26, 10))) unsupported()
|
|
182
|
+
val metadata = OneKeyEncodedImageInspector.inspect(png.inputStream())
|
|
183
|
+
val width = metadata.width.toLong()
|
|
184
|
+
val height = metadata.height.toLong()
|
|
185
|
+
imagePixels += width * height
|
|
186
|
+
if (metadata.animated || width <= 0 || height <= 0 || width > 8192 || height > 8192 ||
|
|
187
|
+
imagePixels > 4194304) unsupported()
|
|
188
|
+
val pixels = decodePNG(png, nearestNeighbor)
|
|
189
|
+
val replacement = document.createElementNS("http://www.w3.org/2000/svg", if (nearestNeighbor) "svg" else "image")
|
|
190
|
+
for (index in 0 until node.attributes.length) {
|
|
191
|
+
val attribute = node.attributes.item(index)
|
|
192
|
+
replacement.setAttribute(attribute.nodeName, attribute.nodeValue)
|
|
193
|
+
}
|
|
194
|
+
replacement.setAttribute("preserveAspectRatio", "none")
|
|
195
|
+
replacement.setAttribute("image-rendering", if (nearestNeighbor) "optimizeSpeed" else "optimizeQuality")
|
|
196
|
+
if (nearestNeighbor) {
|
|
197
|
+
// Paint(0) still filters bitmaps on Android Q+. Preserve pixel edges as
|
|
198
|
+
// bounded vector geometry instead of depending on the library's hint.
|
|
199
|
+
if (pixels == null || pixels.size.toLong() != width * height) unsupported()
|
|
200
|
+
val paths = linkedMapOf<Int, StringBuilder>()
|
|
201
|
+
val rasterWidth = width.toInt()
|
|
202
|
+
for (y in 0 until height.toInt()) {
|
|
203
|
+
var x = 0
|
|
204
|
+
while (x < rasterWidth) {
|
|
205
|
+
val color = pixels[y * rasterWidth + x]
|
|
206
|
+
var end = x + 1
|
|
207
|
+
while (end < rasterWidth && pixels[y * rasterWidth + end] == color) end++
|
|
208
|
+
if (color ushr 24 != 0) {
|
|
209
|
+
if (++pixelRuns > 16384) unsupported()
|
|
210
|
+
val path = paths.getOrPut(color) {
|
|
211
|
+
if (++elementCount > 10000) unsupported()
|
|
212
|
+
StringBuilder()
|
|
213
|
+
}
|
|
214
|
+
val run = "M$x ${y}h${end - x}v1H${x}z"
|
|
215
|
+
pathCharacters += run.length
|
|
216
|
+
if (pathCharacters > 512 * 1024) unsupported()
|
|
217
|
+
path.append(run)
|
|
218
|
+
}
|
|
219
|
+
x = end
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
replacement.setAttribute("viewBox", "0 0 $width $height")
|
|
223
|
+
replacement.setAttribute("overflow", "hidden")
|
|
224
|
+
for ((color, path) in paths) {
|
|
225
|
+
val shape = document.createElementNS("http://www.w3.org/2000/svg", "path")
|
|
226
|
+
shape.setAttribute("d", path.toString())
|
|
227
|
+
shape.setAttribute("stroke", "none")
|
|
228
|
+
shape.setAttribute("fill", "rgb(${(color ushr 16) and 255},${(color ushr 8) and 255},${color and 255})")
|
|
229
|
+
shape.setAttribute("fill-opacity", ((color ushr 24) / 255.0).toString())
|
|
230
|
+
replacement.appendChild(shape)
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
replacement.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink")
|
|
234
|
+
replacement.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", prefix + source.substring(prefix.length))
|
|
235
|
+
}
|
|
236
|
+
node.parentNode.replaceChild(replacement, node)
|
|
237
|
+
}
|
|
238
|
+
children(document).forEach { convert(it, 1) }
|
|
239
|
+
val output = StringWriter()
|
|
240
|
+
TransformerFactory.newInstance().newTransformer().apply {
|
|
241
|
+
setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes")
|
|
242
|
+
}.transform(DOMSource(document), StreamResult(output))
|
|
243
|
+
return output.toString().toByteArray(Charsets.UTF_8)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
class OneKeySVGDocument internal constructor(private val svg: SVG) {
|
|
248
|
+
val viewBoxWidth: Float? = svg.documentViewBox?.width()
|
|
249
|
+
val viewBoxHeight: Float? = svg.documentViewBox?.height()
|
|
250
|
+
val intrinsicWidth: Float = svg.documentWidth
|
|
251
|
+
val intrinsicHeight: Float = svg.documentHeight
|
|
252
|
+
|
|
253
|
+
fun render(width: Int, height: Int): Bitmap {
|
|
254
|
+
require(width > 0 && height > 0)
|
|
255
|
+
if (svg.documentViewBox == null && intrinsicWidth > 0 && intrinsicHeight > 0) {
|
|
256
|
+
svg.setDocumentViewBox(0f, 0f, intrinsicWidth, intrinsicHeight)
|
|
257
|
+
}
|
|
258
|
+
svg.setDocumentWidth(width.toFloat())
|
|
259
|
+
svg.setDocumentHeight(height.toFloat())
|
|
260
|
+
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
|
261
|
+
svg.renderToCanvas(Canvas(bitmap))
|
|
262
|
+
return bitmap
|
|
263
|
+
}
|
|
264
|
+
}
|
package/android/src/test/java/com/margelo/nitro/onekeyimage/OneKeyBlockieAvatarLoaderTest.kt
CHANGED
|
@@ -46,7 +46,8 @@ class OneKeyBlockieAvatarLoaderTest {
|
|
|
46
46
|
assertFalse(strategy.isDataCacheable(DataSource.DATA_DISK_CACHE))
|
|
47
47
|
assertFalse(DiskCacheStrategy.ALL.isDataCacheable(DataSource.LOCAL))
|
|
48
48
|
assertEquals(DiskCacheStrategy.AUTOMATIC, oneKeyImageMemoryDiskStrategy("https://example.com/image.png"))
|
|
49
|
-
assertEquals(DiskCacheStrategy.
|
|
49
|
+
assertEquals(DiskCacheStrategy.DATA, oneKeyImageMemoryDiskStrategy("data:image/png;base64,AA=="))
|
|
50
|
+
assertEquals(DiskCacheStrategy.DATA, oneKeyImageMemoryDiskStrategy("data:image/svg+xml;base64,PHN2Zy8+"))
|
|
50
51
|
assertFalse(DiskCacheStrategy.AUTOMATIC.isDataCacheable(DataSource.LOCAL))
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -237,7 +237,7 @@ class OneKeyImageSafetyTest {
|
|
|
237
237
|
|
|
238
238
|
@Test
|
|
239
239
|
fun safetyVersionParticipatesInMemoryAndDiskCacheIdentity() {
|
|
240
|
-
assertEquals("onekey-image-safety-
|
|
240
|
+
assertEquals("onekey-image-safety-v4", OneKeyImageSafetyVersionedKey.CACHE_VERSION)
|
|
241
241
|
val original = ObjectKey("custom-cache-key")
|
|
242
242
|
val first = OneKeyImageSafetyVersionedKey(original)
|
|
243
243
|
val same = OneKeyImageSafetyVersionedKey(ObjectKey("custom-cache-key"))
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
package com.margelo.nitro.onekeyimage
|
|
2
|
+
|
|
3
|
+
import java.io.IOException
|
|
4
|
+
import org.junit.Assert.assertArrayEquals
|
|
5
|
+
import org.junit.Assert.assertFalse
|
|
6
|
+
import org.junit.Assert.assertThrows
|
|
7
|
+
import org.junit.Assert.assertTrue
|
|
8
|
+
import org.junit.Test
|
|
9
|
+
|
|
10
|
+
class OneKeySVGForeignObjectTest {
|
|
11
|
+
private val png = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGP4z8DwHwAFAAH/iZk9HQAAAABJRU5ErkJggg=="
|
|
12
|
+
private val image = "<img xmlns=\"http://www.w3.org/1999/xhtml\" src=\"data:image/png;base64,$png\" width=\"100%\" height=\"100%\"></img>"
|
|
13
|
+
private fun foreign(body: String, attributes: String = "") =
|
|
14
|
+
"<foreignObject width=\"24\" height=\"24\" $attributes>$body</foreignObject>"
|
|
15
|
+
private fun document(body: String) =
|
|
16
|
+
"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">$body</svg>".toByteArray()
|
|
17
|
+
|
|
18
|
+
@Test
|
|
19
|
+
fun embeddedPNGConvertsToAndroidSVGImageWithoutChangingItsSource() {
|
|
20
|
+
val source = document("<style>img { width:100%; height:100%; }</style>" + foreign(image))
|
|
21
|
+
var validatedImages = 0
|
|
22
|
+
val normalized = OneKeySVG.normalize(source) { _, _ -> validatedImages++; null }.toString(Charsets.UTF_8)
|
|
23
|
+
assertFalse(normalized.contains("foreignObject"))
|
|
24
|
+
assertTrue(normalized.contains("xlink:href=\"data:image/png;base64,$png\""))
|
|
25
|
+
assertTrue(normalized.contains("preserveAspectRatio=\"none\""))
|
|
26
|
+
assertTrue(validatedImages == 1)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Test
|
|
30
|
+
fun ordinarySVGKeepsItsExistingDecoderInput() {
|
|
31
|
+
val source = document("<rect width=\"24\" height=\"24\" fill=\"red\"/>")
|
|
32
|
+
assertArrayEquals(source, OneKeySVG.normalize(source) { _, _ -> throw AssertionError("Ordinary SVG must not decode embedded PNGs") })
|
|
33
|
+
val commented = document("<!-- foreignObject is not used --><style>rect { fill:red; }</style><rect width=\"24\" height=\"24\"/>")
|
|
34
|
+
assertArrayEquals(commented, OneKeySVG.normalize(commented) { _, _ -> null })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Test
|
|
38
|
+
fun utf16ForeignObjectsCannotBypassConversionOrEntityRejection() {
|
|
39
|
+
val expected = OneKeySVG.normalize(document(foreign(image))) { _, _ -> null }
|
|
40
|
+
for (charset in listOf(Charsets.UTF_16LE, Charsets.UTF_16BE)) {
|
|
41
|
+
for (bom in listOf("", "\uFEFF")) {
|
|
42
|
+
val declaration = "<?xml version='1.0' encoding='${charset.name()}'?>"
|
|
43
|
+
val source = (bom + declaration + document(foreign(image)).toString(Charsets.UTF_8)).toByteArray(charset)
|
|
44
|
+
var decoded = 0
|
|
45
|
+
val actual = OneKeySVG.normalize(source) { _, _ -> decoded++; null }
|
|
46
|
+
assertTrue(decoded == 1)
|
|
47
|
+
assertArrayEquals(expected, actual)
|
|
48
|
+
val ordinary = (bom + declaration + document("<rect width='24' height='24'/>").toString(Charsets.UTF_8)).toByteArray(charset)
|
|
49
|
+
assertArrayEquals(ordinary, OneKeySVG.normalize(ordinary) { _, _ -> throw AssertionError("Ordinary SVG must not decode PNGs") })
|
|
50
|
+
val entity = (bom + declaration + "<!DOCTYPE svg [<!ENTITY image 'test'>]>" + document(foreign(image)).toString(Charsets.UTF_8)).toByteArray(charset)
|
|
51
|
+
assertThrows(IOException::class.java) { OneKeySVG.normalize(entity) { _, _ -> null } }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@Test
|
|
57
|
+
fun imageRenderingUsesDocumentOrderAndKeepsSmoothImagesSmooth() {
|
|
58
|
+
for ((css, expected) in listOf(
|
|
59
|
+
"" to "optimizeQuality",
|
|
60
|
+
"<style>img { image-rendering:pixelated; }</style>" to "optimizeSpeed",
|
|
61
|
+
"<style>img { image-rendering:pixelated; image-rendering:auto; -ms-interpolation-mode:nearest-neighbor; }</style>" to "optimizeQuality",
|
|
62
|
+
"<style>img { image-rendering:pixelated; }</style><style>img { image-rendering:smooth; }</style>" to "optimizeQuality",
|
|
63
|
+
"<style>img { -ms-interpolation-mode:nearest-neighbor; }</style>" to "optimizeSpeed",
|
|
64
|
+
)) {
|
|
65
|
+
val converted = OneKeySVG.normalize(document(foreign(image) + css)) { _, nearest ->
|
|
66
|
+
if (nearest) intArrayOf(0xffff0000.toInt()) else null
|
|
67
|
+
}.toString(Charsets.UTF_8)
|
|
68
|
+
assertTrue(converted.contains("image-rendering=\"$expected\""))
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@Test
|
|
73
|
+
fun surroundingSVGStylesArePreservedWithoutChangingImageSampling() {
|
|
74
|
+
for ((css, nearest) in listOf(
|
|
75
|
+
"<style>rect, circle { fill:red; }</style>" to false,
|
|
76
|
+
"<style>rect, circle { fill:red; } img { image-rendering:pixelated; }</style>" to true,
|
|
77
|
+
"<style>img { image-rendering:pixelated; } rect { fill:red; }</style><style>img { image-rendering:smooth; }</style>" to false,
|
|
78
|
+
)) {
|
|
79
|
+
val output = OneKeySVG.normalize(document(css + foreign(image))) { _, actual ->
|
|
80
|
+
assertTrue(actual == nearest)
|
|
81
|
+
if (actual) intArrayOf(0xffff0000.toInt()) else null
|
|
82
|
+
}.toString(Charsets.UTF_8)
|
|
83
|
+
assertTrue(output.contains("fill:red;"))
|
|
84
|
+
assertTrue(output.contains("image-rendering=\"${if (nearest) "optimizeSpeed" else "optimizeQuality"}\""))
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@Test
|
|
89
|
+
fun stylesThatCouldAffectConvertedContentStillFail() {
|
|
90
|
+
for (selector in listOf("*", ".art", "#art", "g", "svg", "image", "path", "img, rect", "rect img", "rect:hover")) {
|
|
91
|
+
assertThrows(IOException::class.java) {
|
|
92
|
+
OneKeySVG.normalize(document("<style>$selector { fill:red; }</style>" + foreign(image))) { _, _ -> null }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (css in listOf("@media all { rect { fill:red; } }", "@import 'external.css'; rect { fill:red; }")) {
|
|
96
|
+
assertThrows(IOException::class.java) {
|
|
97
|
+
OneKeySVG.normalize(document("<style>$css</style>" + foreign(image))) { _, _ -> null }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@Test
|
|
103
|
+
fun embeddedRasterDecodeFailureIsNotAConvertedSuccess() {
|
|
104
|
+
assertThrows(IOException::class.java) {
|
|
105
|
+
OneKeySVG.normalize(document(foreign(image))) { _, _ -> throw IOException("Corrupt PNG pixels") }
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Test
|
|
110
|
+
fun unsupportedHTMLExternalSourcesAndLayoutFail() {
|
|
111
|
+
for (body in listOf(
|
|
112
|
+
foreign("<div xmlns=\"http://www.w3.org/1999/xhtml\">Unsupported</div>"),
|
|
113
|
+
foreign("<img xmlns=\"http://www.w3.org/1999/xhtml\" src=\"https://example.com/a.png\"/>"),
|
|
114
|
+
foreign(image + image),
|
|
115
|
+
foreign(image, "style=\"display:none\""),
|
|
116
|
+
foreign(image.replace("100%", "50%")),
|
|
117
|
+
"<style>img { object-fit:cover; }</style>" + foreign(image),
|
|
118
|
+
foreign("<img xmlns=\"http://www.w3.org/1999/xhtml\" src=\"data:image/png;base64,AAAA\"/>"),
|
|
119
|
+
)) assertThrows(IOException::class.java) { OneKeySVG.normalize(document(body)) { _, _ -> null } }
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@Test
|
|
123
|
+
fun boundsAndEntitiesFailBeforeNativeRendering() {
|
|
124
|
+
val nested = "<g>".repeat(64) + foreign(image) + "</g>".repeat(64)
|
|
125
|
+
assertThrows(IOException::class.java) { OneKeySVG.normalize(document(nested)) { _, _ -> null } }
|
|
126
|
+
assertThrows(IOException::class.java) { OneKeySVG.normalize(document(foreign(image).repeat(17))) { _, _ -> null } }
|
|
127
|
+
val entity = "<!DOCTYPE svg [<!ENTITY image 'test'>]>".toByteArray() + document(foreign(image))
|
|
128
|
+
assertThrows(IOException::class.java) { OneKeySVG.normalize(entity) { _, _ -> null } }
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import NitroModules
|
|
2
|
+
import UIKit
|
|
3
|
+
|
|
4
|
+
private final class OneKeyIconHost: UIImageView {
|
|
5
|
+
var changed: (() -> Void)?
|
|
6
|
+
override func layoutSubviews() { super.layoutSubviews(); changed?() }
|
|
7
|
+
override func didMoveToWindow() { super.didMoveToWindow(); changed?() }
|
|
8
|
+
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
|
9
|
+
super.traitCollectionDidChange(previousTraitCollection)
|
|
10
|
+
if previousTraitCollection?.displayScale != traitCollection.displayScale { changed?() }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
final class HybridOneKeyIcon: HybridOneKeyIconSpec, RecyclableView {
|
|
15
|
+
private let host = OneKeyIconHost()
|
|
16
|
+
private let owner = NSObject()
|
|
17
|
+
private var generation: UInt64 = 0
|
|
18
|
+
private var identity: String?
|
|
19
|
+
private var displayedGeometry: String?
|
|
20
|
+
private var displayed: OneKeyNamedSVG.RenderResult?
|
|
21
|
+
var iconName: String?
|
|
22
|
+
var resolvedColor: String?
|
|
23
|
+
var view: UIView { host }
|
|
24
|
+
|
|
25
|
+
override init() {
|
|
26
|
+
super.init()
|
|
27
|
+
host.contentMode = .scaleAspectFit
|
|
28
|
+
host.changed = { [weak self] in self?.refresh() }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
func afterUpdate() { refresh() }
|
|
32
|
+
|
|
33
|
+
private func clearImage() {
|
|
34
|
+
displayed = nil; displayedGeometry = nil; host.image = nil
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private func apply(_ result: OneKeyNamedSVG.RenderResult, color: String) {
|
|
38
|
+
displayed = result
|
|
39
|
+
if let tint = result.tintColor(color) {
|
|
40
|
+
host.image = result.image.withRenderingMode(.alwaysTemplate)
|
|
41
|
+
host.tintColor = tint
|
|
42
|
+
} else {
|
|
43
|
+
host.image = result.image.withRenderingMode(.alwaysOriginal)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private func refresh() {
|
|
48
|
+
let scale = host.window?.screen.scale ?? 1
|
|
49
|
+
let width = ceil(host.bounds.width * scale), height = ceil(host.bounds.height * scale)
|
|
50
|
+
let attached = host.window != nil
|
|
51
|
+
let next = "\(iconName ?? "")|\(resolvedColor ?? "")|\(width)|\(height)|\(scale)|\(attached)"
|
|
52
|
+
guard next != identity else { return }
|
|
53
|
+
identity = next; generation &+= 1
|
|
54
|
+
let revision = generation
|
|
55
|
+
OneKeyNamedSVG.shared.cancel(owner: owner)
|
|
56
|
+
guard attached, width.isFinite, height.isFinite,
|
|
57
|
+
width > 0, height > 0, width <= 4096, height <= 4096, width * height <= 4_194_304,
|
|
58
|
+
let name = iconName, !name.isEmpty,
|
|
59
|
+
let color = resolvedColor, OneKeyNamedSVG.isValidColor(color) else { clearImage(); return }
|
|
60
|
+
let geometry = "\(name)|\(width)|\(height)|\(scale)"
|
|
61
|
+
if displayedGeometry == geometry, let result = displayed, host.image != nil {
|
|
62
|
+
if result.canTint(color) {
|
|
63
|
+
if let tint = result.tintColor(color) { host.tintColor = tint }
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
// Keep only a successful same-source/geometry raster while new color decodes.
|
|
67
|
+
} else { clearImage() }
|
|
68
|
+
if let hit = OneKeyNamedSVG.shared.cachedRender(name: name, color: color,
|
|
69
|
+
width: Int(width), height: Int(height), scale: scale) {
|
|
70
|
+
displayedGeometry = geometry
|
|
71
|
+
apply(hit, color: color)
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
OneKeyNamedSVG.shared.requestRender(owner: owner, name: name, color: color,
|
|
75
|
+
width: Int(width), height: Int(height), scale: scale) { [weak self] result in
|
|
76
|
+
guard let self, self.generation == revision, self.host.window != nil else { return }
|
|
77
|
+
guard let result else { self.clearImage(); return }
|
|
78
|
+
self.displayedGeometry = geometry
|
|
79
|
+
self.apply(result, color: color)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
func prepareForRecycle() {
|
|
84
|
+
iconName = nil; resolvedColor = nil; refresh()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
func onDropView() { prepareForRecycle() }
|
|
88
|
+
|
|
89
|
+
deinit { OneKeyNamedSVG.shared.cancel(owner: owner) }
|
|
90
|
+
}
|
|
@@ -73,6 +73,7 @@ final class HybridOneKeyImageCache: HybridOneKeyImageCacheSpec {
|
|
|
73
73
|
|
|
74
74
|
func clearMemory() throws -> Promise<Void> {
|
|
75
75
|
Promise.async {
|
|
76
|
+
await MainActor.run { OneKeyMediaPreviewCache.shared.clearMemory() }
|
|
76
77
|
SDImageCache.shared.clearMemory()
|
|
77
78
|
// OneKey patch: Clear the dedicated local-avatar cache with public cache operations.
|
|
78
79
|
OneKeyAvatarImageLoader.cache.clearMemory()
|
|
@@ -82,6 +83,11 @@ final class HybridOneKeyImageCache: HybridOneKeyImageCacheSpec {
|
|
|
82
83
|
|
|
83
84
|
func clearDisk() throws -> Promise<Void> {
|
|
84
85
|
Promise.async {
|
|
86
|
+
await withCheckedContinuation { continuation in
|
|
87
|
+
DispatchQueue.main.async {
|
|
88
|
+
OneKeyMediaPreviewCache.shared.clearDisk { continuation.resume() }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
85
91
|
await withCheckedContinuation { continuation in
|
|
86
92
|
SDImageCache.shared.clearDisk { continuation.resume() }
|
|
87
93
|
}
|
|
@@ -92,11 +98,23 @@ final class HybridOneKeyImageCache: HybridOneKeyImageCacheSpec {
|
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
func clearAll() throws -> Promise<Void> {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
Promise.async {
|
|
102
|
+
await MainActor.run { OneKeyMediaPreviewCache.shared.clearMemory() }
|
|
103
|
+
SDImageCache.shared.clearMemory()
|
|
104
|
+
OneKeyAvatarImageLoader.cache.clearMemory()
|
|
105
|
+
OneKeyImageMemoryVariantRegistry.shared.clear()
|
|
106
|
+
await withCheckedContinuation { continuation in
|
|
107
|
+
DispatchQueue.main.async {
|
|
108
|
+
OneKeyMediaPreviewCache.shared.clearDisk { continuation.resume() }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
await withCheckedContinuation { continuation in
|
|
112
|
+
SDImageCache.shared.clearDisk { continuation.resume() }
|
|
113
|
+
}
|
|
114
|
+
await withCheckedContinuation { continuation in
|
|
115
|
+
OneKeyAvatarImageLoader.cache.clearDisk { continuation.resume() }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
100
118
|
}
|
|
101
119
|
|
|
102
120
|
private static func preload(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
2
3
|
|
|
3
4
|
NS_ASSUME_NONNULL_BEGIN
|
|
4
5
|
|
|
@@ -8,6 +9,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
8
9
|
|
|
9
10
|
+ (void)addCodersToManager:(id)manager NS_SWIFT_NAME(addCoders(to:));
|
|
10
11
|
+ (void)ensureWebPCoderRegistered;
|
|
12
|
+
// A zero target preserves the decoder's intrinsic/vector result.
|
|
13
|
+
+ (nullable UIImage *)decodeSVGData:(NSData *)data pixelSize:(CGSize)pixelSize
|
|
14
|
+
NS_SWIFT_NAME(decodeSVG(_:pixelSize:));
|
|
11
15
|
|
|
12
16
|
@end
|
|
13
17
|
|