to save up a progress

This commit is contained in:
2026-09-19 23:21:09 +03:00
parent 78cdfa3beb
commit e51ffde305
16 changed files with 267 additions and 13 deletions
+8 -4
View File
@@ -7,10 +7,14 @@ import (
const side = 16
type Options struct {
Factor float64
}
// tile
type grid struct {
color.Gray
Factor float64
Options
}
func (_ grid) ColorModel() color.Model {
@@ -22,7 +26,7 @@ func (_ grid) Bounds() image.Rectangle {
}
func (g grid) At(x, y int) color.Color {
n := uint8(float64(g.Gray.Y) * g.Factor)
n := uint8(float64(g.Gray.Y) * g.Options.Factor)
if n == 0 {
return color.Black
@@ -54,13 +58,13 @@ func (g uniformGrid) At(x, y int) color.Color {
type Dithering struct {
image.Image
Factor float64
Options
}
func (d Dithering) ColorModel() color.Model { return color.GrayModel }
func (d Dithering) Bounds() image.Rectangle { return d.Image.Bounds() }
func (d Dithering) At(x, y int) color.Color {
c := color.GrayModel.Convert(d.Image.At(x, y))
return uniformGrid{grid{c.(color.Gray), d.Factor}}.
return uniformGrid{grid{c.(color.Gray), d.Options.Factor}}.
At(x, y)
}