delete unused blending functions

This commit is contained in:
mappu 2018-06-09 17:38:15 +12:00
parent 774de75d6f
commit ae7119f65a
1 changed files with 0 additions and 35 deletions

View File

@ -1,35 +0,0 @@
package thumbnail
import (
"image/color"
)
func Blend(a, b color.Color) color.Color {
switch a.(type) {
case color.RGBA:
return BlendRGBA(a.(color.RGBA), b.(color.RGBA)) // FIXME there's syntax for this
case color.YCbCr:
return BlendYCbCr(a.(color.YCbCr), b.(color.YCbCr))
default:
return a // ??? unknown color format
}
}
func BlendYCbCr(a, b color.YCbCr) color.YCbCr {
return color.YCbCr{
Y: uint8((int(a.Y) + int(b.Y)) / 2),
Cb: uint8((int(a.Cb) + int(b.Cb)) / 2),
Cr: uint8((int(a.Cr) + int(b.Cr)) / 2),
}
}
func BlendRGBA(a, b color.RGBA) color.RGBA {
return color.RGBA{
R: uint8((int(a.R) + int(b.R)) / 2),
G: uint8((int(a.G) + int(b.G)) / 2),
B: uint8((int(a.B) + int(b.B)) / 2),
A: uint8((int(a.A) + int(b.A)) / 2),
}
}