Documentation ¶
Index ¶
- Variables
- func BlendAlphaOverlay(cB, cA float64) (cO float64)
- func BlendChannelOverlay(cB, cA, aB, aA float64) (cO float64)
- func BlendColourOverlay(cB, cA color.Color) (cO color.Color)
- func BlendImages(iB *image.NRGBA, iA *image.NRGBA) (iO *image.NRGBA, err error)
- func ConvertImageToNRGBA(in image.Image) (out *image.NRGBA)
- func ConvertImageToRGBA(in image.Image) (out *image.RGBA)
- func CreateCaptcha(w, h uint) (c *m.Captcha, err error)
- func CreateCaptchaImage(w, h uint, useSample bool, blend bool) (canvas *image.NRGBA, ringCount uint, err error)
- func DegreeToRadian(degree float64) (radian float64)
- func DeleteImageFile(filePath string) (err error)
- func DrawImageToCanvas(in *image.RGBA, canvas image.Rectangle) (out *image.NRGBA)
- func DrawLineWithSimpleBrush(canvas *image.NRGBA, br *SimpleBrush, p1, p2 Point2D, blend bool)
- func DrawRingWithSimpleBrush(canvas *image.NRGBA, br *SimpleBrush, center Point2D, radius float64, ...)
- func FileNameWithoutExtension(fileName string) string
- func FillCanvasWithColour(canvas *image.NRGBA, col color.Color)
- func FillCanvasWithHGradient(canvas *image.NRGBA, cL, cR BrushColour) (err error)
- func FillCanvasWithVGradient(canvas *image.NRGBA, cT, cB BrushColour) (err error)
- func GetColorComponentsPM(c color.Color) (r, g, b, a float64)
- func GetColorComponentsS(c color.Color) (r, g, b, a float64)
- func GetImageFromFilePath(filePath string) (img image.Image, err error)
- func MakeFileName(id string) (fileName string)
- func MakeRGBA64(r, g, b, a float64) color.RGBA64
- func MakeRecordFilePath(imagesFolder string, id string) (path string)
- func MinInt(a, b int) (min int)
- func MinUint(a, b uint) (min uint)
- func RadianToDegree(radian float64) (degree float64)
- func SaveImageAsPngFile(img image.Image, filePath string) (err error)
- func UseSimpleBrush(canvas *image.NRGBA, brush *SimpleBrush, blend bool, u Point2D)
- func UseSimpleBrushS(canvas *image.NRGBA, brush *SimpleBrush, blend bool, u Point2D)
- func UseSolidBrush(canvas *image.NRGBA, brush *SolidBrush, u Point2D)
- type BrushColour
- type Distance
- type Point2D
- type SimpleBrush
- type SolidBrush
Constants ¶
This section is empty.
Variables ¶
var ( ColourWhite = BrushColour{R: 1.0, G: 1.0, B: 1.0, A: 1.0} ColourRed = BrushColour{R: 1.0, G: 0.0, B: 0.0, A: 1.0} ColourGreen = BrushColour{R: 0.0, G: 1.0, B: 0.0, A: 1.0} ColourBlue = BrushColour{R: 0.0, G: 0.0, B: 1.0, A: 1.0} ColourCyan = BrushColour{R: 0.0, G: 1.0, B: 1.0, A: 1.0} ColourMagenta = BrushColour{R: 1.0, G: 0.0, B: 1.0, A: 1.0} ColourYellow = BrushColour{R: 1.0, G: 1.0, B: 0.0, A: 1.0} ColourBlack = BrushColour{R: 0.0, G: 0.0, B: 0.0, A: 1.0} )
Functions ¶
func BlendAlphaOverlay ¶
BlendAlphaOverlay blends A and B alpha channels into O channel. B is the base layer, i.e. the bottom layer. A is the applied layer, i.e. the top layer.
func BlendChannelOverlay ¶
BlendChannelOverlay blends A and B channels into O channel. B is the base layer, i.e. the bottom layer. A is the applied layer, i.e. the top layer.
func BlendColourOverlay ¶
BlendColourOverlay blends A and B pixels into O pixel. B is the base layer, i.e. the bottom layer. A is the applied layer, i.e. the top layer.
func BlendImages ¶
BlendImages blends A and B images into O image. B is the base layer, i.e. the bottom layer. A is the applied layer, i.e. the top layer.
func CreateCaptcha ¶
func CreateCaptchaImage ¶
func DegreeToRadian ¶
func DeleteImageFile ¶
func DrawImageToCanvas ¶
DrawImageToCanvas draws an image on another canvas.
func DrawLineWithSimpleBrush ¶
func DrawLineWithSimpleBrush(canvas *image.NRGBA, br *SimpleBrush, p1, p2 Point2D, blend bool)
DrawLineWithSimpleBrush draws a straight line using a simple brush.
func DrawRingWithSimpleBrush ¶
func FillCanvasWithColour ¶
FillCanvasWithColour fills the canvas with colour.
func FillCanvasWithHGradient ¶
func FillCanvasWithHGradient(canvas *image.NRGBA, cL, cR BrushColour) (err error)
FillCanvasWithHGradient fills the canvas with a horizontal gradient. cL specifies the left side colour and cR is the right side colour.
func FillCanvasWithVGradient ¶
func FillCanvasWithVGradient(canvas *image.NRGBA, cT, cB BrushColour) (err error)
FillCanvasWithVGradient fills the canvas with a vertical gradient. cT specifies the top side colour and cB is the bottom side colour.
func GetColorComponentsPM ¶
GetColorComponentsPM extracts colour's components as usable floating point numbers. The returned values are pre-multiplied with alpha channel.
func GetColorComponentsS ¶
GetColorComponentsS extracts colour's components as usable floating point numbers. The returned values use straight alpha channel.
func MakeFileName ¶
func MakeRGBA64 ¶
MakeRGBA64 creates an RGBA64 colour with the provided channels.
func MakeRecordFilePath ¶
func RadianToDegree ¶
func UseSimpleBrush ¶
func UseSimpleBrush(canvas *image.NRGBA, brush *SimpleBrush, blend bool, u Point2D)
UseSimpleBrush creates a point using a simple brush.
func UseSimpleBrushS ¶
func UseSimpleBrushS(canvas *image.NRGBA, brush *SimpleBrush, blend bool, u Point2D)
UseSimpleBrushS creates a point using a simple brush with a sample.
func UseSolidBrush ¶
func UseSolidBrush(canvas *image.NRGBA, brush *SolidBrush, u Point2D)
UseSolidBrush creates a point using a solid brush.
Types ¶
type BrushColour ¶
func (BrushColour) PremultipliedToStraight ¶
func (bc BrushColour) PremultipliedToStraight() (out BrushColour)
func (BrushColour) RGBA ¶
func (bc BrushColour) RGBA() (r, g, b, a uint32)
RGBA method of the color.Color interface.
func (BrushColour) StraightToPremultiplied ¶
func (bc BrushColour) StraightToPremultiplied() (out BrushColour)
type SimpleBrush ¶
type SimpleBrush struct { InnerRadius float64 OuterRadius float64 Colour BrushColour // contains filtered or unexported fields }
SimpleBrush is a basic round brush with soft edges.
func (*SimpleBrush) GetSample ¶
func (sb *SimpleBrush) GetSample() (sample *image.NRGBA)
type SolidBrush ¶
type SolidBrush struct { InnerRadius float64 Colour BrushColour }
SolidBrush is a basic round brush without any soft edges.