~dricottone/image2ascii

ref: c55f95a58b44ad12936de4c041f82a5ed589568d image2ascii/ascii/option.go -rw-r--r-- 600 bytes
c55f95a5 — 秦世成 Update README.md 6 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package ascii

// Options convert pixel to raw char
type Options struct {
	Pixels  []byte
	Reverse bool
	Colored bool
}

// DefaultOptions that contains the default pixels
var DefaultOptions = Options{
	Pixels:  []byte(" .,:;i1tfLCG08@"),
	Reverse: false,
	Colored: true,
}

// NewOptions create a new convert option
func NewOptions() Options {
	return DefaultOptions
}

// mergeOptions merge two options
func (options *Options) mergeOptions(newOptions *Options) {
	options.Pixels = append([]byte{}, newOptions.Pixels...)
	options.Reverse = newOptions.Reverse
	options.Colored = newOptions.Colored
}