Documentation ¶
Index ¶
- func BlendImages(a, b image.Image, mode BlendingMode) (draw.Image, error)
- func BlendRGBA(a, b color.RGBA, mode BlendingMode) color.RGBA
- func CalculatePerceivedBrightness(c color.RGBA) float64
- func ColorToGrayscaleComponent(c color.Color) int
- func ColorToHsla(c color.Color) (int, float64, float64, float64)
- func ColorToRgba(c color.Color) color.RGBA
- func EscapePathQuotes(path string) (string, error)
- func GetDrawableImage(i image.Image) (draw.Image, error)
- func GetImageColumn(image image.Image, xIndex int) ([]color.Color, error)
- func GetImageFromFile(filePath string) (image.Image, error)
- func GetImageRow(image image.Image, yIndex int) ([]color.Color, error)
- func HasAnyTransparency(c color.Color) bool
- func InvertImage(i image.Image) (draw.Image, error)
- func RgbaToNormalizedComponents(c color.RGBA) (float64, float64, float64)
- func RotateImage(i image.Image, angle int) draw.Image
- func ScaleImage(i image.Image, percentage float64) (draw.Image, error)
- func SetImageColumn(image draw.Image, column []color.Color, xIndex int) error
- func SetImageRow(image draw.Image, row []color.Color, yIndex int) error
- func StoreImageToFile(filePath string, fileFormat string, img image.Image) error
- func TrimImageTransparentWorkspace(imageWithWorkspace draw.Image, imageOriginal image.Image) draw.Image
- type BlendingMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlendImages ¶
Blend two images using a given blending mode into a new image
func BlendRGBA ¶
func BlendRGBA(a, b color.RGBA, mode BlendingMode) color.RGBA
Perform blending of two colors according to a given blending mode TODO: Currently the alpha channel of the output color has a 0xff fixed value
func CalculatePerceivedBrightness ¶
Calculate the perceived brightness of the color given in the RGBA color space. https://stackoverflow.com/questions/596216/formula-to-determine-perceived-brightness-of-rgb-color
func ColorToGrayscaleComponent ¶
Convert the color.Color interface instance to the Y grayscale component represented as a integer in range from 0 to 255
func ColorToHsla ¶
Convert a color represented as color.Color interface implementation to HSL+Alpha components where Hue is expressed in degress (0-360) and the saturation, lightnes and alpha in percentage (0.0-1.0)
func ColorToRgba ¶
Convert a color represented as color.Color interface to color.RGBA struct. If the underlying color is a color.RGBA the original struct will be returned, otherwise a new color.RGBA instance will be created
func EscapePathQuotes ¶
Remove the quotes surrounding the path. The operation will fail for more than 10 iterations.
func GetDrawableImage ¶
Get the drawable copy of the provided image. The image is also redrawn to a new image.RGBA struct
func GetImageColumn ¶
Get the image column as a color.Color interface implementation slice specified by the x image index. The retrieval process is run parallel in several goroutines.
func GetImageFromFile ¶
Get the image from a file specified by the given path
func GetImageRow ¶
Get the image row as a color.Color interface implementation slice specified by the y image index. The retrieval process is run parallel in several goroutines.
func HasAnyTransparency ¶
Return a boolean value indicating if the given color.Color interface implementation has the alpha channel <255
func InvertImage ¶
Invert the colors (negative-effect) of the image
func RgbaToNormalizedComponents ¶
Convert the color.RGBA struct tu individual RGB components represented as floating point numbers in range from 0.0 to 1.0
func RotateImage ¶
Rotate the image by a given angle
Beacuse the dependency internal rotate implementation is using a custom pixel color handling solution we need to redraw the result image to ensure that the colors space is RGBA
func ScaleImage ¶
Function used to scale the image down according to given percentage parameter (Value from 0.0 to 1.0)
func SetImageColumn ¶
Set the colors of the column of the given image specified by the xIndex, according to the slice containing implementations of the color.Color interface. The changes made will be applied to the given draw.Image reference. The write process is run parallel in several goroutines.
func SetImageRow ¶
Set the colors of the row of the given image specified by the yIndex, according to the slice containing implementations of the color.Color interface. The changes made will be applied to the given draw.Image reference. The write process is run parallel in several goroutines.
func StoreImageToFile ¶
Create a new file with the given name and format and store the given image in it
func TrimImageTransparentWorkspace ¶
func TrimImageTransparentWorkspace(imageWithWorkspace draw.Image, imageOriginal image.Image) draw.Image
FIXME: Fix borders after interpolation and implement full transparency support in order to preserve PNG data. FIXME: Better handling for situations where there is not requirement to trim the workspace. Currently in such situation we are returning the original imageWithWorkspace draw.Image instead of creating a copy.
Remove all excess transparent workspace created during the rotation process from the image. The function is calculating the image located in the middle of the workspace and is cropping it. Due to rotation interpolation the borders of the image are not matching the original image, and the whole operation can cause some problems realted to transparent colors.
Time complexity: O(n)
Types ¶
type BlendingMode ¶
type BlendingMode int
Representation of a blending mode algorithm
const ( LightenOnly BlendingMode = iota DarkenOnly )