Documentation ¶
Overview ¶
Package geopattern creates beautiful generative image patterns from a string.
Index ¶
- Constants
- Variables
- func Base64String(args Pattern) string
- func BuildChevron(width, height float64) [2]string
- func BuildDiamond(width, height float64) string
- func BuildHexagon(sideLength float64) string
- func BuildOctagon(squareSize float64) string
- func BuildPlus(squareSize float64) [2]string
- func BuildRightTriangle(sideLength float64) string
- func BuildRotatedTriangle(sideLength, width float64) string
- func BuildTriangle(sideLength, height float64) string
- func DrawInnerMosaicTile(s *SVG, x, y, triangleSize float64, values [2]float64)
- func DrawOuterMosaicTile(s *SVG, x, y, triangleSize, value float64)
- func FillColor(value float64) string
- func Generate(args Pattern) string
- func Hash(s string) string
- func HexVal(str string, index, length int) float64
- func Map(value, aMin, aMax, bMin, bMax float64) float64
- func Merge(mapA map[string]interface{}, mapB map[string]interface{}) map[string]interface{}
- func Opacity(value float64) float64
- func URIimage(args Pattern) string
- type Pattern
- type SVG
- func (s *SVG) Circle(cx, cy, r interface{}, args map[string]interface{})
- func (s *SVG) Group(elements [2]string, args map[string]interface{})
- func (s *SVG) Path(str string, args map[string]interface{})
- func (s *SVG) Polyline(str string, args map[string]interface{})
- func (s *SVG) Rect(x, y, w, h interface{}, args map[string]interface{})
- func (s *SVG) SetHeight(h int)
- func (s *SVG) SetWidth(w int)
- func (s *SVG) Str() string
- func (s *SVG) WriteArgs(args map[string]interface{}) string
Constants ¶
const ( BaseColor string = "#9e2c7b" StrokeColor string = "#000" StrokeOpacity float64 = 0.02 FillColorDark string = "#222" FillColorLight string = "#ddd" OpacityMin float64 = 0.02 OpacityMax float64 = 0.15 )
constants representing stroke, fill's opacity and color, base color, minimum and maximum opacity value
Variables ¶
var PATTERNS = [16]string{
"chevrons",
"concentric-circles",
"diamonds",
"hexagons",
"mosaic-squares",
"nested-squares",
"octagons",
"overlapping-circles",
"overlapping-rings",
"plaid",
"plus-signs",
"sine-waves",
"squares",
"tessellation",
"triangles",
"xes",
}
All available geo patterns
Functions ¶
func Base64String ¶
Base64String returns pattern's Base64 encoded string
func BuildChevron ¶
BuildChevron returns string representing a chevron shape
func BuildDiamond ¶
BuildDiamond returns string representing a diamond shape
func BuildHexagon ¶
BuildHexagon returns string representing a hexagon shape
func BuildOctagon ¶
BuildOctagon returns string representing an octagon shape
func BuildRightTriangle ¶
BuildRightTriangle returns string representing a right angle triangle shape
func BuildRotatedTriangle ¶
BuildRotatedTriangle returns string representing a rotated triangle shape
func BuildTriangle ¶
BuildTriangle returns string representing a triangle shape
func DrawInnerMosaicTile ¶
DrawInnerMosaicTile returns string representing an inner mosaic tile shape
func DrawOuterMosaicTile ¶
DrawOuterMosaicTile returns string representing an outer mosaic tile shape
Types ¶
type Pattern ¶
type Pattern struct { BaseColor string Color string Generator string Phrase string // contains filtered or unexported fields }
Pattern struct that contains attributes like base color, background color pattern type, phrase for the pattern and SHA-1 hash of phrase
type SVG ¶
type SVG struct {
// contains filtered or unexported fields
}
SVG struct, SVG contains elementry attributes like svg string, width, height
func (*SVG) Group ¶
Group adds a group element to SVG object.
It groups optionally provided elements together.