circle

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package circle is a simple circle component with customisable size, colour, location and radius.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	/*
		NamedPropertiesMap maps user/application variables to properties of the component.
		This field is filled automatically by VerifyAndSetJSONData, then used in
		SetNamedProperties to determine whether a variable being passed in is relevant to this
		component.

		For example, map[string][]string{"circleSize": []string{"radius"}} would indicate that
		the user specified variable "circleSize" will fill the Radius property.
	*/
	NamedPropertiesMap map[string][]string
	/*
		Centre is the coordinates of the centre of the circle relative to the top-left corner
		of the canvas.
	*/
	Centre image.Point
	// Radius is the radius of the circle.
	Radius int
	// Colour is the colour of the circle.
	Colour color.NRGBA
}

Component implements the Component interface for circles.

func (Component) GetJSONFormat

func (component Component) GetJSONFormat() interface{}

GetJSONFormat returns the JSON structure of a circle component.

func (Component) SetNamedProperties

func (component Component) SetNamedProperties(properties render.NamedProperties) (render.Component, error)

SetNamedProperties processes the named properties and sets them into the circle properties.

func (Component) VerifyAndSetJSONData

func (component Component) VerifyAndSetJSONData(data interface{}) (render.Component, render.NamedProperties, error)

VerifyAndSetJSONData processes the data parsed from JSON and uses it to set circle properties and fill the named properties map.

func (Component) Write

func (component Component) Write(canvas render.Canvas) (render.Canvas, error)

Write draws a circle on the canvas.

Jump to

Keyboard shortcuts

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