Recently Written · git

sbm-extension

sbm bookmarks for Firefox and Chrome: fuzzy search, add the page, sync with bm and the sbm app

git clone https://github.com/equwal/sbm-extension

Log | Files | Refs


icons/make-icons.ps1 (1597 bytes)

1 # Draws the sbm icon (a white ribbon on #005577) as PNG files.
2 # Usage: powershell -File make-icons.ps1 -Out <dir> -Sizes 16,32,48,128
3 param([string]$Out, [string]$Sizes)
4 Add-Type -AssemblyName System.Drawing
5 
6 foreach ($size in ($Sizes -split "," | ForEach-Object { [int]$_ })) {
7     $bmp = New-Object System.Drawing.Bitmap $size, $size
8     $g = [System.Drawing.Graphics]::FromImage($bmp)
9     $g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
10     $g.Clear([System.Drawing.Color]::Transparent)
11 
12     # A square with round corners.
13     $r = [single]($size * 0.18)
14     $d = 2 * $r
15     $e = [single]($size - 1)
16     $path = New-Object System.Drawing.Drawing2D.GraphicsPath
17     $path.AddArc(0, 0, $d, $d, 180, 90)
18     $path.AddArc($e - $d, 0, $d, $d, 270, 90)
19     $path.AddArc($e - $d, $e - $d, $d, $d, 0, 90)
20     $path.AddArc(0, $e - $d, $d, $d, 90, 90)
21     $path.CloseFigure()
22     $blue = New-Object System.Drawing.SolidBrush ([System.Drawing.Color]::FromArgb(255, 0, 0x55, 0x77))
23     $g.FillPath($blue, $path)
24 
25     # The ribbon of the Android icon: M40,30 L68,30 L68,80 L54,69 L40,80 Z,
26     # centred, 62 percent of the icon high.
27     $s = $size * 0.62 / 50
28     $c = $size / 2
29     $pts = @(@(-14, -25), @(14, -25), @(14, 25), @(0, 14), @(-14, 25)) | ForEach-Object {
30         New-Object System.Drawing.PointF ([single]($c + $_[0] * $s)), ([single]($c + $_[1] * $s))
31     }
32     $g.FillPolygon([System.Drawing.Brushes]::White, [System.Drawing.PointF[]]$pts)
33 
34     $bmp.Save((Join-Path $Out "$size.png"), [System.Drawing.Imaging.ImageFormat]::Png)
35     $g.Dispose()
36     $bmp.Dispose()
37 }