experiments and stuff
This commit is contained in:
|
Before Width: | Height: | Size: 424 KiB After Width: | Height: | Size: 424 KiB |
BIN
pkg/dithering/cmd/IMG_0732.png
Normal file
BIN
pkg/dithering/cmd/IMG_0732.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 MiB |
BIN
pkg/dithering/cmd/schizophrenia.png
Normal file
BIN
pkg/dithering/cmd/schizophrenia.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
@@ -5,6 +5,8 @@ import (
|
|||||||
"image/color"
|
"image/color"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const side = 16
|
||||||
|
|
||||||
type grid struct {
|
type grid struct {
|
||||||
color.Gray
|
color.Gray
|
||||||
}
|
}
|
||||||
@@ -14,16 +16,17 @@ func (_ grid) ColorModel() color.Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (_ grid) Bounds() image.Rectangle {
|
func (_ grid) Bounds() image.Rectangle {
|
||||||
return image.Rect(0, 0, 8, 8)
|
return image.Rect(0, 0, side, side)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g grid) At(x, y int) color.Color {
|
func (g grid) At(x, y int) color.Color {
|
||||||
n := g.Gray.Y / 4
|
n := uint8(g.Gray.Y * 10)
|
||||||
|
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return color.Black
|
return color.Black
|
||||||
}
|
}
|
||||||
step := int(64 / n)
|
step := int((side*side-1) / n)
|
||||||
if (y*8+x)%step == 0 {
|
if (y*side+x)%step == 0 {
|
||||||
return color.White
|
return color.White
|
||||||
}
|
}
|
||||||
return color.Black
|
return color.Black
|
||||||
Reference in New Issue
Block a user