cmd
This commit is contained in:
39
cmd/negate/minus19blue.go
Normal file
39
cmd/negate/minus19blue.go
Normal file
@@ -0,0 +1,39 @@
|
||||
//go:build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/color"
|
||||
"image/png"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Reshade struct{ image.Image }
|
||||
|
||||
func (rs Reshade) ColorModel() color.Model { return rs.Image.ColorModel() }
|
||||
func (rs Reshade) Bounds() image.Rectangle { return rs.Image.Bounds() }
|
||||
func (rs Reshade) At(x, y int) color.Color {
|
||||
c := rs.Image.At(x, y)
|
||||
r, g, b, a := c.RGBA()
|
||||
// minus 19 blue
|
||||
return color.RGBA{
|
||||
uint8(r >> 8),
|
||||
uint8(g >> 8),
|
||||
uint8(b>>8) - 8*8,
|
||||
uint8(a >> 8),
|
||||
}
|
||||
}
|
||||
|
||||
func check(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
img, err := png.Decode(os.Stdin)
|
||||
check(err)
|
||||
err = png.Encode(os.Stdout, Reshade{img})
|
||||
check(err)
|
||||
}
|
||||
Reference in New Issue
Block a user