diff --git a/pkg/dithering/IMG_0732.jpg b/pkg/dithering/cmd/IMG_0732.jpg similarity index 100% rename from pkg/dithering/IMG_0732.jpg rename to pkg/dithering/cmd/IMG_0732.jpg diff --git a/pkg/dithering/cmd/IMG_0732.png b/pkg/dithering/cmd/IMG_0732.png new file mode 100644 index 0000000..cb9411d Binary files /dev/null and b/pkg/dithering/cmd/IMG_0732.png differ diff --git a/pkg/dithering/cmd/schizophrenia.png b/pkg/dithering/cmd/schizophrenia.png new file mode 100644 index 0000000..6f647ca Binary files /dev/null and b/pkg/dithering/cmd/schizophrenia.png differ diff --git a/pkg/dithering/8x8grid.go b/pkg/dithering/grid.go similarity index 87% rename from pkg/dithering/8x8grid.go rename to pkg/dithering/grid.go index 6d311a7..5c29717 100644 --- a/pkg/dithering/8x8grid.go +++ b/pkg/dithering/grid.go @@ -5,6 +5,8 @@ import ( "image/color" ) +const side = 16 + type grid struct { color.Gray } @@ -14,16 +16,17 @@ func (_ grid) ColorModel() color.Model { } 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 { - n := g.Gray.Y / 4 + n := uint8(g.Gray.Y * 10) + if n == 0 { return color.Black } - step := int(64 / n) - if (y*8+x)%step == 0 { + step := int((side*side-1) / n) + if (y*side+x)%step == 0 { return color.White } return color.Black diff --git a/pkg/dithering/8x8grid_test.go b/pkg/dithering/grid_test.go similarity index 100% rename from pkg/dithering/8x8grid_test.go rename to pkg/dithering/grid_test.go