Documentation ¶
Index ¶
- func CalculatePerceivedBrightness(c color.RGBA) float64
- func ColorToRgba(c color.Color) (color.RGBA, 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.RGBA) bool
- func InvertImage(i image.Image) (draw.Image, error)
- func NrgbaToGrayscaleComponent(c color.NRGBA) int
- func NrgbaToIntComponents(c color.NRGBA) (int, int, int)
- func RgbaToGrayscaleComponent(c color.RGBA) int
- func RgbaToHsl(c color.RGBA) (int, float64, float64)
- func RgbaToIntComponents(c color.RGBA) (int, int, int)
- func RgbaToNormalizedComponents(c color.RGBA) (float64, float64, float64)
- func RotateImage(i draw.Image, angle int) draw.Image
- func SetImageColumn(image *draw.Image, column []color.Color, xIndex int) error
- func SetImageRow(image *draw.Image, row []color.Color, yIndex int) error
- func StoreImageToFile(fileName string, fileFormat string, img image.Image) error
- func TrimImageTransparentWorkspace(imageWithWorkspace draw.Image, imageOriginal image.Image) draw.Image
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ColorToRgba ¶
Convert a color represented as color.Color interface to color.RGBA struct. This function will return an error if the underlying color is not a color.RGBA
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 interface slice specified by the x image index
func GetImageFromFile ¶
Get the image from a file specified by the given path
func GetImageRow ¶
Get the image row as a Color interface slice specified by the y image index
func HasAnyTransparency ¶
Return a boolean value indicating if the given color.RGBA color has the alpha channel >255
func InvertImage ¶
Invert the colors (negative-effect) of the image
func NrgbaToGrayscaleComponent ¶
Convert the color.NRGBA struct to the Y grayscale component represented as integer in range from 0 to 255
func NrgbaToIntComponents ¶
Convert the color.NRGBA struct to individual RGB components represented as integers in range from 0 to 255
func RgbaToGrayscaleComponent ¶
Convert the color.RGBA struct to the Y grayscale component represented as integer in range from 0 to 255
func RgbaToHsl ¶
Convert a color represented as color.RGBA to HSL components where Hue is expressed in degress (0-360) and the saturation and lightnes in percentage (0.0-1.0)
func RgbaToIntComponents ¶
Convert the color.RGBA struct to individual RGB components represented as integers in range from 0 to 255
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 SetImageColumn ¶
Append a Color interface slice representing a column at a given x index of the given image
func SetImageRow ¶
Append a Color interface slice representing a row at a given y index of the given image
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 ¶
This section is empty.