~dricottone/image2ascii

ref: 32c6345ebc23b02d145076b1ac7ec2f1e4c2fc3a image2ascii/ascii/option.go -rw-r--r-- 671 bytes
32c6345e — qeesung add reverse options 6 years ago
                                                                                
5f88c33e qeesung
49547468 qeesung
5f88c33e qeesung
32c6345e qeesung
5f88c33e qeesung
49547468 qeesung
5f88c33e qeesung
32c6345e qeesung
5f88c33e qeesung
49547468 qeesung
5f88c33e qeesung
30e65641 qeesung
5f88c33e qeesung
49547468 qeesung
5f88c33e qeesung
c5de7795 qeesung
32c6345e qeesung
c5de7795 qeesung
5f88c33e qeesung
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
package ascii

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

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

// NewOptions create a new convert option
func NewOptions() Options {
	newOptions := Options{}
	newOptions.mergeOptions(&DefaultOptions)
	return newOptions
}

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