INNER CODE UNIT · Kotlin

iconWidth

streetcomplete/StreetComplete · buildSrc/src/main/java/DownloadAndConvertPresetIconsTask.kt:118

        val iconWidth = iconSize * widthF / size
        val iconHeight = iconSize * heightF / size
        vector.setAttribute("android:width", "${iconWidth}dp")
        vector.setAttribute("android:height", "${iconHeight}dp")
        vector.setAttribute("android:viewportWidth", width)
        vector.setAttribute("android:viewportHeight", height)
        drawable.appendChild(vector)

        for (i in 0 until root.childNodes.length) {
            val element = root.childNodes.item(i) as? Element ?: continue
            // defs are okay (as long as they are not used, which is by attribute in paths etc.)
            if (element.tagName == "defs") continue
            require(element.tagName == "path") { "Only paths are supported" }
            for (a in 0 until element.attributes.length) {
                val attr = element.attributes.item(a) as Attr
                require(attr.name in supportedPathAttributes) { "path attribute '${attr.name}' not supported" }
            }
            val d = element.getAttribute("d")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…