ec8b5b3410
The padlock was drawn in thin blue strokes on slate: at 36 px the outline muddied and the shackle vanished. A filled white shield with a punched keyhole keeps its silhouette at every size, and says protection more plainly. The keyhole is CUT OUT rather than painted, through an even-odd fill on a single path - painting it meant keeping two files agreeing on one colour, and any drift would have read as a smudge. The launch layer is the exception: it sits flat on the system background, where a cut-out would be a hole, so there the keyhole is painted and stays entirely inside the white shield. The launch background takes the top of the app gradient instead of slate, so the launch screen dissolves into the first screen rather than cutting against it. No gradient inside the vectors: the aapt this chain uses does not know inline gradients. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
77 lines
3.5 KiB
PowerShell
77 lines
3.5 KiB
PowerShell
# Genere les icones PNG du lanceur, pour Android < 8 qui ignore les icones
|
|
# adaptatives. Meme dessin que les vecteurs de android-res\drawable :
|
|
# bouclier blanc a serrure, sur le bleu de l'application.
|
|
#
|
|
# A relancer seulement si le dessin change ; les PNG sont suivis par git.
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
Add-Type -AssemblyName System.Drawing
|
|
|
|
$root = Join-Path $PSScriptRoot 'android-res'
|
|
$bg = [System.Drawing.Color]::FromArgb(255, 27, 53, 99) # #1B3563
|
|
$fg = [System.Drawing.Color]::FromArgb(255, 255, 255, 255) # blanc
|
|
|
|
# densite -> cote en pixels, tel qu'Android les attend
|
|
$sizes = @{ 'drawable-ldpi' = 36; 'drawable-mdpi' = 48; 'drawable-hdpi' = 72
|
|
'drawable-xhdpi' = 96; 'drawable-xxhdpi' = 144; 'drawable-xxxhdpi' = 192 }
|
|
|
|
foreach ($dir in $sizes.Keys) {
|
|
$n = $sizes[$dir]
|
|
$out = Join-Path $root $dir
|
|
New-Item -ItemType Directory -Force $out | Out-Null
|
|
|
|
$bmp = New-Object System.Drawing.Bitmap $n, $n
|
|
$g = [System.Drawing.Graphics]::FromImage($bmp)
|
|
$g.SmoothingMode = 'AntiAlias'
|
|
|
|
# Fond : carre arrondi. Les vieux lanceurs ne masquent pas, donc l'icone
|
|
# doit porter sa propre forme.
|
|
$r = [int]($n * 0.22)
|
|
$path = New-Object System.Drawing.Drawing2D.GraphicsPath
|
|
$path.AddArc(0, 0, 2*$r, 2*$r, 180, 90)
|
|
$path.AddArc($n-2*$r-1, 0, 2*$r, 2*$r, 270, 90)
|
|
$path.AddArc($n-2*$r-1, $n-2*$r-1, 2*$r, 2*$r, 0, 90)
|
|
$path.AddArc(0, $n-2*$r-1, 2*$r, 2*$r, 90, 90)
|
|
$path.CloseFigure()
|
|
$g.FillPath((New-Object System.Drawing.SolidBrush $bg), $path)
|
|
|
|
# Echelle : le dessin vectoriel vit dans un carre de 108.
|
|
$u = $n / 108.0
|
|
$brush = New-Object System.Drawing.SolidBrush $fg
|
|
|
|
# Bouclier : sommet, epaules, montants, puis les deux courbes qui se
|
|
# rejoignent en pointe. Memes coordonnees que ic_launcher_foreground.xml.
|
|
$s = New-Object System.Drawing.Drawing2D.GraphicsPath
|
|
$s.AddLines(@(
|
|
(New-Object System.Drawing.PointF ([float](54*$u), [float](29*$u))),
|
|
(New-Object System.Drawing.PointF ([float](77*$u), [float](37*$u))),
|
|
(New-Object System.Drawing.PointF ([float](77*$u), [float](56*$u)))))
|
|
$s.AddBezier(
|
|
[float](77*$u), [float](56*$u), [float](77*$u), [float](69.5*$u),
|
|
[float](67*$u), [float](78*$u), [float](54*$u), [float](82*$u))
|
|
$s.AddBezier(
|
|
[float](54*$u), [float](82*$u), [float](41*$u), [float](78*$u),
|
|
[float](31*$u), [float](69.5*$u), [float](31*$u), [float](56*$u))
|
|
$s.AddLine([float](31*$u), [float](56*$u), [float](31*$u), [float](37*$u))
|
|
$s.CloseFigure()
|
|
$g.FillPath($brush, $s)
|
|
|
|
# Serrure, evidee dans la couleur du fond. Le vecteur y arrive par un
|
|
# remplissage pair-impair ; ici, repeindre par-dessus revient au meme,
|
|
# l'icone ancienne etant de toute facon opaque.
|
|
$bgBrush = New-Object System.Drawing.SolidBrush $bg
|
|
$g.FillEllipse($bgBrush, [float](47*$u), [float](43*$u), [float](14*$u), [float](14*$u))
|
|
$slot = New-Object System.Drawing.Drawing2D.GraphicsPath
|
|
$slot.AddLines(@(
|
|
(New-Object System.Drawing.PointF ([float](51*$u), [float](55.5*$u))),
|
|
(New-Object System.Drawing.PointF ([float](57*$u), [float](55.5*$u))),
|
|
(New-Object System.Drawing.PointF ([float](58.6*$u), [float](70*$u))),
|
|
(New-Object System.Drawing.PointF ([float](49.4*$u), [float](70*$u)))))
|
|
$slot.CloseFigure()
|
|
$g.FillPath($bgBrush, $slot)
|
|
$g.Dispose()
|
|
$bmp.Save((Join-Path $out 'ic_launcher.png'), [System.Drawing.Imaging.ImageFormat]::Png)
|
|
$bmp.Dispose()
|
|
"{0,-20} {1}x{1}" -f $dir, $n
|
|
}
|