Documentation ¶
Overview ¶
Package dotseg simulates a segment display that can draw dots.
Given a canvas, determines the placement and size of the individual segments and exposes API that can turn individual segments on and off or display dot characters.
The following outlines segments in the display and their names.
--------------- | | | | | | | o D1 | | | | | | | | o D2 | | | | | | o D3 | ---------------
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SupportedChars ¶
func SupportedChars() string
SupportedChars returns all characters this display supports.
Types ¶
type Display ¶
type Display struct {
// contains filtered or unexported fields
}
Display represents the segment display. This object is not thread-safe.
func (*Display) ClearSegment ¶
ClearSegment sets the specified segment off. This method is idempotent.
func (*Display) Draw ¶
Draw draws the current state of the segment display onto the canvas. The canvas must be at least MinCols x MinRows cells, or an error will be returned. Any options provided to draw overwrite the values provided to New.
func (*Display) SetCharacter ¶
SetCharacter sets all the segments that are needed to display the provided character. The display only supports characters returned by SupportedsChars(). Doesn't clear the display of segments set previously.
func (*Display) SetSegment ¶
SetSegment sets the specified segment on. This method is idempotent.
func (*Display) ToggleSegment ¶
ToggleSegment toggles the state of the specified segment, i.e it either sets or clears it depending on its current state.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is used to provide options.
type Segment ¶
type Segment int
Segment represents a single segment in the display.
const ( // D1 is a segment, see the diagram above. D1 Segment // D2 is a segment, see the diagram above. D2 // D3 is a segment, see the diagram above. D3 )
func AllSegments ¶
func AllSegments() []Segment
AllSegments returns all segments in an undefined order.
Directories ¶
Path | Synopsis |
---|---|
Package testdotseg provides helpers for tests that use the dotseg package.
|
Package testdotseg provides helpers for tests that use the dotseg package. |