Documentation ¶
Overview ¶
Package gomp implements the Porter-Duff composition operations used for mixing a graphic element with its backdrop. Porter and Duff presented in their paper 12 different composition operation, but the core image/draw core package implements only the source-over-destination and source. This package implements all of the 12 composite operation together with some blending modes.
Package gomp implements the Porter-Duff composition operations used for mixing a graphic element with its backdrop. Porter and Duff presented in their paper 12 different composition operation, but the core image/draw core package implements only the source-over-destination and source. This package implements all of the 12 composite operation together with some blending modes.
Index ¶
- Constants
- func Abs[T constraints.Signed | constraints.Float](x T) T
- func Contains[T comparable](collection []T, value T) bool
- func ImgToNRGBA(img image.Image) *image.NRGBA
- func Max[T constraints.Ordered](values ...T) T
- func Min[T constraints.Ordered](values ...T) T
- type Bitmap
- type Blend
- func (bl *Blend) AlphaCompose(...) float64
- func (bl *Blend) Get() string
- func (bl *Blend) Lum(rgb Color) float64
- func (bl *Blend) Sat(rgb Color) float64
- func (bl *Blend) Set(blendType string) error
- func (bl *Blend) SetLum(rgb Color, l float64) Color
- func (bl *Blend) SetSat(rgb Color, s float64) Color
- type Color
- type Comp
Constants ¶
const ( Normal = "normal" Darken = "darken" Lighten = "lighten" Multiply = "multiply" Screen = "screen" Overlay = "overlay" SoftLight = "soft_light" HardLight = "hard_light" ColorDodge = "color_dodge" ColorBurn = "color_burn" Difference = "difference" Exclusion = "exclusion" // Non-separable blend modes Hue = "hue" Saturation = "saturation" ColorMode = "color" Luminosity = "luminosity" )
const ( Clear = "clear" Copy = "copy" Dst = "dst" SrcOver = "src_over" DstOver = "dst_over" SrcIn = "src_in" DstIn = "dst_in" SrcOut = "src_out" DstOut = "dst_out" SrcAtop = "src_atop" DstAtop = "dst_atop" Xor = "xor" )
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
func Abs[T constraints.Signed | constraints.Float](x T) T
Abs returns the absolut value of x.
func Contains ¶
func Contains[T comparable](collection []T, value T) bool
Contains returns true if a value is available in the collection.
func ImgToNRGBA ¶
ImgToNRGBA converts any image type to *image.NRGBA with min-point at (0, 0).
func Max ¶
func Max[T constraints.Ordered](values ...T) T
Max returns the biggest value from the provided parameters.
func Min ¶
func Min[T constraints.Ordered](values ...T) T
Min returns the lowest value from the provided parameters.
Types ¶
type Bitmap ¶
Bitmap holds an image type as a placeholder for the Porter-Duff composition operations which can be used as a source or destination image.
type Blend ¶
Blend struct contains the currently active blend mode and all the supported blend modes.
func (*Blend) AlphaCompose ¶
func (bl *Blend) AlphaCompose( backdropAlpha, sourceAlpha, compositeAlpha, backdropColor, sourceColor, compositeColor float64, ) float64
Applies the alpha blending formula for a blend operation. See: https://www.w3.org/TR/compositing-1/#blending
type Color ¶
type Color struct {
R, G, B float64
}
Color represents the RGB channel of a specific color.
type Comp ¶
Comp struct contains the currently active composition operation and all the supported operations.