go fmt
This commit is contained in:
@@ -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() }
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
*/
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
package main
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user