segment

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package segment provides functions that draw a single segment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diagonal

func Diagonal(bc *braille.Canvas, ar image.Rectangle, width int, dt DiagonalType, opts ...DiagonalOption) error

Diagonal draws a diagonal segment of the specified width filling the area.

func HV

func HV(bc *braille.Canvas, ar image.Rectangle, st Type, opts ...Option) error

HV draws a horizontal or a vertical display segment, filling the provided area. The segment will have slopes on both of its ends.

Types

type DiagonalOption

type DiagonalOption interface {
	// contains filtered or unexported methods
}

DiagonalOption is used to provide options.

func DiagonalCellOpts

func DiagonalCellOpts(cOpts ...cell.Option) DiagonalOption

DiagonalCellOpts sets options on the cells that contain the diagonal segment. Cell options on a braille canvas can only be set on the entire cell, not per pixel.

type DiagonalType

type DiagonalType int

DiagonalType determines the type of diagonal segment.

const (

	// LeftToRight is a diagonal segment from top left to bottom right.
	LeftToRight DiagonalType
	// RightToLeft is a diagonal segment from top right to bottom left.
	RightToLeft
)

func (DiagonalType) String

func (dt DiagonalType) String() string

String implements fmt.Stringer()

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is used to provide options.

func CellOpts

func CellOpts(cOpts ...cell.Option) Option

CellOpts sets options on the cells that contain the segment. Cell options on a braille canvas can only be set on the entire cell, not per pixel.

func ReverseSlopes

func ReverseSlopes() Option

ReverseSlopes if provided reverses the order in which slopes are drawn. This only has a visible effect when the horizontal segment has height of two or the vertical segment has width of two. Without this option segments with height / width of two look like this:

  • | --- || |

With this option:

---  |
 -   ||
     |

func SkipSlopesLTE

func SkipSlopesLTE(v int) Option

SkipSlopesLTE if provided instructs HV to not create slopes at the ends of a segment if the height of the horizontal or the width of the vertical segment is less or equal to the provided value.

type Type

type Type int

Type identifies the type of the segment that is drawn.

const (

	// Horizontal is a horizontal segment.
	Horizontal Type
	// Vertical is a vertical segment.
	Vertical
)

func (Type) String

func (st Type) String() string

String implements fmt.Stringer()

Directories

Path Synopsis
Package testsegment provides helpers for tests that use the segment package.
Package testsegment provides helpers for tests that use the segment package.

Jump to

Keyboard shortcuts

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