chore: add license file, add icons, images flow, update readme
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$svg = "assets/icon.svg"
|
||||
|
||||
magick -background none $svg -resize 256x256 assets/icon.png
|
||||
magick -background none $svg -define icon:auto-resize=256,128,64,48,32,24,16 assets/app.ico
|
||||
|
||||
foreach ($size in @(16, 24, 32, 44, 48, 50, 64, 88, 128, 150, 256, 512)) {
|
||||
magick -background none $svg -resize "${size}x${size}" ("assets/icon-{0}.png" -f $size)
|
||||
}
|
||||
|
||||
Write-Host "icons regenerated: icon.png, app.ico, icon-{16..512}.png"
|
||||
@@ -29,6 +29,11 @@ Copy-Item $src (Join-Path $installDir "bropicker.exe") -Force
|
||||
Copy-Item (Join-Path $PSScriptRoot "..\logos") (Join-Path $installDir "logos") -Recurse -Force
|
||||
Copy-Item (Join-Path $PSScriptRoot "..\icons") (Join-Path $installDir "icons") -Recurse -Force
|
||||
|
||||
$licensesDir = Join-Path $installDir "licenses"
|
||||
New-Item -ItemType Directory -Force -Path $licensesDir | Out-Null
|
||||
Copy-Item (Join-Path $PSScriptRoot "..\licenses\Slint-Royalty-free-2.0.md") $licensesDir -Force
|
||||
Copy-Item (Join-Path $PSScriptRoot "..\logos\LICENSE-browser-logos.txt") $licensesDir -Force
|
||||
|
||||
$exe = Join-Path $installDir "bropicker.exe"
|
||||
Write-Host "Installed to: $exe"
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
cargo build
|
||||
if ($LASTEXITCODE -ne 0) { exit 1 }
|
||||
|
||||
New-Item -ItemType Directory -Force -Path docs\img | Out-Null
|
||||
$exe = Join-Path $PWD "target\debug\bropicker.exe"
|
||||
|
||||
$proc = Start-Process -FilePath $exe -WorkingDirectory $PWD -PassThru
|
||||
Start-Sleep -Milliseconds 1800
|
||||
powershell -ExecutionPolicy Bypass -File "$PSScriptRoot\shot.ps1" -ProcId $proc.Id -Out docs\img\screenshot-dark.png -Card
|
||||
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
|
||||
if ($LASTEXITCODE -ne 0) { exit 1 }
|
||||
|
||||
$env:BP_THEME = "light"
|
||||
$proc = Start-Process -FilePath $exe -WorkingDirectory $PWD -PassThru
|
||||
Start-Sleep -Milliseconds 1800
|
||||
powershell -ExecutionPolicy Bypass -File "$PSScriptRoot\shot.ps1" -ProcId $proc.Id -Out docs\img\screenshot-light.png -Card
|
||||
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\BP_THEME -ErrorAction SilentlyContinue
|
||||
if ($LASTEXITCODE -ne 0) { exit 1 }
|
||||
|
||||
Write-Host "screenshots updated: docs\img\screenshot-{dark,light}.png"
|
||||
+44
-3
@@ -1,7 +1,8 @@
|
||||
param(
|
||||
[string]$ProcName = "bropicker",
|
||||
[int]$ProcId = 0,
|
||||
[string]$Out = "tools/out/app.png"
|
||||
[string]$Out = "tools/out/app.png",
|
||||
[switch]$Card
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
@@ -18,6 +19,7 @@ public class BpWin {
|
||||
[DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr hWnd, out RECT rect);
|
||||
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr after, int x, int y, int cx, int cy, uint flags);
|
||||
[DllImport("user32.dll")] public static extern uint GetDpiForWindow(IntPtr hWnd);
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct RECT { public int Left; public int Top; public int Right; public int Bottom; }
|
||||
}
|
||||
@@ -64,11 +66,50 @@ if ($w -le 0 -or $h -le 0) {
|
||||
}
|
||||
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
$bmp = New-Object System.Drawing.Bitmap($w, $h)
|
||||
$g = [System.Drawing.Graphics]::FromImage($bmp)
|
||||
$full = New-Object System.Drawing.Bitmap($w, $h)
|
||||
$g = [System.Drawing.Graphics]::FromImage($full)
|
||||
$g.CopyFromScreen($rect.Left, $rect.Top, 0, 0, (New-Object System.Drawing.Size($w, $h)))
|
||||
$g.Dispose()
|
||||
|
||||
if ($Card) {
|
||||
$dpi = [BpWin]::GetDpiForWindow($found)
|
||||
$scale = if ($dpi -gt 0) { $dpi / 96.0 } else { 1.0 }
|
||||
$inset = [int][Math]::Round(20 * $scale)
|
||||
$radius = [int][Math]::Round(16 * $scale)
|
||||
|
||||
$clipInset = 2
|
||||
$cw = $w - 2 * $inset - 2 * $clipInset
|
||||
$ch = $h - 2 * $inset - 2 * $clipInset
|
||||
$srcX = $inset + $clipInset
|
||||
$srcY = $inset + $clipInset
|
||||
$radius = [Math]::Max(1, $radius - $clipInset)
|
||||
|
||||
$bmp = New-Object System.Drawing.Bitmap($cw, $ch)
|
||||
$g2 = [System.Drawing.Graphics]::FromImage($bmp)
|
||||
$g2.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
|
||||
$g2.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
|
||||
|
||||
$cardPath = New-Object System.Drawing.Drawing2D.GraphicsPath
|
||||
$cardPath.AddArc(0, 0, $radius, $radius, 180, 90)
|
||||
$cardPath.AddArc($cw - $radius, 0, $radius, $radius, 270, 90)
|
||||
$cardPath.AddArc($cw - $radius, $ch - $radius, $radius, $radius, 0, 90)
|
||||
$cardPath.AddArc(0, $ch - $radius, $radius, $radius, 90, 90)
|
||||
$cardPath.CloseFigure()
|
||||
|
||||
$g2.SetClip($cardPath)
|
||||
$srcRect = New-Object System.Drawing.Rectangle($srcX, $srcY, $cw, $ch)
|
||||
$dstRect = New-Object System.Drawing.Rectangle(0, 0, $cw, $ch)
|
||||
$g2.DrawImage($full, $dstRect, $srcRect, [System.Drawing.GraphicsUnit]::Pixel)
|
||||
$g2.Dispose()
|
||||
$cardPath.Dispose()
|
||||
$full.Dispose()
|
||||
|
||||
$w = $cw
|
||||
$h = $ch
|
||||
} else {
|
||||
$bmp = $full
|
||||
}
|
||||
|
||||
$outDir = Split-Path -Parent (Join-Path $PWD $Out)
|
||||
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
|
||||
$outAbs = [System.IO.Path]::GetFullPath((Join-Path $PWD $Out))
|
||||
|
||||
Reference in New Issue
Block a user