dummy

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: BSD-3-Clause Imports: 9 Imported by: 0

README

dummy

A simple placeholder image generator. Supports specifying width, height, and colors. Soon text, fonts, font size, and patterns.

install

To install the web service:

go get git.sr.ht/~mendelmaleh/dummy/cmd/dummyserver

config

The config uses the TOML format. You should define the address:port it runs on, and its pattern root endpoint.

Additionally, a directory with fonts is required, with minimum one font, set as the default. Ensure the fonts value has a trailing slash.

[dummy]
addr = "localhost:port"
pattern = "/"
fonts = "fonts/"
font = "Open Sans"

usage

The API is documented here.

examples

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = &Options{

	Width:  200,
	Height: 200,
	Mask:   "plain",
	Colors: []color.RGBA{
		color.RGBA{0, 0, 0, 0xff},
		color.RGBA{0xff, 0xff, 0xff, 0xff},
	},

	Size: 80,
	DPI:  72,

	Desc: "Dummy image generator",
}

to be used only with dopt.Copy(), otherwise the default colors can be changed.

Functions

func Hex

func Hex(s string) (c color.RGBA, err error)

Hex to color.RGBA conversion. Accepts an optional '#', then one of the following formats: RGB RGBA RRGGBB RRGGBBAA

func Image

func Image(opt Options) image.Image

Types

type Options

type Options struct {
	// image
	Width, Height int
	Mask          string
	Colors        []color.RGBA

	// text
	Text      string
	Font      *truetype.Font
	Size, DPI float64

	// web
	Desc string
}

func (Options) Copy

func (opt Options) Copy() (copt Options)

Copy so that the original options don't change (essentially a deep copy).

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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