Documentation ¶
Overview ¶
Package heightmap implements a store for height data along with methods to produce images from the map.
Index ¶
- Variables
- type Map
- func (hm *Map) AsImage() (*image.RGBA, error)
- func (hm *Map) AsPNG() ([]byte, error)
- func (hm *Map) Color(pctWater, pctLand, pctIce int, water, land, ice []color.RGBA) error
- func (hm *Map) ColorHSL(pctWater, pctIce int, water, land, ice []color.RGBA) error
- func (hm *Map) Rotate(clockwise bool)
- func (hm *Map) ShiftXY(dx, dy int)
- type Orientation
Constants ¶
This section is empty.
Variables ¶
View Source
var ( WaterColors = []color.RGBA{ {R: 0, G: 0, B: 0, A: 255}, {R: 0, G: 0, B: 68, A: 255}, {R: 0, G: 17, B: 102, A: 255}, {R: 0, G: 51, B: 136, A: 255}, {R: 0, G: 85, B: 170, A: 255}, {R: 0, G: 119, B: 187, A: 255}, {R: 0, G: 153, B: 221, A: 255}, {R: 0, G: 204, B: 255, A: 255}, {R: 34, G: 221, B: 255, A: 255}, {R: 68, G: 238, B: 255, A: 255}, {R: 102, G: 255, B: 255, A: 255}, {R: 119, G: 255, B: 255, A: 255}, {R: 136, G: 255, B: 255, A: 255}, {R: 153, G: 255, B: 255, A: 255}, {R: 170, G: 255, B: 255, A: 255}, {R: 187, G: 255, B: 255, A: 255}, } LandColors = []color.RGBA{ {R: 0, G: 68, B: 0, A: 255}, {R: 34, G: 102, B: 0, A: 255}, {R: 34, G: 136, B: 0, A: 255}, {R: 119, G: 170, B: 0, A: 255}, {R: 187, G: 221, B: 0, A: 255}, {R: 255, G: 187, B: 34, A: 255}, {R: 238, G: 170, B: 34, A: 255}, {R: 221, G: 136, B: 34, A: 255}, {R: 204, G: 136, B: 34, A: 255}, {R: 187, G: 102, B: 34, A: 255}, {R: 170, G: 85, B: 34, A: 255}, {R: 153, G: 85, B: 34, A: 255}, {R: 136, G: 68, B: 34, A: 255}, {R: 119, G: 51, B: 34, A: 255}, {R: 85, G: 51, B: 17, A: 255}, {R: 68, G: 34, B: 0, A: 255}, } AlternateLandColors = []color.RGBA{}/* 107 elements not displayed */ IceColors = []color.RGBA{ {R: 255, G: 255, B: 255, A: 255}, {R: 250, G: 250, B: 250, A: 255}, {R: 245, G: 245, B: 245, A: 255}, {R: 240, G: 240, B: 240, A: 255}, {R: 235, G: 235, B: 235, A: 255}, {R: 230, G: 230, B: 230, A: 255}, {R: 225, G: 225, B: 225, A: 255}, {R: 220, G: 220, B: 220, A: 255}, {R: 215, G: 215, B: 215, A: 255}, {R: 210, G: 210, B: 210, A: 255}, {R: 205, G: 205, B: 205, A: 255}, {R: 200, G: 200, B: 200, A: 255}, {R: 195, G: 195, B: 195, A: 255}, {R: 190, G: 190, B: 190, A: 255}, {R: 185, G: 185, B: 185, A: 255}, {R: 180, G: 180, B: 180, A: 255}, {R: 175, G: 175, B: 175, A: 255}, } )
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
MinZ, MaxZ float64
// Data is an array of elevations, indexed as (x, y)
Data [][]float64
// Colors is the index into the color table for each pixel
Colors [][]int
// contains filtered or unexported fields
}
Map is a height map. X and Y are the coordinates and Z is the elevation, which is normalized to the range 0...1.
func FromArray ¶
func FromArray(pixels [][]float64, xy Orientation, normalized bool) *Map
FromArray will panic if len(pixels) is zero or out of memory.
func FromArrayOfInt ¶
func FromArrayOfInt(pixels [][]int, xy Orientation) *Map
FromArrayOfInt will panic if len(pixels) is zero or out of memory.
func FromSlice ¶
func FromSlice(pixels []float64, maxx, maxy int, xy Orientation, normalized bool) *Map
FromSlice will panic if len(pixels) is zero, maxx * maxy > len(pixels), or out of memory.
func FromSliceOfInt ¶
func FromSliceOfInt(pixels []int, maxx, maxy int, xy Orientation) *Map
FromSliceOfInt will panic if len(pixels) is zero, maxx * maxy > len(pixels), or out of memory.
Click to show internal directories.
Click to hide internal directories.