Documentation ¶
Overview ¶
Package ascii can convert a image pixel to a raw char base on it's RGBA value, in another word, input a image pixel output a raw char ascii.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = Options{ Pixels: []byte(" .,:;i1tfLCG08@"), Reversed: false, Colored: true, }
DefaultOptions that contains the default pixels
Functions ¶
This section is empty.
Types ¶
type PixelASCIIConverter ¶ added in v1.0.1
type PixelASCIIConverter struct { }
PixelASCIIConverter responsible for pixel ascii conversion
func (PixelASCIIConverter) ConvertPixelToASCII ¶ added in v1.0.1
func (converter PixelASCIIConverter) ConvertPixelToASCII(pixel color.Color, options *Options) string
ConvertPixelToASCII converts a pixel to a ASCII char string
Example ¶
ExampleConvertPixelToASCII is a example convert pixel to ascii char
converter := NewPixelConverter() // 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 := converter.ConvertPixelToASCII(pixel, &defaultOptions) fmt.Println(convertedChar)
Output: @
func (PixelASCIIConverter) ConvertPixelToPixelASCII ¶ added in v1.0.1
func (converter PixelASCIIConverter) ConvertPixelToPixelASCII(pixel color.Color, options *Options) CharPixel
ConvertPixelToPixelASCII convert a image pixel to CharPixel
type PixelConverter ¶ added in v1.0.1
type PixelConverter interface { ConvertPixelToASCII(pixel color.Color, options *Options) string ConvertPixelToPixelASCII(pixel color.Color, options *Options) CharPixel }
PixelConverter define the convert pixel operation
func NewPixelConverter ¶ added in v1.0.1
func NewPixelConverter() PixelConverter
NewPixelConverter create a new pixel converter
Click to show internal directories.
Click to hide internal directories.