svg

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XMLNS       = "http://www.w3.org/2000/svg"
	XMLNS_XLINK = "http://www.w3.org/1999/xlink"
	BOXSIZE     = 32

	LETTER_X_OFFSET    = 8
	LETTER_Y_OFFSET    = 28
	LETTER_FONT_FAMILY = "monospace"
	LETTER_FONT_SIZE   = "18pt"

	NUMBER_X_OFFSET  = 2
	NUMBER_Y_OFFSET  = 10
	NUMBER_FONT_SIZE = "8pt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SVG

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

func NewSVG

func NewSVG(cells [][]byte) *SVG

NewSVG will create a new SVG object from an abstract matrix of bytes. This for convenience of unit testing, since it does not need any reference to the model.

func NewSVGFromPuzzle added in v0.7.4

func NewSVGFromPuzzle(puzzle *model.Puzzle) *SVG

NewSVGFromPuzzle will create a new SVG object from a grid, delegating that to NewSVG after creating the simple cell matrix it needs.

func (*SVG) BoundingRectangle

func (svg *SVG) BoundingRectangle() string

BoundingRectangle creates an element that draws a box around the whole grid.

func (*SVG) Cells

func (svg *SVG) Cells() string

Cells generates the cells of the grid, including black cells and any letter values.

func (*SVG) EndRoot

func (svg *SVG) EndRoot() string

EndRoot creates the closing </svg> element.

func (*SVG) GenerateSVG

func (svg *SVG) GenerateSVG() string

GenerateSVG creates a SVG image of the grid.

func (*SVG) HorizontalLines

func (svg *SVG) HorizontalLines() string

HorizontalLines generates the horizontal lines of the grid

func (*SVG) Root

func (svg *SVG) Root() string

Root creates the root <svg> element.

func (*SVG) VerticalLines

func (svg *SVG) VerticalLines() string

VerticalLines generates the vertical lines of the grid.

func (*SVG) WordNumbers

func (svg *SVG) WordNumbers() string

WordNumbers generates the word numbers of the grid.

Jump to

Keyboard shortcuts

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