Documentation
¶
Overview ¶
Package circle is a simple circle component with customisable size, colour, location and radius.
Index ¶
- type Component
- func (component Component) GetJSONFormat() interface{}
- func (component Component) SetNamedProperties(properties render.NamedProperties) (render.Component, error)
- func (component Component) VerifyAndSetJSONData(data interface{}) (render.Component, render.NamedProperties, error)
- func (component Component) Write(canvas render.Canvas) (render.Canvas, error)
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.
Click to show internal directories.
Click to hide internal directories.