text

package
v0.0.0-...-238917c Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package text contains an image plain text file format encoder and decoder.

A super simple format of the form:

! SKTEXTSIMPLE width height 0x000000ff 0xffffffff ... 0xddddddff 0xffffff88 ... ...

Where the pixel values are encoded as 0xRRGGBBAA.

Grayscale pixels can be encoded as 0xXX. The two images below are equivalent:

! SKTEXTSIMPLE 2 2 0x00 0x11 0xaa 0xbb

! SKTEXTSIMPLE 2 2 0x000000ff 0x111111ff 0xaaaaaaff 0xbbbbbbff

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(r io.Reader) (image.Image, error)

Decode reads an SKTEXT image from r and returns it as an image.Image. The type of Image returned will always be NRGBA.

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, error)

DecodeConfig returns the color model and dimensions of SKTEXT image without decoding the entire image.

func Encode

func Encode(w io.Writer, m *image.NRGBA) error

Encode encoded the image in SKTEXT format.

func MustToGray

func MustToGray(s string) *image.Gray

MustToGray calls MustToNRGBA with the given string and converts the returned image to grayscale.

func MustToNRGBA

func MustToNRGBA(s string) *image.NRGBA

MustToNRGBA returns an *image.NRGBA from a given string, which is assumed to be an image in the SKTEXTSIMPLE "codec". It panics if the string cannot be processed into an image, suitable only for testing code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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