sample

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package sample opens and encodes the example textfiles embedded into the program.

Index

Examples

Constants

View Source
const (
	Mona = create.Mona
	VGA  = create.VGA
)

Variables

View Source
var (
	ErrEncode  = errors.New("no encoding provided")
	ErrConvert = errors.New("unknown convert method")
	ErrConvNil = errors.New("conv argument cannot be empty")
)

Functions

func Encode added in v0.0.38

func Encode(e encoding.Encoding, b ...byte) ([]byte, error)

Encode b to the encoding.

func Map

func Map() map[string]Sample

Map the samples.

func Open

func Open(name string) ([]byte, error)

Open a sample text file.

Example
package main

import (
	"fmt"
	"log"

	"github.com/bengarrett/retrotxtgo/lib/sample"
)

func main() {
	b, err := sample.Open("037")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Print(len(b))
}
Output:

130

func Valid

func Valid(name string) bool

Valid textfile name.

Types

type File

type File struct {
	Encoding encoding.Encoding
	Font     create.Font
	Runes    []rune
}

File details.

type Flags

type Flags struct {
	From encoding.Encoding
	To   encoding.Encoding
}

Flags and configuration values by the user.

func (Flags) Open

func (flag Flags) Open(name string, conv *convert.Convert) (File, error)

Open and convert a sample textfile.

type Sample

type Sample struct {

	// Font used the render the text.
	Font create.Font

	// Name of the sample textfile.
	Name string
	// Description of the sample textfile.
	Description string
	// contains filtered or unexported fields
}

Sample textfile data.

Jump to

Keyboard shortcuts

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