internal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package internal handles common arguments.

Package internal handles floss colors.

Package internal has constants for parsing/producing patterns.

Package internal handles various utility functions.

Index

Constants

View Source
const (
	// TokenBlockStart represents a gxs block beginning.
	TokenBlockStart = " => {"
	// TokenDefaultBlock represents a default block value.
	TokenDefaultBlock = ""
	// TokenPaletteAssign represents assigning palette colors.
	TokenPaletteAssign = " => "
	// TokenNoColor represents a non-color area
	TokenNoColor = "NONE"
	// TokenBlockEnd represents the end of a gxs block.
	TokenBlockEnd = "}"
	// TokenComment represents a comment for gxs.
	TokenComment = "#"
	// BlockPalette represents a block containing palette information
	BlockPalette = "palette"
	// BlockPattern represents a block containing pattern layout/structure.
	BlockPattern = "pattern"
	// BlockAction represents an action with the gxs language.
	BlockAction = "action"
	// BlockMode represents setting the execution mode.
	BlockMode = "mode"
	// BlockOffset represents moving patterns by an offset
	BlockOffset = "offset"
	// IsXStitch represents cross stitch mode.
	IsXStitch = "xstitch"
	// ActionCommit represents a commit (save) action.
	ActionCommit = "commit"
	// OffsetDelimiter splits width/height in an offset
	OffsetDelimiter = "x"
	// NoneLegendToken is a token for a none indicator used internally
	NoneLegendToken = "-"
)

Variables

This section is empty.

Functions

func EncodeGeneratedHeader

func EncodeGeneratedHeader() []byte

EncodeGeneratedHeader encodes a common generated header for gxs patterns.

func EncodeOffset

func EncodeOffset(width, height int) ([]byte, error)

EncodeOffset encodes an offset value to gxs fragment.

func EncodePalette

func EncodePalette(colors ...Palette) ([]byte, error)

EncodePalette encodes a set of palette objects to gxs fragment block.

func FileOrStdin

func FileOrStdin(fileName string) ([]byte, error)

FileOrStdin will read from file (if given) else stdin.

func FileOrStdout

func FileOrStdout(fileName string, data []byte) error

FileOrStdout will write to a file (if given) else stdout.

func NewArguments

func NewArguments(set Mode, fxn func(*flag.FlagSet, Arguments) error) error

NewArguments handles common arguments.

func PrintUsage

func PrintUsage(exeName, version string)

PrintUsage will print overall usage for gxs.

Types

type Arguments

type Arguments struct {
	Out        *string
	In         *string
	Format     *string
	GridWidth  *int
	GridHeight *int
	GridSquare *int
}

Arguments are common outputs from argument parsing

type Color

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

Color represents an internal floss color.

func (Color) RGB

func (c Color) RGB() string

RGB gets the 'rgb(r,g,b)' syntax for the color.

func (Color) String

func (c Color) String() string

type ColorFactory

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

ColorFactory handles getting/matching colors.

func NewColorLookup

func NewColorLookup() ColorFactory

NewColorLookup creates a new factory for color matching.

func (ColorFactory) Count

func (f ColorFactory) Count() int

Count gets the underlying available color count

func (ColorFactory) Index

func (f ColorFactory) Index(idx int) (Color, error)

Index will get a color by index

func (ColorFactory) Match

func (f ColorFactory) Match(value string) (Color, bool)

Match tries to find a matching color.

type Mode

type Mode string

Mode represents a possible operating mode

const (
	// BitStreamMode is for bitstream runs.
	BitStreamMode Mode = "bitstream"
	// CompilerMode is for compiling.
	CompilerMode Mode = "compile"
	// TranspilerMode is for transpiling.
	TranspilerMode Mode = "transpile"
	// RandomMode is for making random grid patterns.
	RandomMode Mode = "random"
)

type Palette

type Palette struct {
	Symbol string
	Color  string
}

Palette represents a palette object for managing inputs to gxs as a potential token

Directories

Path Synopsis
Package bitstream for generating a simple bitstreamd pattern from text.
Package bitstream for generating a simple bitstreamd pattern from text.
Package compile handles compiling inputs to stitchable images
Package compile handles compiling inputs to stitchable images
Package handles floss upstream sources
Package handles floss upstream sources
Package fonts handles font definitions within gxs.
Package fonts handles font definitions within gxs.
generator
Package main generates fonts
Package main generates fonts
Package grids handles making little grid patterns in gxs
Package grids handles making little grid patterns in gxs
Package random handles cli for random output patterns
Package random handles cli for random output patterns
Package transpile handles the transpiling process
Package transpile handles the transpiling process

Jump to

Keyboard shortcuts

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