This commit is contained in:
2026-06-21 01:18:50 +03:00
parent afd438930e
commit 3b32bfa85f
20 changed files with 70 additions and 73 deletions
+4 -4
View File
@@ -29,14 +29,14 @@ func Circles(b image.Rectangle, radius int) chan iu.Circle {
var exchange = color.ModelFunc(
func(c color.Color) color.Color {
if color.Alpha16Model.Convert(c) == color.Transparent{
if color.Alpha16Model.Convert(c) == color.Transparent {
return color.Opaque
}
return color.Transparent
},
)
type Exchange struct { image.Image }
type Exchange struct{ image.Image }
func (e Exchange) ColorModel() color.Model { return color.Alpha16Model }
func (e Exchange) Bounds() image.Rectangle { return e.Image.Bounds() }
@@ -47,7 +47,7 @@ func (e Exchange) At(x, y int) color.Color {
var blackAndWhite = color.ModelFunc(
func(c color.Color) color.Color {
if color.Alpha16Model.Convert(c) == color.Transparent{
if color.Alpha16Model.Convert(c) == color.Transparent {
return color.Black
}
return color.White
@@ -55,7 +55,7 @@ var blackAndWhite = color.ModelFunc(
)
// Black and white's alpha image.
type BlackAndWhite struct { image.Image }
type BlackAndWhite struct{ image.Image }
func (b BlackAndWhite) ColorModel() color.Model { return color.GrayModel }
func (b BlackAndWhite) Bounds() image.Rectangle { return b.Image.Bounds() }
+4 -4
View File
@@ -15,10 +15,10 @@ func main() {
circles := Circles(canvas.Bounds(), 2160/6)
palette := []color.Color{
color.RGBA{R:255, A:255},
color.RGBA{G:255, A:255},
color.RGBA{B:255, A:255},
color.RGBA{R: 255, A: 255},
color.RGBA{G: 255, A: 255},
color.RGBA{B: 255, A: 255},
}
c := palette[rand.Int()%2]
}
+4 -4
View File
@@ -10,10 +10,10 @@ func main() {
draw.Draw(canvas, c.Bounds(), xor{c, canvas}, c.Bounds().Min, draw.Src)
/*
draw.DrawMask(
canvas, canvas.Bounds(), &image.Uniform{color.White},
image.Point{}, xor{c, canvas}, image.Point{}, draw.Src,
)
draw.DrawMask(
canvas, canvas.Bounds(), &image.Uniform{color.White},
image.Point{}, xor{c, canvas}, image.Point{}, draw.Src,
)
*/
}
/*
+1 -1
View File
@@ -11,7 +11,7 @@ func (t xor) At(x, y int) color.Color {
srcColor := t.ColorModel().Convert(t.src.At(x, y))
// xor operation (a || b) && !(a && b)
if ((dstColor == color.Opaque) || (srcColor == color.Opaque)) &&
if ((dstColor == color.Opaque) || (srcColor == color.Opaque)) &&
!((dstColor == color.Opaque) && (srcColor == color.Opaque)) {
return color.Opaque
}
-2
View File
@@ -1,3 +1 @@
package main
+1 -1
View File
@@ -5,5 +5,5 @@ import (
)
func main() {
}