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
|
||||
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//go:build upsampling
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
packagemain
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"image"
|
||||
|
||||
"git.nkpl.cc/twocookedfaggots/imageutils/pkg/downscale"
|
||||
"git.nkpl.cc/twocookedfaggots/imageutils/downscale"
|
||||
"git.nkpl.cc/twocookedfaggots/imageutils/util"
|
||||
)
|
||||
|
||||
var x = flag.Int("x", 256, "dx value of new bounds")
|
||||
var y = flag.Int("y", 256, "dy value of new bounds")
|
||||
var x = flag.Int("x", 1024, "dx value of new bounds")
|
||||
var y = flag.Int("y", 1024, "dy value of new bounds")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if err := util.ProcessStdio(func(img image.Image) image.Image {
|
||||
return downscale.GridDownscale{
|
||||
Image: img,
|
||||
Rectangle: image.Rect(0,0,x,y),
|
||||
Image: img,
|
||||
NewBounds: image.Rect(0, 0, *x, *y),
|
||||
}
|
||||
}); err != nil {
|
||||
panic(err)
|
||||
|
||||
+21
-23
@@ -10,29 +10,27 @@ var (
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
|
||||
|
||||
f, err := truetype.Parse(gomono.TTF)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
face := truetype.NewFace(f, &truetype.Options{
|
||||
Size: float64(img.Bounds().Dx() / size),
|
||||
DPI: 72,
|
||||
Hinting: font.HintingNone,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
face := truetype.NewFace(f, &truetype.Options{
|
||||
Size: float64(img.Bounds().Dx() / size),
|
||||
DPI: 72,
|
||||
Hinting: font.HintingNone,
|
||||
})
|
||||
|
||||
d := &font.Drawer{
|
||||
Dst: dst,
|
||||
Src: image.NewUniform(color.Black),
|
||||
Face: face,
|
||||
Dot: fixed.Point26_6{fixed.Int26_6(img.Bounds().Dx() /
|
||||
x,
|
||||
),
|
||||
fixed.Int26_6(img.Bounds().Dy() /
|
||||
y,
|
||||
),
|
||||
},
|
||||
}
|
||||
d.DrawString(time.Now().Format(time.Kitchen))
|
||||
d := &font.Drawer{
|
||||
Dst: dst,
|
||||
Src: image.NewUniform(color.Black),
|
||||
Face: face,
|
||||
Dot: fixed.Point26_6{fixed.Int26_6(img.Bounds().Dx() /
|
||||
x,
|
||||
),
|
||||
fixed.Int26_6(img.Bounds().Dy() /
|
||||
y,
|
||||
),
|
||||
},
|
||||
}
|
||||
d.DrawString(time.Now().Format(time.Kitchen))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user