~dricottone/image2ascii

95a015a66fa373bb4e400628c75f5a60a05b947e — qeesung 6 years ago ccd4a74
add Example
1 files changed, 20 insertions(+), 0 deletions(-)

M ascii/ascii_test.go
M ascii/ascii_test.go => ascii/ascii_test.go +20 -0
@@ 109,3 109,23 @@ func TestReverseSlice(t *testing.T) {
	assert.True(t, reflect.DeepEqual(reversedSlice, expectedReversedSlice),
		fmt.Sprintf("%+v reversed should equal to %+v", s, expectedReversedSlice))
}


// ExampleConvertPixelToASCII is a example convert pixel to ascii char
func ExampleConvertPixelToASCII() {
	// Create the pixel
	r, g, b, a := uint8(255), uint8(255), uint8(255), uint8(255)
	pixel := color.RGBA{
		R: r,
		G: g,
		B: b,
		A: a,
	}

	// Create the convert options
	defaultOptions := NewOptions()
	defaultOptions.Colored = false
	convertedChar := ConvertPixelToASCII(pixel, &defaultOptions)
	fmt.Println(convertedChar)
	// Output: @
}
\ No newline at end of file