projects/vpn: Heron rootlos auf macOS (GlobalProtect/Duo-SAML via WKWebView + HIP), Reiher-Icon
This commit is contained in:
@@ -14,25 +14,28 @@ cd "$APPS"
|
||||
|
||||
# --- 0. Icon erzeugen (H-Badge -> icon_heron.icns) ---
|
||||
TMP="$(mktemp -d)"
|
||||
QT_QPA_PLATFORM=offscreen "$PY" - "$TMP/h.png" <<'PYEOF'
|
||||
QT_QPA_PLATFORM=offscreen "$PY" - "$APPS/heron_mask.png" "$TMP/h.png" <<'PYEOF'
|
||||
import sys
|
||||
from PyQt6.QtGui import QImage, QPainter, QColor, QFont, QGuiApplication
|
||||
from PyQt6.QtGui import QImage, QPainter, QColor, qAlpha, qRgba
|
||||
from PyQt6.QtCore import Qt
|
||||
_app = QGuiApplication([]) # noetig fuer Font-Zugriff
|
||||
# Reiher-Maske gruen einfaerben und mittig auf quadratische Flaeche setzen.
|
||||
mask = QImage(sys.argv[1]).convertToFormat(QImage.Format.Format_ARGB32)
|
||||
tgt = QColor("#2e7d32")
|
||||
for y in range(mask.height()):
|
||||
for x in range(mask.width()):
|
||||
a = qAlpha(mask.pixel(x, y))
|
||||
if a:
|
||||
mask.setPixel(x, y, qRgba(tgt.red(), tgt.green(), tgt.blue(), a))
|
||||
S = 1024
|
||||
img = QImage(S, S, QImage.Format.Format_ARGB32)
|
||||
img.fill(Qt.GlobalColor.transparent)
|
||||
p = QPainter(img)
|
||||
p.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||||
p.setBrush(QColor("#2e7d32"))
|
||||
p.setPen(Qt.PenStyle.NoPen)
|
||||
m = int(S * 0.09)
|
||||
p.drawRoundedRect(m, m, S - 2 * m, S - 2 * m, S * 0.18, S * 0.18)
|
||||
p.setPen(QColor("#ffffff"))
|
||||
f = QFont(); f.setBold(True); f.setPixelSize(int(S * 0.6)); p.setFont(f)
|
||||
p.drawText(img.rect(), Qt.AlignmentFlag.AlignCenter, "H")
|
||||
inner = int(S * 0.80)
|
||||
scaled = mask.scaled(inner, inner, Qt.AspectRatioMode.KeepAspectRatio,
|
||||
Qt.TransformationMode.SmoothTransformation)
|
||||
canvas = QImage(S, S, QImage.Format.Format_ARGB32)
|
||||
canvas.fill(Qt.GlobalColor.transparent)
|
||||
p = QPainter(canvas)
|
||||
p.drawImage((S - scaled.width()) // 2, (S - scaled.height()) // 2, scaled)
|
||||
p.end()
|
||||
img.save(sys.argv[1])
|
||||
canvas.save(sys.argv[2])
|
||||
PYEOF
|
||||
ISET="$TMP/icon.iconset"; mkdir -p "$ISET"
|
||||
for s in 16 32 128 256 512; do
|
||||
|
||||
Reference in New Issue
Block a user