align

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: Apache-2.0 Imports: 4 Imported by: 44

Documentation

Overview

Package align defines constants representing types of alignment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Rectangle

func Rectangle(rect image.Rectangle, ar image.Rectangle, h Horizontal, v Vertical) (image.Rectangle, error)

Rectangle aligns the area within the rectangle returning the aligned area. The area must fall within the rectangle.

func Text

func Text(rect image.Rectangle, text string, h Horizontal, v Vertical) (image.Point, error)

Text aligns the text within the given rectangle, returns the start point for the text. For the purposes of the alignment this assumes that text will be trimmed if it overruns the rectangle. This only supports a single line of text, the text must not contain newlines.

Types

type Horizontal

type Horizontal int

Horizontal indicates the type of horizontal alignment.

const (
	// HorizontalLeft is left alignment along the horizontal axis.
	HorizontalLeft Horizontal = iota
	// HorizontalCenter is center alignment along the horizontal axis.
	HorizontalCenter
	// HorizontalRight is right alignment along the horizontal axis.
	HorizontalRight
)

func (Horizontal) String

func (h Horizontal) String() string

String implements fmt.Stringer()

type Vertical

type Vertical int

Vertical indicates the type of vertical alignment.

const (
	// VerticalTop is top alignment along the vertical axis.
	VerticalTop Vertical = iota
	// VerticalMiddle is middle alignment along the vertical axis.
	VerticalMiddle
	// VerticalBottom is bottom alignment along the vertical axis.
	VerticalBottom
)

func (Vertical) String

func (v Vertical) String() string

String implements fmt.Stringer()

Jump to

Keyboard shortcuts

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