Documentation
¶
Overview ¶
Package canvas represents a rectangular grid of Pixels.
Index ¶
Constants ¶
View Source
const PixelMapTemplate = `{{ .PPMIdentifier }}
{{ .Width }} {{ .Height }}
{{ .MaxColorValue }}
{{ pixels .Pixels }}`
PixelMapTemplate is a template used for rendering a Canvas to a portable pixmap (PPM) file.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶
type Canvas struct { Width int Height int Pixels [][]color.Color PPMIdentifier string MaxColorValue uint8 MinColorValue uint8 }
Canvas represents a rectangular grid of Pixels.
func (*Canvas) PixelAt ¶
PixelAt returns the Color at the pixel located at the passed x and y values.
func (*Canvas) ToPPM ¶
ToPPM writes the current canvas to a file in the portable pixmap (PPM) format.
func (*Canvas) ValidateInCanvasBounds ¶
ValidateInCanvasBounds validates that the passed x and y values fit into the pixel bounds of the canvas.