penconfig

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package penconfig allows custom specification of pen strokes from a yaml format file on a per-layer basis, for example

all:
  - pen:     fineliner
    weight:  narrow
    width:   0.95
    color:   black
    opacity: 0.9

"1":
  - pen:     fineliner
    weight:  narrow
    width:   0.8
    color:   blue
    opacity: 0.8

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LayerPenConfigs

type LayerPenConfigs map[string][]PenConfig

LayerPenConfigs defines StrokeSettings by layer

func LoadYaml

func LoadYaml(yamlByte []byte) (LayerPenConfigs, error)

LoadYaml reads bytes into a PenConfig structure

func NewPenConfigFromFile

func NewPenConfigFromFile(filePath string) (lpc LayerPenConfigs, err error)

NewPenConfigFromFile loads a pen configuration yaml file

func (LayerPenConfigs) GetPen

func (lpc LayerPenConfigs) GetPen(layerNo int, penName, penWidth string) (*PenConfig, bool)

GetPen returns the custom pen setting for a 0-indexed layer, penName and penWidth (see penWeights)

type LocalPenColour

type LocalPenColour struct {
	Name   string
	Colour color.RGBA
}

LocalPenColour describes a color by name and RGBA value

type PenConfig

type PenConfig struct {
	Pen     string         `yaml:"pen"`
	Weight  string         `yaml:"weight"`
	Width   float64        `yaml:"width"`
	Colour  LocalPenColour `yaml:"color"`
	Opacity float64        `yaml:"opacity"`
}

PenConfig allows the configuration of a s

func (*PenConfig) GetColour

func (pc *PenConfig) GetColour() color.RGBA

GetColour returns the penconfig color.RGBA colour

func (*PenConfig) GetWidth

func (pc *PenConfig) GetWidth(w string) float64

GetWidth returns the stroke width for the stated pen as a proportion of the current pen width

func (*PenConfig) UnmarshalYAML

func (pc *PenConfig) UnmarshalYAML(value *yaml.Node) (err error)

UnmarshalYAML is a custom unmarshaller

Jump to

Keyboard shortcuts

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