Documentation ¶
Index ¶
- Constants
- Variables
- func DrawFilledTriangle(gc *draw2dimg.GraphicContext, pt1, pt2, pt3 Point, ...)
- func DrawLine(gc *draw2dimg.GraphicContext, pt1, pt2 Point, color color.RGBA)
- func DrawRectangle(gc *draw2dimg.GraphicContext, x, y, width, height float64, color color.RGBA)
- func DrawTriangle(gc *draw2dimg.GraphicContext, pt1, pt2, pt3 Point, strokeColor color.RGBA)
- func FillImage(image *image.RGBA, color color.RGBA)
- func FillRectangle(gc *draw2dimg.GraphicContext, x, y, width, height float64, color color.RGBA)
- func GetCSV(text string) ([]string, error)
- func ParseColor(txt string) (color.RGBA, error)
- func ParseHexColor(txt string) (color.RGBA, error)
- func ParseNameColor(txt string) (color.RGBA, error)
- func ParseRGBColor(txt string) (color.RGBA, error)
- func PutPixel(gc *draw2dimg.GraphicContext, x, y float64, color color.RGBA)
- func RandomAlphaColor() color.RGBA
- func RandomColor() color.RGBA
- func SubString(text string, start, end int) string
- type ColorPalette
- type Point
- type Rect
- type Transition
Constants ¶
const (
LINE_WIDTH = 0.2
)
const (
WHITESPACE_CUTSET = " \t\n"
)
Variables ¶
var (
EMPTY_REGION = Rect{0, 0, 0, 0}
)
var (
NIL_COLOR = color.RGBA{0, 0, 0, 0}
)
Functions ¶
func DrawFilledTriangle ¶
func DrawFilledTriangle(gc *draw2dimg.GraphicContext, pt1, pt2, pt3 Point, strokeColor, fillColor color.RGBA)
Draws a filled triangle in an image.
*pt1*: The first point of the triangle. *pt2*: The second point of the triangle. *pt3*: The third point of the triangle. *strokeColor*: The color to stroke the triangle with. *fillColor*: The color to fill the triangle with.
func DrawLine ¶
func DrawLine(gc *draw2dimg.GraphicContext, pt1, pt2 Point, color color.RGBA)
Draws a line in an image.
*pt1*: The starting point of the line. *pt2*: The ending point of the line. *color*: The color to stroke the line with.
func DrawRectangle ¶
func DrawRectangle(gc *draw2dimg.GraphicContext, x, y, width, height float64, color color.RGBA)
Draws a rectangle in an image.
*image*: The image to draw the rectangle in. *x*: The horizontal offset of the rectangle. *y*: The vertical offset of the rectangle. *width*: The width of the rectangle. *height*: The height of the rectangle. *color*: The color to stroke the rectangle with.
func DrawTriangle ¶
func DrawTriangle(gc *draw2dimg.GraphicContext, pt1, pt2, pt3 Point, strokeColor color.RGBA)
Draws a triangle in an image.
*pt1*: The first point of the triangle. *pt2*: The second point of the triangle. *pt3*: The third point of the triangle. *strokeColor*: The color to stroke the triangle with.
func FillImage ¶
Fills an image with color.
*image*: The image to fill. *color*: The color to fill the image with.
func FillRectangle ¶
func FillRectangle(gc *draw2dimg.GraphicContext, x, y, width, height float64, color color.RGBA)
Draws a filled rectangle in an image.
*image*: The image to draw the rectangle in. *x*: The horizontal offset of the rectangle. *y*: The vertical offset of the rectangle. *width*: The width of the rectangle. *height*: The height of the rectangle. *color*: The color to fill the rectangle with.
func ParseNameColor ¶
Returns the color value of a predetermined color that matches the given name.
func ParseRGBColor ¶
Parses an rgb(a)? color value.
Format of text: rgb(\d+, \d+, \d+) or rgb(\d+, \d+, \d+)
func PutPixel ¶
func PutPixel(gc *draw2dimg.GraphicContext, x, y float64, color color.RGBA)
Adds a pixel to an image.
*x*: The horizontal position of the pixel. *y*: The vertical position of the pixel.
func RandomAlphaColor ¶
Generates a color with random rgba values.
Types ¶
type ColorPalette ¶
type ColorPalette struct { Name string `yaml:"name"` Transitions []Transition `yaml:"transitions"` }
Represents a color palette.
func ParseColorPalette ¶
func ParseColorPalette(txt string) (ColorPalette, error)
Parses a string into a color palette.
func ParseNameColorPalette ¶
func ParseNameColorPalette(name string) (ColorPalette, error)
Returns the color value of a predetermined color palette that matches the given name.
func (*ColorPalette) GetColor ¶
func (palette *ColorPalette) GetColor(pos float64) (color.RGBA, error)
Gets the color value of a given position in this ColorPalette.
func (*ColorPalette) TranslateColorTransitions ¶
func (palette *ColorPalette) TranslateColorTransitions() error
Translate the value of the color transitions for this color palette.
type Rect ¶
type Rect struct { X float64 `json:"x"` Y float64 `json:"y"` Width float64 `json:"width"` Height float64 `json:"height"` }
Represents a rectangular region.
type Transition ¶
type Transition struct { Color string `yaml:"color"` Position float32 `yaml:"position"` // contains filtered or unexported fields }
Represents a color transition.