ascii

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asc11Converter

type Asc11Converter interface {
	// convert gray img to ascii
	Convert()

	CharMap() [][]string
}

func NewAsc11Converter added in v1.0.2

func NewAsc11Converter(grey *image.Gray, yukkuriVer bool) Asc11Converter

yukkuriVer : true -> 更倾向油库里风格,输出矩阵更小,但更容易失真

type Ascii

type Ascii struct {
	X        int
	Y        int
	GreyImg  *image.Gray
	AsciiMap [][]string

	Ch0369 string

	Ch903 string
	Ch036 string
	Ch369 string
	Ch690 string

	Ch93 string
	Ch06 string
	Ch03 string
	Ch36 string
	Ch69 string
	Ch90 string
}

转出来的ascii字符画较普通,基本上是一个像素点对应一个字符。 因此完整还原一幅图像需要较大的空间

func NewAscii

func NewAscii(grey *image.Gray) *Ascii

func (*Ascii) CharMap

func (asc *Ascii) CharMap() [][]string

func (*Ascii) Convert

func (asc *Ascii) Convert()

type AsciiYukkuri added in v1.0.2

type AsciiYukkuri struct {
	*Ascii
}

还原风格应当更趋近于油库里风,输入的图像大小应当小于50*50. 输出更可能会变得不可辨认. 将会使用与Ascii不同的字符集.

func NewAsciiYukkuri added in v1.0.2

func NewAsciiYukkuri(grey *image.Gray) *AsciiYukkuri

type GreyColor

type GreyColor string
const (
	CRed     GreyColor = "red"
	CGreen   GreyColor = "green"
	CBlue    GreyColor = "blue"
	CYellow  GreyColor = "yellow"
	CCyan    GreyColor = "cyan"
	CMagenta GreyColor = "magenta"
)

type GreyFunction

type GreyFunction interface {
	GreyFunc(x int, y int, img image.Image, threshold int) (int, int, color.Gray)
}

type GreyHandler

type GreyHandler struct {
	// contains filtered or unexported fields
}

func NewGreyHandler

func NewGreyHandler() GreyHandler

func (GreyHandler) GreyFunc

func (gh GreyHandler) GreyFunc(x int, y int, img image.Image, threshold int) (int, int, color.Gray)

function:gray= (max - mid) * ratio_max + (mid - min) * ratio_max_mid + min.

max,mid,min: point [max,mid,min] value in R.G.B. ratio_max: max color ratio. ratio_max_mid: max and mid color ratio

if threshold > -1 ,means grey == 0(<t) or (>t)255 ,decided by threshold

return current x ,y and grey value

type ImageType

type ImageType int

type ImgWriter

type ImgWriter struct{}

func NewImgWriter

func NewImgWriter() ImgWriter

type Yukkuri

type Yukkuri struct {
	Img    image.Image
	File   *os.File
	Greyer GreyFunction
	Cmd    command.Cmd
}

func NewYukkuri

func NewYukkuri(cmd command.Cmd) *Yukkuri

func (*Yukkuri) TransImgToAsc

func (ykr *Yukkuri) TransImgToAsc(converter Asc11Converter)

func (*Yukkuri) TransImgToGrey

func (ykr *Yukkuri) TransImgToGrey() (*image.Gray, error)

Jump to

Keyboard shortcuts

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