Documentation ¶
Index ¶
- func BlendImagesNrgba(a, b *image.NRGBA, mode BlendingMode) (*image.NRGBA, error)
- func BlendNrgba(a, b color.NRGBA, mode BlendingMode) color.NRGBA
- func CIntn(n int) int
- func CalculatePerceivedBrightness(c color.RGBA) float64
- func ClampFloat64(min, x, max float64) float64
- func ClampInt(min, x, max int) int
- func EscapePathQuotes(path string) (string, error)
- func GetImageCopyNrgba(i *image.NRGBA) *image.NRGBA
- func GetImageCopyRgba(i *image.RGBA) *image.RGBA
- func GetImageFromFile(filePath string) (image.Image, error)
- func GrayscaleNrgba(i *image.NRGBA) *image.NRGBA
- func ImageToNrgbaImage(i image.Image) *image.NRGBA
- func ImageToRgbaImage(i image.Image) *image.RGBA
- func InterpolateRgba(a, b color.RGBA, t float64) color.RGBA
- func InvertImageNrgba(i *image.NRGBA) *image.NRGBA
- func Lerp(a, b, t float64) float64
- func Max2Uint8(a, b uint8) uint8
- func Max3Float64(a, b, c float64) float64
- func Min2Uint8(a, b uint8) uint8
- func Min3Float64(a, b, c float64) float64
- func NewErrorTrap() *errorTrap
- func NrgbaToGrayscaleComponent(c color.NRGBA) int
- func NrgbaToRgbaImage(i *image.NRGBA) *image.RGBA
- func RgbaToHsla(c color.RGBA) (int, float64, float64, float64)
- func RgbaToNormalizedComponents(c color.RGBA) (float64, float64, float64)
- func RgbaToNrgbaImage(i *image.RGBA) *image.NRGBA
- func RotateImageNrgba(i *image.NRGBA, angle int) *image.NRGBA
- func RotateImageWithRevertNrgba(i *image.NRGBA, angle int) (*image.NRGBA, func(*image.NRGBA) *image.NRGBA)
- func ScaleImageNrgba(i *image.NRGBA, percentage float64) (*image.NRGBA, error)
- func StoreImageToFile(filePath string, fileFormat string, img image.Image) error
- func TrimImageTransparentWorkspaceNrgba(withWorkspace *image.NRGBA, original image.Rectangle) *image.NRGBA
- type BlendingMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlendImagesNrgba ¶
Blend two NRGBA images using a given blending mode into a new image.
func BlendNrgba ¶
func BlendNrgba(a, b color.NRGBA, mode BlendingMode) color.NRGBA
Perform blending of two color.NRGBA colors according to a given blending mode TODO: Currently the alpha channel of the output color has a fixed 0xff value
func CIntn ¶
Thread-safe equivalent of rand.Intn that generates values in range: [0, n). See rand.Intn specification for more details. This implementation does not support seeds.
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 ClampFloat64 ¶
Clamp the x float64 between min and max. Return min if x is smaller than min and max if x is greater than max, otherwise return x.
func ClampInt ¶
Clamp the x int between min and max. Return min if x is smaller than min and max if x is greater than max, otherwise return x.
func EscapePathQuotes ¶
Remove the quotes surrounding the path. The operation will fail for more than 10 iterations.
func GetImageCopyNrgba ¶
Get a copy of the provided image.NRGBA image. This function will panic if the provided image pointer is nil.
func GetImageCopyRgba ¶
Get a copy of the provided image.RGBA image. This function will panic if the provided image pointer is nil.
func GetImageFromFile ¶
Get the image from a file specified by the given path
func GrayscaleNrgba ¶
Create a grayscale version of the provided NRGBA color-space image.
func ImageToNrgbaImage ¶
Convert a image represented by image.Image to a NRGBA image. If the underlying type is already NRGBA a reference to the original input will be returned, otherwis a copy will be created.
func ImageToRgbaImage ¶
Convert a image represented by image.Image to a RGBA image. If the underlying type is already RGBA a reference to the original input will be returned, otherwis a copy will be created.
func InterpolateRgba ¶
Performa a linear interpolation between two color.RGBA colors and return the interpolated color for the given t point
func InvertImageNrgba ¶
Invert the colors (negative-effect) of the given NRGBA image.
func Lerp ¶
Perform a linear interpolation between value "a" and "b" and return the interpolated value at "t"
func Max3Float64 ¶
Get the greatest float64 from the three provided values.
func Min3Float64 ¶
Get the smallest float64 from the three provided values.
func NewErrorTrap ¶
func NewErrorTrap() *errorTrap
Create a new atomic error trap which can be used to capture the first error accross multiple goroutines.
func NrgbaToGrayscaleComponent ¶
Convert the color.NRGBA color to the Y grayscale component represented as a integer in range from 0 to 255. Note that the alpha channel is not taken under account and the result is non-alpha-premultiplied.
func NrgbaToRgbaImage ¶
Create a RGBA color-space copy of an image represented in the NRGBA color-space.
func RgbaToHsla ¶
Convert a color.RGBA color 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 RgbaToNormalizedComponents ¶
Convert the color.RGBA struct tu individual RGB components represented as floating point numbers in range from 0.0 to 1.0
func RgbaToNrgbaImage ¶
Create a NRGBA color-space copy of an image represented in the RGBA color-space. TODO: Reimplement this function using the pimit parallelization
func RotateImageNrgba ¶
Rotate the NRGBA image counter-clockwise by a given angle.
func RotateImageWithRevertNrgba ¶
func RotateImageWithRevertNrgba(i *image.NRGBA, angle int) (*image.NRGBA, func(*image.NRGBA) *image.NRGBA)
Rotate the NRGBA image counter-clockwise by a given angle and expose a function that can be used to rotate the image back to its previous state and remove excess workspace transparency.
func ScaleImageNrgba ¶
Function used to scale a NRGBA image down according to given percentage parameter (Value from 0.0 to 1.0).
func StoreImageToFile ¶
Create a new file with the given name and format and store the given image in it
Types ¶
type BlendingMode ¶
type BlendingMode int
Representation of a blending mode algorithm
const ( LightenOnly BlendingMode = iota DarkenOnly )