refactor
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"image/color"
|
||||
"image/png"
|
||||
"os"
|
||||
|
||||
"git.nkpl.cc/twocookedfaggots/imageutils/util"
|
||||
)
|
||||
|
||||
func NegateRGBA(c color.RGBA) color.RGBA {
|
||||
@@ -30,15 +32,10 @@ func (n Negate) At(x, y int) color.Color {
|
||||
return NegateRGBA(RGBAColor)
|
||||
}
|
||||
|
||||
func check(err error) {
|
||||
if err != nil {
|
||||
func main() {
|
||||
if err := util.ProcessStdio(func(img image.Image) image.Image {
|
||||
return Negate{img}
|
||||
}); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
img, err := png.Decode(os.Stdin)
|
||||
check(err)
|
||||
err = png.Encode(os.Stdout, Negate{img})
|
||||
check(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user