render

package
v0.0.0-...-d7093dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package render convert the char pixel matrix that converted from the image2ascii to a png image that draw all ascii chars to the image

Index

Constants

This section is empty.

Variables

View Source
var DefaultDrawOptions = DrawOptions{
	TTF:      gomono.TTF,
	FontSize: 20,
	Colored:  true,
	BackGroundColor: color.RGBA{
		R: 0,
		G: 0,
		B: 0,
		A: 255,
	},
	ForeGroundColor: color.RGBA{
		R: 255,
		G: 255,
		B: 255,
		A: 255,
	},
}

DefaultDrawOptions is default draw options

Functions

This section is empty.

Types

type DrawOptions

type DrawOptions struct {
	TTF             []byte  // draw font
	FontSize        float64 // font size
	Colored         bool
	BackGroundColor color.RGBA
	ForeGroundColor color.RGBA
}

DrawOptions control how to draw the pixel to the image

type Drawer

type Drawer interface {
	DrawCharPixelMatrix2Image(charPixelMatrix [][]ascii.CharPixel, options DrawOptions) (img image.Image, err error)
	BatchConvertThenDraw(frames []image.Image, convertOptions convert.Options, drawOptions DrawOptions, progress chan<- int) (asciiImages []image.Image, err error)
}

Drawer interface define the operation that draw char pixel to image

func NewImageDrawer

func NewImageDrawer() Drawer

NewImageDrawer create a new image drawer

type ImageDrawer

type ImageDrawer struct {
}

ImageDrawer implement the drawer interface

func (*ImageDrawer) BatchConvertThenDraw

func (drawer *ImageDrawer) BatchConvertThenDraw(frames []image.Image,
	convertOptions convert.Options, drawOptions DrawOptions, progress chan<- int) (asciiImages []image.Image, err error)

BatchConvertThenDraw batch draw the images and output the images

func (*ImageDrawer) DrawCharPixelMatrix2Image

func (drawer *ImageDrawer) DrawCharPixelMatrix2Image(charPixelMatrix [][]ascii.CharPixel, options DrawOptions) (img image.Image, err error)

DrawCharPixelMatrix2Image draw a char pixel matrix to a image

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL