Documentation
¶
Overview ¶
Package barcode is a component for rendering barcodes with customisable content and colour for both background and data channels.
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{"websiteURL": []string{"content"}} would indicate that
the user specified variable "websiteURL" will fill the Content property.
*/
NamedPropertiesMap map[string][]string
// Content is the data which will be encoded as a barcode.
Content string
// Type is the sort of barcode to encode, such as QR, PDF, or two of five.
Type render.BarcodeType
/*
TopLeft is the coordinates of the top-left corner of the rendered barcode (including
background) relative to the top-left corner of the canvas.
*/
TopLeft image.Point
// Width is the width of the barcode (including background).
Width int
// Height is the height of the barcode (including background).
Height int
// DataColour is the colour which will fill the data channel.
DataColour color.NRGBA
// BackgroundColour is the colour which will fill the background channel.
BackgroundColour color.NRGBA
// Extra is additional information required by certain barcode types.
Extra render.BarcodeExtraData
}
Component implements the Component interface for images.
func (Component) GetJSONFormat ¶
func (component Component) GetJSONFormat() interface{}
GetJSONFormat returns the JSON structure of a barcode component.
func (Component) SetNamedProperties ¶
func (component Component) SetNamedProperties(properties render.NamedProperties) (render.Component, error)
SetNamedProperties processes the named properties and sets them into the barcode 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 barcode properties and fill the named properties map.
Click to show internal directories.
Click to hide internal directories.