rules

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rule

type Rule interface {
	Size() int
	Matches(color.Color) bool
	Colorize(x, y int) color.Color
	String() string
}

Rule defines a generic interface for rules

type RuleFromPNGFile

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

RuleFromPNGFile reads rules from SVG files

func NewRuleFromPNGFile

func NewRuleFromPNGFile(path string) (*RuleFromPNGFile, error)

NewRuleFromPNGFile creates a new Rule

func (*RuleFromPNGFile) Colorize

func (r *RuleFromPNGFile) Colorize(x, y int) color.Color

Colorize returns the replacement color at a given position where x and y are between 0 and Size() inclusively

func (*RuleFromPNGFile) Matches

func (r *RuleFromPNGFile) Matches(c color.Color) bool

Matches returns whether this rule is responsible for the given color (Chain-of-responsibility pattern)

func (*RuleFromPNGFile) Size

func (r *RuleFromPNGFile) Size() int

Size returns the width (= height) of the replaced colors

func (*RuleFromPNGFile) String

func (r *RuleFromPNGFile) String() string

String gives a human-readable representation of this Rule

Jump to

Keyboard shortcuts

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