~dricottone/image2ascii

ref: 5f88c33e0a1e0f72ef640e0937def1d46076ceff image2ascii/ascii/option.go -rw-r--r-- 632 bytes
5f88c33e — qeesung add ascii package to convert a image pixel to ascii 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
28
29
30
31
32
33
package ascii

// Convert options
type Options struct {
	pixels  []byte
	reverse bool
	colored bool
	bg      bool
	fg      bool
}

// Default options
var DefaultOptions = Options{
	pixels:  []byte(" .,:;i1tfLCG08@"),
	reverse: false,
	colored: true,
	bg:      false,
	fg:      true,
}

// Create a new options
func NewOptions() Options {
	return DefaultOptions
}

// Merge options
func (options *Options) mergeOptions(newOptions *Options) {
	options.pixels = append([]byte{}, newOptions.pixels...)
	options.reverse = newOptions.reverse
	options.colored = newOptions.colored
	options.bg = newOptions.bg
	options.fg = newOptions.fg
}