jumble

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2020 License: MIT Imports: 16 Imported by: 0

README

   _           _   _
  |_|_ _ _____| |_| |___     
  | | | |     | . | | -_|   
 _| |___|_|_|_|___|_|___|            
|___|

https://github.com/lucasepe/jumble

Create (not just) diagrams stitching, connecting and labelling images on a grid using HCL syntax (like terraform!).

515 Embedded cloud architecture icons! Ready to use!

  • 225 AWS icons (uri = assets://aws_[KIND])
  • 182 Azure icons (uri = assets://azure_[KIND])
  • 108 Google Cloud icons (uri = assets://google_[KIND])
# AWS Lambda Authorizer
tile "icon" "lambda1" {
    row = "${subtract(row("agw"), 1)}"
    col = "${subtract(col("agw"), 2)}"
    uri = "assets://aws_lambda"
}

👉 here an HCL example

./jumble -o sample.png ./screenshots/sample.hcl

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectorArrowDown

func ConnectorArrowDown() func(c *Connector)

ConnectorArrowDown enable the arrow down on the connector

func ConnectorArrowLeft

func ConnectorArrowLeft() func(c *Connector)

ConnectorArrowLeft enable the arrow left on the connector

func ConnectorArrowRight

func ConnectorArrowRight() func(c *Connector)

ConnectorArrowRight enable the arrow right on the connector

func ConnectorArrowUp

func ConnectorArrowUp() func(c *Connector)

ConnectorArrowUp enable the arrow up on the connector

func ConnectorColor

func ConnectorColor(hex string) func(c *Connector)

ConnectorColor sets the connector strokes color

func FrameColor

func FrameColor(hex string) func(f *Frame)

FrameColor sets the frame color

func FrameDashes

func FrameDashes(val float64) func(f *Frame)

FrameDashes sets the frame dashes

func FrameOval

func FrameOval(val bool) func(f *Frame)

FrameOval sets the frame shape to oval (default is rectangle)

func FrameStroke

func FrameStroke(val bool) func(f *Frame)

FrameStroke enables the frame stroke

func FrameStrokeWidth

func FrameStrokeWidth(val float64) func(f *Frame)

FrameStrokeWidth sets the stroke width

func GridBackground

func GridBackground(hex string) func(*Grid)

GridBackground sets the grid background color

func GridMargin

func GridMargin(val int) func(*Grid)

GridMargin sets the grid margin in pixels.

func LabelAngle

func LabelAngle(val float64) func(*Label)

LabelAngle sets the label rotation angle in degree

func LabelBackground

func LabelBackground(hex string) func(*Label)

LabelBackground sets the label background color

func LabelColor

func LabelColor(hex string) func(*Label)

LabelColor sets the label font color

func LabelFontSize

func LabelFontSize(val float64) func(*Label)

LabelFontSize sets the label font size

func LoadFromAssets

func LoadFromAssets(uri string) (image.Image, error)

LoadFromAssets load an image from the embedded filesystem.

func LoadImage

func LoadImage(uri string) (image.Image, error)

LoadImage load a image from the specified URI. If the URI starts with http, attempt to fetch the remote image with a GET verb. Max image size is 200 Kb.

Types

type Connector

type Connector struct {
	Row int
	Col int
	// contains filtered or unexported fields
}

Connector connect two or more tiles.

func CrossConnector

func CrossConnector(row, col int, opts ...func(*Connector)) Connector

CrossConnector returns a tee connector (← ↑ ↓ →)

func ElbowLeftDownConnector

func ElbowLeftDownConnector(row, col int, opts ...func(*Connector)) Connector

ElbowLeftDownConnector returns left (←) down (↓) elbow connector

func ElbowLeftUpConnector

func ElbowLeftUpConnector(row, col int, opts ...func(*Connector)) Connector

ElbowLeftUpConnector returns left (←) up (↑) elbow connector

func ElbowRightDownConnector

func ElbowRightDownConnector(row, col int, opts ...func(*Connector)) Connector

ElbowRightDownConnector returns a right (→) down (↓) elbow connector

func ElbowRightUpConnector

func ElbowRightUpConnector(row, col int, opts ...func(*Connector)) Connector

ElbowRightUpConnector returns a right (→) up (↑) elbow connector

func HorizontalConnector

func HorizontalConnector(row, col int, opts ...func(*Connector)) Connector

HorizontalConnector returns a hotizontal connector

func TeeDownConnector

func TeeDownConnector(row, col int, opts ...func(*Connector)) Connector

TeeDownConnector returns a tee connector (← ↓ →)

func TeeLeftConnector

func TeeLeftConnector(row, col int, opts ...func(*Connector)) Connector

TeeLeftConnector returns a tee connector (← ↑ ↓)

func TeeRightConnector

func TeeRightConnector(row, col int, opts ...func(*Connector)) Connector

TeeRightConnector returns a tee connector (↑ ↓ →)

func TeeUpConnector

func TeeUpConnector(row, col int, opts ...func(*Connector)) Connector

TeeUpConnector returns a tee connector (← ↑ →)

func VerticalConnector

func VerticalConnector(row, col int, opts ...func(*Connector)) Connector

VerticalConnector returns a vertical connector

func (*Connector) Location

func (c *Connector) Location() (int, int)

Location returns the grid position (row, col)

func (*Connector) Plot

func (c *Connector) Plot(g *Grid) error

Plot draws a connector on the grid.

type Frame

type Frame struct {
	Left   int
	Top    int
	Right  int
	Bottom int
	// contains filtered or unexported fields
}

Frame represents a frame on the grid.

func NewFrame

func NewFrame(l, t int, r, b int, opts ...func(*Frame)) Frame

NewFrame returns a new frame

func (*Frame) Location

func (fr *Frame) Location() (int, int)

Location returns the grid position (row, col)

func (*Frame) Plot

func (fr *Frame) Plot(g *Grid) error

Plot draws a frame accross the specified cells

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) EncodePNG

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

EncodePNG encodes the final image as PNG

func (*Grid) FillCell

func (g *Grid) FillCell(row int, col int, color string) error

FillCell paints Cell

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

type Icon

type Icon struct {
	Row int
	Col int
	Fit bool
	URI string
}

Icon wraps an image.

func NewIcon

func NewIcon(row, col int, uri string) Icon

NewIcon returns a new icon from the specified uri

func (*Icon) Location

func (ic *Icon) Location() (int, int)

Location returns the grid position (row, col)

func (*Icon) Plot

func (ic *Icon) Plot(g *Grid) error

Plot draws a image (eventually rescaling) in a cell.

type Label

type Label struct {
	Row int
	Col int
	// contains filtered or unexported fields
}

Label wraps a string.

func NewLabel

func NewLabel(row, col int, text string, opts ...func(*Label)) Label

NewLabel returns a new label

func (*Label) Location

func (lab *Label) Location() (int, int)

Location returns the grid position (row, col)

func (*Label) Plot

func (lab *Label) Plot(g *Grid) error

Plot draws a string in a cell

type Tile

type Tile interface {
	Location() (int, int)
	Plot(g *Grid) error
}

Tile is anything on the grid

Directories

Path Synopsis
cmd
Package shortid enables the generation of short, unique, non-sequential and by default URL friendly Ids.
Package shortid enables the generation of short, unique, non-sequential and by default URL friendly Ids.

Jump to

Keyboard shortcuts

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