func Saturation(percentage float32) Filter {
	p := 1 + minf32(maxf32(percentage, -100), 500)/100
	if p == 1 {
		return &copyimageFilter{}
	}

	return &colorFilter{
		fn: func(px pixel) pixel {
			h, s, l := convertRGBToHSL(px.r, px.g, px.b)
			s *= p
			if s > 1 {
				s = 1
			}
			r, g, b := convertHSLToRGB(h, s, l)
			return pixel{r, g, b, px.a}
		},
	}
}
// Saturation creates a filter that changes the saturation of an image.
// The percentage parameter must be in range (-100, 500). The percentage = 0 gives the original image.
Saturation creates a filter that changes the saturation of an image.
The percentage parameter must be in range (-100, 500). The percentage = 0 gives the original image.
// Saturation creates a filter that changes the saturation of an image . // The percentage parameter must be in range ( - 100 500 ) . The percentage = 0 gives the original image .
func Saturation(percentage float32) Filter {
	p := 1 + minf32(maxf32(percentage, -100), 500)/100
	if p == 1 {
		return &copyimageFilter{}
	}
	return &colorFilter{
		fn: func(px pixel) pixel {
			h, s, l := convertRGBToHSL(px.r, px.g, px.b)
			s *= p
			if s > 1 {
				s = 1
			}
			r, g, b := convertHSLToRGB(h, s, l)
			return pixel{r, g, b, px.a}
		},
	}
}
func Saturation ( percentage float32 ) Filter { p := 1 + minf32 ( maxf32 ( percentage , - 100 ) , 500 ) / 100 if p == 1 { return & copyimageFilter { } } return & colorFilter { fn : func ( px pixel ) pixel { h , s , l := convertRGBToHSL ( px . r , px . g , px . b ) s *= p if s > 1 { s = 1 } r , g , b := convertHSLToRGB ( h , s , l ) return pixel { r , g , b , px . a } } , } }
Saturation creates a filter that changes the saturation of an image.
Saturation creates a filter that changes the saturation of an image .