Due programmi che condividono uModbusRTU e uGauge: - Console/PlanciaConsole: plancia nautica descritta da file XML, con modalita' plancia e modalita' configurazione. Comandi, spie, selettori, strumenti e allarmi sonori; il bus gira in un thread suo perche' la finestra non si fermi mai. - ProjectPlancia: il programma di prova piu' vecchio, usato per collaudare i canali. Le plance sono in Console/*.xml, la documentazione in Console/LEGGIMI.md. Esclusi dal versionamento i compilati (.exe, .dcu), i file dell'IDE e un audio da 17 MB. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
47 lines
1.9 KiB
PowerShell
47 lines
1.9 KiB
PowerShell
# Disegna la lamiera di un pannello: fondo chiaro sfumato, cornice e viti
|
|
# agli angoli. Usato per gli sfondi delle plance di esempio.
|
|
#
|
|
# powershell -File genera-sfondo.ps1 -Out ..\immagini\sfondo.png -W 1270 -H 950
|
|
|
|
param(
|
|
[string]$Out = 'D:\dev\Plancia\Console\immagini\antago-sfondo.png',
|
|
[int]$W = 1270,
|
|
[int]$H = 950
|
|
)
|
|
|
|
Add-Type -AssemblyName System.Drawing
|
|
|
|
$bmp = New-Object System.Drawing.Bitmap($W, $H, [System.Drawing.Imaging.PixelFormat]::Format32bppArgb)
|
|
$g = [System.Drawing.Graphics]::FromImage($bmp)
|
|
$g.SmoothingMode = 'AntiAlias'
|
|
|
|
# Lamiera verniciata: bianco sporco con una leggerissima ombreggiatura verticale.
|
|
$rect = New-Object System.Drawing.Rectangle(0, 0, $W, $H)
|
|
$c1 = [System.Drawing.Color]::FromArgb(255, 246, 246, 243)
|
|
$c2 = [System.Drawing.Color]::FromArgb(255, 226, 227, 224)
|
|
$br = New-Object System.Drawing.Drawing2D.LinearGradientBrush($rect, $c1, $c2, 90.0)
|
|
$g.FillRectangle($br, $rect)
|
|
|
|
# Cornice del pannello
|
|
$pen = New-Object System.Drawing.Pen ([System.Drawing.Color]::FromArgb(255, 120, 122, 120)), 3
|
|
$g.DrawRectangle($pen, 6, 6, ($W - 13), ($H - 13))
|
|
$pen2 = New-Object System.Drawing.Pen ([System.Drawing.Color]::FromArgb(90, 255, 255, 255)), 1
|
|
$g.DrawRectangle($pen2, 10, 10, ($W - 21), ($H - 21))
|
|
|
|
# Viti agli angoli
|
|
$screwFill = New-Object System.Drawing.SolidBrush ([System.Drawing.Color]::FromArgb(255, 176, 178, 176))
|
|
$screwEdge = New-Object System.Drawing.Pen ([System.Drawing.Color]::FromArgb(255, 110, 112, 110)), 2
|
|
$slot = New-Object System.Drawing.Pen ([System.Drawing.Color]::FromArgb(255, 90, 92, 90)), 3
|
|
foreach ($p in @(@(26, 26), @(($W - 46), 26), @(26, ($H - 46)), @(($W - 46), ($H - 46)))) {
|
|
$x = $p[0]
|
|
$y = $p[1]
|
|
$g.FillEllipse($screwFill, $x, $y, 20, 20)
|
|
$g.DrawEllipse($screwEdge, $x, $y, 20, 20)
|
|
$g.DrawLine($slot, ($x + 4), ($y + 14), ($x + 16), ($y + 6))
|
|
}
|
|
|
|
$g.Dispose()
|
|
$bmp.Save($Out, [System.Drawing.Imaging.ImageFormat]::Png)
|
|
$bmp.Dispose()
|
|
Write-Output ("{0} {1}x{2}" -f $Out, $W, $H)
|