raster

package
v0.0.0-...-6d303d2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2014 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package raster implements a different taxon distribution raster kinds and their operations.

The rasters are expected to represent taxon's distributions.

Where comparing rasters, it is assumed that they are in the same scale, so control on the raster scale must be done outside the package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PixList

type PixList struct {
	// List of the pixels, it is not guaranteed that the list is ordered.
	Pixel []Pixel

	// Rect is the raster bounds.
	Rect image.Rectangle
}

A PixList raster is a raster in which pixels are stored as a simple list of the cells in which the pixel have a non 0 value.

func NewPixList

func NewPixList() *PixList

NewPixList returns a new empty PixList.

func (*PixList) At

func (p *PixList) At(pt image.Point) int

At returns the value of the indicated point.

func (*PixList) Bounds

func (p *PixList) Bounds() image.Rectangle

Bounds are the bounds of the PixList.

func (*PixList) Set

func (p *PixList) Set(pt image.Point, val int)

Set sets the value of the indicated point.

type Pixel

type Pixel struct {
	image.Point

	// The pixel value.
	Value int
}

Pixel is a point with a defined integer value.

type Raster

type Raster interface {
	// Bounds returns the boundaries of the raster in which valid pixels
	// are found, any At operation outside the Bounds will always returns
	// a zero value.
	Bounds() image.Rectangle

	// At returns the value of the indicated point.
	At(image.Point) int

	// Set sets a value of the indicated point. If the point is outside
	// the bounds, and the value is not zero, or point is zero and located
	// at the bounds, then the bounds will be redefined.
	Set(image.Point, int)
}

Raster defines a rectangular area that represent a taxon distribution.

Jump to

Keyboard shortcuts

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