grid

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Background

func Background(hex string) func(*Grid)

Background sets the grid background color

func Margin

func Margin(val int) func(*Grid)

Margin sets the grid margin in pixels.

func Watermark

func Watermark(text string) func(*Grid)

Watermark sets the grid watermark.

Types

type Grid

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

Grid represents the grid structure

func NewGrid

func NewGrid(rows, cols int, cellSize int, opts ...func(*Grid)) (*Grid, error)

NewGrid creates a new grid and sets it up with its configuration

func (*Grid) CellCenter

func (g *Grid) CellCenter(row, col int) gg.Point

CellCenter retuns the cell coordinates in the grid

func (*Grid) CellSize

func (g *Grid) CellSize() float64

CellSize returns the cell dimension

func (*Grid) Context

func (g *Grid) Context() *gg.Context

Context returns the grid drawing context

func (*Grid) DrawBorder

func (g *Grid) DrawBorder()

DrawBorder draws a border around the grid.

func (*Grid) DrawCoords

func (g *Grid) DrawCoords()

DrawCoords draws all cells locations

func (*Grid) DrawGrid

func (g *Grid) DrawGrid()

DrawGrid draws the grid.

func (*Grid) DrawImage

func (g *Grid) DrawImage(img image.Image, row, col int) error

DrawImage draws the image at row and col. If the image size is greater then the gtid cell size it will be shrinked.

func (*Grid) DrawWatermark

func (g *Grid) DrawWatermark()

DrawWatermark draws the watermark.

func (*Grid) EncodePNG

func (g *Grid) EncodePNG(w io.Writer) error

EncodePNG encodes the final image as PNG

func (*Grid) SavePNG

func (g *Grid) SavePNG(filename string) error

SavePNG saves the grid as PNG image.

func (*Grid) VerifyInBounds

func (g *Grid) VerifyInBounds(row, col int) error

VerifyInBounds verify that the coordinates belongs to the grid

Jump to

Keyboard shortcuts

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