~mendelmaleh/dummy

3b6a8213b77745eef0ae7514fcaaf35ffad15892 — Mendel E 1 year, 5 months ago 494d45f
Rename opt.Pattern -> opt.Mask
3 files changed, 9 insertions(+), 9 deletions(-)

M api.md
M image.go
M options.go
M api.md => api.md +2 -2
@@ 39,10 39,10 @@ Set the width and height of the image. If only `width` is passed, `height` will
be set to its value.

```
pattern	string	"plain"
mask	string	"plain"
```

Set the pattern for the image drawing. The different patterns are:
Set the mask for the image drawing. The different masks are:

- `plain`: just a plain, one color, background.
- `diagonal`: split diagonally, two colors.

M image.go => image.go +1 -1
@@ 18,7 18,7 @@ func Image(opt Options) image.Image {
	im := img{image.NewRGBA(image.Rectangle{image.Point{}, image.Point{opt.Width, opt.Height}})}

	// image
	switch opt.Pattern {
	switch opt.Mask {
	case "plain":
		draw.Draw(im, im.Bounds(), image.NewUniform(opt.Colors[0]), image.Point{}, draw.Src)
	case "diagonal":

M options.go => options.go +6 -6
@@ 11,7 11,7 @@ import (
type Options struct {
	// image
	Width, Height int
	Pattern       string
	Mask          string
	Colors        []color.RGBA

	// text


@@ 26,9 26,9 @@ type Options struct {
// to be used only with dopt.Copy(), otherwise the default colors can be changed.
var dopt = &Options{
	// image
	Width:   200,
	Height:  200,
	Pattern: "plain",
	Width:  200,
	Height: 200,
	Mask:   "plain",
	Colors: []color.RGBA{
		color.RGBA{0, 0, 0, 0xff},
		color.RGBA{0xff, 0xff, 0xff, 0xff},


@@ 64,8 64,8 @@ func (opt *Options) FromForm(form url.Values) error {
		opt.Height = i
	}

	if p, ok := form["pattern"]; ok {
		opt.Pattern = p[0]
	if p, ok := form["mask"]; ok {
		opt.Mask = p[0]
	}

	if colors, ok := form["color"]; ok {