gui

package
v0.0.0-...-c5b67ef Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DivRows specifies the number of horizontal rows, where each row spans an
	// identical distance expressed in volts.
	DivRows = 8
	// DivCols specifies of vertical columns, where each column spans an
	// idential duration of time.
	DivCols = 10
)

Variables

View Source
var (
	ColorWhite  = color.RGBA{255, 255, 255, 255}
	ColorBlack  = color.RGBA{0, 0, 0, 255}
	ColorRed    = color.RGBA{255, 0, 0, 255}
	ColorGreen  = color.RGBA{0, 200, 0, 255}
	ColorBlue   = color.RGBA{0, 0, 255, 255}
	ColorPurple = color.RGBA{255, 0, 255, 255}
	ColorYellow = color.RGBA{255, 255, 0, 255}
	ColorGrey   = color.RGBA{200, 200, 200, 255}
)

Commonly used color values.

Functions

func DrawOver

func DrawOver(dst *image.RGBA, src *image.RGBA)

DrawOver copies opaque pixels of src onto dst into the same positions, effectively drawing over the dst. DrawOver panics if dst and src are not of the same dimensions. DrawOver handles the alpha channel only in the most simplified way. For complex drawing operations, use image/draw package instead.

func LinearInterpolator

func LinearInterpolator(samples []scope.Voltage, size int) ([]scope.Voltage, error)

LinearInterpolator estimates the values of the points using linear segments joining neihbouring points

func PlotToPng

func PlotToPng(dev scope.Device, width, height int, traceParams map[scope.ChanID]scope.TraceParams, cols map[scope.ChanID]color.RGBA, outputFile string) error

PlotToPng creates a plot of the samples from the device and saves it as PNG.

func SincInterpolator

func SincInterpolator(samples []scope.Voltage, size int) ([]scope.Voltage, error)

SincInterpolator uses Fourier series for interpolation

func SincZeroPadInterpolator

func SincZeroPadInterpolator(samples []scope.Voltage, size int) ([]scope.Voltage, error)

SincZeroPadInterpolator uses Fourier series for interpolation and adds zeros to the input samples to make sure their number is a power of 2

func StepInterpolator

func StepInterpolator(samples []scope.Voltage, size int) ([]scope.Voltage, error)

StepInterpolator assigns the value of the nearest data point performing piecewise constant interpolation

Types

type Interpolator

type Interpolator func([]scope.Voltage, int) ([]scope.Voltage, error)

Interpolator constructs new data points within the range of a set of known data points

type Plot

type Plot struct {
	*image.RGBA
	// contains filtered or unexported fields
}

Plot represents the entire plotting area.

func CreatePlot

func CreatePlot(dev scope.Device, width, height int, traceParams map[scope.ChanID]scope.TraceParams, cols map[scope.ChanID]color.RGBA) (Plot, error)

CreatePlot plots samples from the device.

func NewPlot

func NewPlot(p image.Point) Plot

NewPlot returns a new Plot of specified size.

func (Plot) DrawAll

func (plot Plot) DrawAll(data []scope.ChannelData, traceParams map[scope.ChanID]scope.TraceParams, cols map[scope.ChanID]color.RGBA) error

DrawAll draws samples from all the channels in the plot.

func (Plot) DrawFromDevice

func (plot Plot) DrawFromDevice(dev scope.Device, traceParams map[scope.ChanID]scope.TraceParams, cols map[scope.ChanID]color.RGBA) error

DrawFromDevice draws samples from the device in the plot.

func (Plot) DrawLine

func (plot Plot) DrawLine(p1, p2 image.Point, rect image.Rectangle, col color.RGBA)

DrawLine draws a straight line from pixel p1 to p2. Only the line fragment inside the image rectangle defined by starting (upper left) and ending (lower right) pixel is drawn.

func (Plot) DrawSamples

func (plot Plot) DrawSamples(samples []scope.Voltage, traceParams scope.TraceParams, rect image.Rectangle, col color.RGBA) error

DrawSamples draws samples in the image rectangle defined by starting (upper left) and ending (lower right) pixel.

func (Plot) Fill

func (plot Plot) Fill(col color.RGBA)

Fill fills the plot with a background image of the same size.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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