Documentation
¶
Index ¶
- func Clamp8bit(value int) uint8
- func Clamp16bit(val int32) uint16
- func ClampFloat64(value, min, max float64) float64
- func ClampGeneric(value, min, max int) int
- func ColorAverage(colors []color.Color) color.Color
- func Luminance8bit(r, g, b uint32) float64
- func Luminance16bit(r, g, b uint32) float64
- func ParallelExecution(exec ParallelExecutionStruct) image.Image
- type ParallelExecutionStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clamp16bit ¶
Clamp16bit clamp the value between 0 and 65535:
Parameters:
- value: int32
Returns:
- uint16
func ClampFloat64 ¶ added in v0.7.5
ClampFloat64 clamps a float64 value between a minimum and maximum value.
Parameters:
- value: float64 representing the value to be clamped
- min: float64 representing the minimum value
- max: float64 representing the maximum value
Returns:
- float64 representing the clamped value
func ClampGeneric ¶
ClampGeneric constrains an integer value between a minimum and maximum value.
Parameters:
- value: int representing the value to be clamped
- min: int representing the minimum allowed value
- max: int representing the maximum allowed value
Returns:
- int representing the clamped value
func ColorAverage ¶ added in v0.6.4
ColorAverage calculates the average color of a slice of colors:
Parameters:
- colors: []color.Color
Returns:
- color.Color
func Luminance8bit ¶
Luminance8bit calculates the luminance of an image (0-255) using the formula: L = 0.299*R + 0.587*G + 0.114*B
Parameters:
- r,g,b: uint32 representing the red, green, and blue components of a color
Returns:
- float64 representing the luminance of the color
func Luminance16bit ¶
Luminance16bit calculates the luminance of an image (0-65535) using the formula: L = 0.299*R + 0.587*G + 0.114*B
Parameters:
- r,g,b: uint32 representing the red, green, and blue components of a color
Returns:
- float64 representing the luminance of the color
func ParallelExecution ¶
func ParallelExecution(exec ParallelExecutionStruct) image.Image
ParallelExecution processes an image in parallel using multiple CPU cores. It distributes the workload by dividing the image into horizontal strips and processing each strip concurrently with the provided function.
Parameters:
- exec: ParallelExecutionStruct containing the image, processing function, and optional size limit
Returns:
- image.Image: The resulting processed RGBA64 image
Types ¶
type ParallelExecutionStruct ¶
type ParallelExecutionStruct struct {
Image image.Image
Function func(int, int, *image.RGBA64, *sync.WaitGroup)
EndSize int
}
ParallelExecutionStruct contains parameters for parallel image processing.
Fields:
- Image: The source image to be processed
- Function: The function to apply to image regions (params: start y, end y, output image, waitgroup)
- EndSize: Optional limit for the y-coordinate (defaults to image height if <= 0)