layout

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 24, 2025 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOutOfBounds = errors.New("out of bounds")
)

Functions

This section is empty.

Types

type Cell

type Cell Rectangle

type CellIndex added in v0.0.2

type CellIndex struct {
	Row int
	Col int
}

type Grid

type Grid struct {
	GridType
	// contains filtered or unexported fields
}

func NewGrid

func NewGrid(x, y float64, cellWidths, cellHeights []float64) Grid

func (Grid) Bounds added in v0.0.3

func (g Grid) Bounds() Rectangle

func (Grid) Cell

func (g Grid) Cell(row, col int) (Rectangle, error)

func (Grid) CellRenderFunc

func (g Grid) CellRenderFunc(row, col int) (RendererFunc, error)

func (Grid) ColAsSubgrid

func (g Grid) ColAsSubgrid(col int) (Grid, error)

func (Grid) ForEachCellRenderFunc

func (g Grid) ForEachCellRenderFunc(f func(pos CellIndex, renderFunc RendererFunc) bool)

func (Grid) IsInBounds

func (g Grid) IsInBounds(row, col int) bool

func (Grid) JointCellRenderFunc

func (g Grid) JointCellRenderFunc(row1, col1, row2, col2 int) (RendererFunc, error)

func (Grid) RowAsSubgrid

func (g Grid) RowAsSubgrid(row int) (Grid, error)

func (Grid) Subgrid

func (g Grid) Subgrid(i1, j1, i2, j2 int) (Grid, error)

type GridType

type GridType struct {
	Rows, Cols int
}

type Point added in v0.0.3

type Point struct {
	X, Y float64
}

type Rectangle added in v0.0.3

type Rectangle struct {
	Min, Max Point
}

func Rect added in v0.0.3

func Rect(x1, y1, x2, y2 float64) Rectangle

Rect returns a rectangle with the given coordinates. The coordinates do not need to be ordered. as same as in the standard library, image.Rect

func (Rectangle) Cx added in v0.0.3

func (r Rectangle) Cx() float64

func (Rectangle) Cy added in v0.0.3

func (r Rectangle) Cy() float64

func (Rectangle) Dx added in v0.0.3

func (r Rectangle) Dx() float64

func (Rectangle) Dy added in v0.0.3

func (r Rectangle) Dy() float64

type Renderer

type Renderer func(dc *gg.Context, x, y, w, h float64) error

type RendererFunc

type RendererFunc func(dc *gg.Context, rendering Renderer) error

Jump to

Keyboard shortcuts

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