pixelate

package
v0.0.0-...-2d15020 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canvas

type Canvas struct {
	// contains filtered or unexported fields
}

Canvas struct holds the Javascript objects needed for the Canvas creation

func NewCanvas

func NewCanvas() *Canvas

NewCanvas creates and initializes the new Canvas element

func (*Canvas) Alert

func (c *Canvas) Alert(args ...interface{})

Alert calls the `alert` Javascript function

func (*Canvas) Log

func (c *Canvas) Log(args ...interface{})

Log calls the `console.log` Javascript function

func (*Canvas) Render

func (c *Canvas) Render() error

Render calls the `requestAnimationFrame` Javascript function in asynchronous mode.

func (*Canvas) StartWebcam

func (c *Canvas) StartWebcam() (*Canvas, error)

StartWebcam reads the webcam data and feeds it into the canvas element. It returns an empty struct in case of success and error in case of failure.

func (*Canvas) Stop

func (c *Canvas) Stop()

Stop stops the rendering.

type Quant

type Quant struct {
	// contains filtered or unexported fields
}

A workspace with members that can be accessed by methods.

func NewQuantizer

func NewQuantizer() *Quant

NewQuantizer is a constructor method which initializes a new Quantizer.

func (*Quant) Draw

func (quant *Quant) Draw(src image.Image, numOfColors int, cellSize int, noiseLevel int) image.Image

Draw creates uniform cells with the quantified cell color of the source image.

func (*Quant) Median

func (q *Quant) Median(c *cluster) uint32

func (*Quant) Paletted

func (qz *Quant) Paletted() image.PalettedImage

func (Quant) Quantize

func (q Quant) Quantize(img image.Image, nq int) image.Image

Quantize returns a paletted image. We need to use type assertion to match the interface returning type.

func (*Quant) Split

func (q *Quant) Split(s, c *cluster, m uint32)

type Quantizer

type Quantizer interface {
	Quantize(image.Image, draw.Image, int, bool, bool) image.Image
}

Interface which implements the Quantize method.

type SubImager

type SubImager interface {
	SubImage(r image.Rectangle) image.Image
}

SubImager is a wrapper implementing the SubImage method from the image package.

Jump to

Keyboard shortcuts

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