pixelutils

package
v0.0.0-...-a7c1c26 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2014 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Red     = color.RGBA{255, 0, 0, 255}
	Yellow  = color.RGBA{255, 255, 0, 255}
	Green   = color.RGBA{0, 255, 0, 255}
	Cyan    = color.RGBA{0, 255, 255, 255}
	Blue    = color.RGBA{0, 0, 255, 255}
	Magenta = color.RGBA{255, 0, 255, 255}
	White   = color.RGBA{255, 255, 255, 255}
	Black   = color.RGBA{0, 0, 0, 255}
)

Functions

func DimensionChanger

func DimensionChanger(img draw.Image, w, h int) draw.Image

Like PixelSizeChanger, but instead of the pixel size the new image is given.

func DrawText

func DrawText(img draw.Image, c color.Color, text string)

DrawText is a convenience function to write text into an image.

func Empty

func Empty(img draw.Image)

Empty makes an image black.

func Fill

func Fill(img draw.Image, c color.Color)

Fill fills an entire image with the given color.

func MaskForCharacter

func MaskForCharacter(c byte) image.Image

MaskForCharacter returns an 4x6 black-and-white image mask for the given character. Useful for image/draw.DrawMask().

func NewPixel

func NewPixel() draw.Image

NewPixel creates a new empty pixel.

func PixelPusher

func PixelPusher() (chan<- draw.Image, <-chan *Click)

PixelPusher returns 2 channels. One, over which a pixel can be pushed onto the wall, and another over which click events can be received.

func PixelSizeChanger

func PixelSizeChanger(img draw.Image, w, h int) draw.Image

PixelSizeChanger enlarges pixels to the given size, effectively making the image smaller. If either of the pixel dimensions is not a multiple of the respective image dimension, a padding of unusable pixels will remain to the right and bottom.

func StretchCopy

func StretchCopy(dst draw.Image, src image.Image)

StretchCopy transforms src to fill dst and draws the result over dst.

func SubImage

func SubImage(img draw.Image, r image.Rectangle) draw.Image

SubImage extracts a rectangular subset of img as a separate image. If present, the `SubImage()` method will be used. Otherwise, the behaviour will be emulated.

Types

type Click

type Click struct {
	PixelId  string `json:"key"`
	Position struct {
		X int `json:"x"`
		Y int `json:"y"`
	} `json:"position"`
}

Click represents a click event on a pixel.

func (*Click) Point

func (c *Click) Point() image.Point

type HSLA

type HSLA struct {
	H, S, L, A float64
}

Implements image/color.Color for HSLA values

func (HSLA) RGBA

func (c HSLA) RGBA() (r, g, b, a uint32)

type ImageWriter

type ImageWriter interface {
	draw.Image
	io.Writer
	// Resets the `cursor` to the initial position
	Cls()
}

ImageWriter is a writable image. The image behaves like a non-scrolling terminal.

func NewImageWriter

func NewImageWriter(img draw.Image, c color.Color) ImageWriter

NewImageWriter creates a new ImageWriter, which writes on the given image in the given color.

Directories

Path Synopsis
Package twitter provides a radically simplified Twitter API.
Package twitter provides a radically simplified Twitter API.

Jump to

Keyboard shortcuts

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