utils

package
v0.0.0-...-d698c0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config config

Functions

func CalcAbs

func CalcAbs(a int) (ret int)

func DrawCircle

func DrawCircle(centerX, centerY, radius, thick int, c color.RGBA, rgba *image.RGBA)

func DrawDataLineByData

func DrawDataLineByData(data map[string]int, thick int, rgba *image.RGBA, lineColor, fontColor color.RGBA)

********* Start DrawDataLineByData ******** The first parameter is a map In this map, string is the subject's title on each vertex

func DrawDataLineByPercentage

func DrawDataLineByPercentage(data map[string]int, thick int, rgba *image.RGBA, lineColor, fontColor color.RGBA)

********* Start DrawDataLineByPercentage ******** The first parameter is a map In this map, string is the subject's title on each vertex

func DrawLine

func DrawLine(x0, y0, x1, y1, thick int, c color.RGBA, rgba *image.RGBA)

******** Start DrawLine *******

func DrawString

func DrawString(x, y int, content string, rgba *image.RGBA, fontColor color.RGBA)

func GCD

func GCD(x, y int) int

GCD

func GetRadiusRadians

func GetRadiusRadians(img *image.RGBA, n int) (radius int, radians float64)

This function only used for generate point position.

Get Radius according to the img's X & Y axis.

Get Radians according to N and radius.

func NewImagePath

func NewImagePath() (string, error)

Create a new image

The first parameter(A int array) indicates the maximum value of X-axis & Y-axis

This function could create PNG & JPEG file, you can determine it with a specific imageType string, you can ignore it to use default type -- PNG.

If you enter a wrong imageType string or not supported imageType, it would be change to default imageType.

This function returns a string -- new picture's path.

func Pow

func Pow(x, n int) int

func SetSize

func SetSize(size ...int) (img image.Rectangle)

Set maximum X & Y

If not require size, it will set default size dx = 2560, dy = 2560

If there's only one parameter, it will set X and let Y use default value

If there're more than one parameter, only use the previous two parameter

This function return an image.Rectangle

func ToInt

func ToInt(f float64) int

round to integer

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL