5// Tints an SVG (or raster) by routing through the `coloredsvg` C++ image provider,
6// which rasterizes the source and composites the tint over its alpha mask.
10 property color color: "white"
13 property alias asynchronous: image.asynchronous
14 property alias cache: image.cache
15 property alias fillMode: image.fillMode
16 property alias horizontalAlignment: image.horizontalAlignment
17 property alias mirror: image.mirror
18 property alias paintedHeight: image.paintedHeight
19 property alias paintedWidth: image.paintedWidth
20 property alias progress: image.progress
21 property alias mipmap: image.mipmap
22 property alias sourceSize: image.sourceSize
23 property alias status: image.status
24 property alias verticalAlignment: image.verticalAlignment
29 // Strip qrc: scheme and ensure leading '/' so the provider URL stays well-formed.
30 readonly property string _path: {
31 const s = source.toString()
32 if (s.length === 0) return ""
33 if (s.startsWith("qrc:/")) return s.substring(4)
34 if (s.startsWith("/")) return s
37 // QColor in C++ parses "#" prefixes as URL fragments, so strip it.
38 readonly property string _hex: color.toString().replace("#", "")
46 fillMode: Image.PreserveAspectFit
48 sourceSize.height: height
49 source: root._path.length > 0
50 ? "image://coloredsvg" + root._path + "?color=" + root._hex