September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
27
Task/Pinstripe-Display/Go/pinstripe-display.go
Normal file
27
Task/Pinstripe-Display/Go/pinstripe-display.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package main
|
||||
|
||||
import "github.com/fogleman/gg"
|
||||
|
||||
var palette = [2]string{
|
||||
"FFFFFF", // white
|
||||
"000000", // black
|
||||
}
|
||||
|
||||
func pinstripe(dc *gg.Context) {
|
||||
w := dc.Width()
|
||||
h := dc.Height() / 4
|
||||
for b := 1; b <= 4; b++ {
|
||||
for x, ci := 0, 0; x < w; x, ci = x+b, ci+1 {
|
||||
dc.SetHexColor(palette[ci%2])
|
||||
y := h * (b - 1)
|
||||
dc.DrawRectangle(float64(x), float64(y), float64(b), float64(h))
|
||||
dc.Fill()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
dc := gg.NewContext(900, 600)
|
||||
pinstripe(dc)
|
||||
dc.SavePNG("w_pinstripe.png")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue