draw

package
v0.0.0-...-d30abd5 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

README

package draw

import "github.com/zeebo/rothko/draw"

package draw provides common types for the drawing packages.

Usage

type Canvas
type Canvas interface {
	Set(x, y int, c Color)
	Size() (w, h int)
}

Canvas is the type of things that can be drawn onto.

type Color
type Color struct {
	R, G, B uint8
}

Color is a simple 8 bits per channel color.

type Column
type Column struct {
	X, W   int
	Data   []float64
	ObsSec float64
}

Column represents a column to draw in a context. Data is expected to be sorted, non-empty, and contain typical floats (no NaNs/denormals/Inf/etc). Obs is the number of observations.

type RGB
type RGB struct {
	Pix    []uint8
	Stride int
	Width  int
	Height int
	X, Y   int
}

RGB is a byte compatabile implementation of image.RGBA, except with much less supporting code, and no alpha channel.

func NewRGB
func NewRGB(w, h int) *RGB

NewRGB contstructs an RGB with space for the width and height.

func (*RGB) AsImage
func (m *RGB) AsImage() *image.RGBA
func (*RGB) Raw
func (m *RGB) Raw(x, y int) []uint8

Raw returns the raw values at the pixel, including alpha channel. It can be mutated.

func (*RGB) Set
func (m *RGB) Set(x, y int, c Color)

Set stores the pixel values in the color to the coordinate at x and y. The top left corner is (0, 0).

func (*RGB) Size
func (m *RGB) Size() (w, h int)

Size returns the width and height of the RGB.

func (RGB) View
func (m RGB) View(x, y, w, h int) *RGB

View returns a view into the RGB.

Documentation

Overview

package draw provides common types for the drawing packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canvas

type Canvas interface {
	Set(x, y int, c Color)
	Size() (w, h int)
}

Canvas is the type of things that can be drawn onto.

type Color

type Color struct {
	R, G, B uint8
}

Color is a simple 8 bits per channel color.

type Column

type Column struct {
	X, W   int
	Data   []float64
	ObsSec float64
}

Column represents a column to draw in a context. Data is expected to be sorted, non-empty, and contain typical floats (no NaNs/denormals/Inf/etc). Obs is the number of observations.

type RGB

type RGB struct {
	Pix    []uint8
	Stride int
	Width  int
	Height int
	X, Y   int
}

RGB is a byte compatabile implementation of image.RGBA, except with much less supporting code, and no alpha channel.

func NewRGB

func NewRGB(w, h int) *RGB

NewRGB contstructs an RGB with space for the width and height.

func (*RGB) AsImage

func (m *RGB) AsImage() *image.RGBA

func (*RGB) Raw

func (m *RGB) Raw(x, y int) []uint8

Raw returns the raw values at the pixel, including alpha channel. It can be mutated.

func (*RGB) Set

func (m *RGB) Set(x, y int, c Color)

Set stores the pixel values in the color to the coordinate at x and y. The top left corner is (0, 0).

func (*RGB) Size

func (m *RGB) Size() (w, h int)

Size returns the width and height of the RGB.

func (RGB) View

func (m RGB) View(x, y, w, h int) *RGB

View returns a view into the RGB.

Directories

Path Synopsis
package axis provides implementations of drawing rothko axes.
package axis provides implementations of drawing rothko axes.
package colors provides some color maps for drawing.
package colors provides some color maps for drawing.
package graph provides implementations of drawing rothko graphs.
package graph provides implementations of drawing rothko graphs.
package heatmap provides implementations of drawing rothko heatmaps.
package heatmap provides implementations of drawing rothko heatmaps.
package iosevka contains a basicfont.Face of the ascii range of the iosevka font face.
package iosevka contains a basicfont.Face of the ascii range of the iosevka font face.
package key provides a way to draw a heatmap key
package key provides a way to draw a heatmap key
package observations provides drawing of an observations axis.
package observations provides drawing of an observations axis.

Jump to

Keyboard shortcuts

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