canvas

package module
v1.0.1-0...-bef6127 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 3 Imported by: 0

README

Canvas MIT License

Canvas is a simple go package that provides functions to help you create and display canvases in the terminal.

Contents

Example

package main

import (
	"fmt"
	"image/color"

	"github.com/NotWithering/canvas"
)

func main() {
	myCanvas := canvas.New(7, 3)
	myCanvas = canvas.Fill(myCanvas, color.Transparent)

	myCanvas[0][0] = color.RGBA{255, 85, 85, 255}
	myCanvas[0][1] = color.RGBA{255, 85, 85, 255}
	myCanvas[0][2] = color.RGBA{255, 85, 85, 255}
	myCanvas[1][1] = color.RGBA{255, 85, 85, 255}
	myCanvas[2][0] = color.RGBA{255, 85, 85, 255}
	myCanvas[2][1] = color.RGBA{255, 85, 85, 255}
	myCanvas[2][2] = color.RGBA{255, 85, 85, 255}

	myCanvas[4][0] = color.RGBA{255, 85, 85, 255}
	myCanvas[5][0] = color.RGBA{255, 85, 85, 255}
	myCanvas[6][0] = color.RGBA{255, 85, 85, 255}
	myCanvas[5][1] = color.RGBA{255, 85, 85, 255}
	myCanvas[4][2] = color.RGBA{255, 85, 85, 255}
	myCanvas[5][2] = color.RGBA{255, 85, 85, 255}
	myCanvas[6][2] = color.RGBA{255, 85, 85, 255}

	me := canvas.Text(myCanvas)
	fmt.Println(me)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Text

func Text(canvas Canvas) string

Text renders the canvas using subcharacter-layering into a string.

Types

type Canvas

type Canvas [][]Color

Canvas is a two-dimensional array of colors.

func Fill

func Fill(canvas Canvas, color Color) Canvas

Fill fills the entire Canvas with the specified color.

func New

func New(width, height int) Canvas

New creates a new Canvas with the specified width and height.

type Color

type Color color.Color

Color represents a color in the canvas.

Jump to

Keyboard shortcuts

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