multiply, typo for lighten, resources

This commit is contained in:
Ali Gator 2022-05-02 21:35:21 +02:00
parent 5cb5e3bf9b
commit 141125d932
2 changed files with 10 additions and 1 deletions

View File

@ -16,6 +16,9 @@ Example : Blends three random pictures stored in specified folder, using averagi
# Resources
- [image package documentation on pkg.go.dev](https://pkg.go.dev/image)
- [github - phrozen's blend package](https://github.com/phrozen/blend/blob/master/blend.go)
- [Sighack - Averaging RGB Colors the Right Way](https://sighack.com/post/averaging-rgb-colors-the-right-way)
- [Sau Sheong - Image processing with Go](https://go-recipes.dev/more-working-with-images-in-go-30b11ab2a9f0?gi=3bb0ce492e2e)
- [Damitha Dayananda - Image Processing With GoLang](https://medium.com/@damithadayananda/image-processing-with-golang-8f20d2d243a2)
- [Image blending using pyramid](https://compvisionlab.wordpress.com/2013/05/13/image-blending-using-pyramid/)
- [Nancy Jo Ward | MA Digital Fine Arts - Blend Modes = Algorithms Explained](https://nancyjoward.wordpress.com/2018/04/17/blend-modes-algorithms-explained/)

View File

@ -207,6 +207,10 @@ func lighten(fc uint8, bc uint8, fa uint8) float64 {
return math.Max(float64(fc), float64(bc))
}
func multiply(fc uint8, bc uint8, fa uint8) float64 {
return float64(fc) * float64(bc) / 255
}
// produce absolute garbage
func fuckyfun(fc uint8, bc uint8, fa uint8) float64 {
return float64((fc * fa) + (bc * (fa * 2)))
@ -220,8 +224,10 @@ func blend(fc uint8, bc uint8, fa uint8, ba uint8) float64 {
newValue = darken(fc, bc, fa)
case "average":
newValue = average(fc, bc, fa)
case "ligten":
case "lighten":
newValue = lighten(fc, bc, fa)
case "multiply":
newValue = multiply(fc, bc, fa)
case "fuckyfun":
newValue = fuckyfun(fc, bc, fa)
default: