pic

package
v0.0.0-...-913c5ea Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package pic implements functions that display pictures on the Go playground.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Show

func Show(f func(dx, dy int) [][]uint8)

Show displays a picture defined by the function f when executed on the Go Playground.

f should return a slice of length dy, each element of which is a slice of dx 8-bit unsigned int. The integers are interpreted as bluescale values, where the value 0 means full blue, and the value 255 means full white.

Example
package main

import (
	"golang.org/x/tour/pic"
)

func main() {
	f := func(dx, dy int) [][]uint8 {
		ss := make([][]uint8, dy)
		for y := 0; y < dy; y++ {
			s := make([]uint8, dx)
			for x := 0; x < dx; x++ {
				s[x] = uint8((x + y) / 2)
			}
			ss[y] = s
		}
		return ss
	}

	pic.Show(f)

}
Output:

IMAGE:iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAACaUlEQVR42uzVMRGAAAzAwLSHf8tgAAf95QVkyVNvNRN50FWBl10V6ABa0AFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIB6ADqEAHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdAA6gBZ0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIBSAcgHYB0ANIB6AAq0AFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgHQA0gFIByAdgA6gAh2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADSAUgHIB2AdADyxy8AAP//YSoDD5pLB7MAAAAASUVORK5CYII=

func ShowImage

func ShowImage(m image.Image)

ShowImage displays the image m when executed on the Go Playground.

Types

This section is empty.

Jump to

Keyboard shortcuts

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