pixkey

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package pixkey implements a simple color key for landscape pixelations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PixKey

type PixKey struct {
	// contains filtered or unexported fields
}

PixKey stores the color values for a pixel value.

func Read

func Read(name string) (*PixKey, error)

Read reads a key file used to define the colors for pixel values in a time pixelation.

A key file is a tab-delimited file with the following required columns:

-key	the value used as identifier
-color	an RGB value separated by commas,
	for example "125,132,148".

Optionally it can contain the following columns:

-gray:  for a gray scale value

Any other columns, will be ignored. Here is an example of a key file:

key	color	gray	comment
0	0, 26, 51	0	deep ocean
1	0, 84, 119	10	oceanic plateaus
2	68, 167, 196	20	continental shelf
3	251, 236, 93	90	lowlands
4	255, 165, 0	100	highlands
5	229, 229, 224	50	ice sheets

func (*PixKey) Color

func (pk *PixKey) Color(v int) (color.Color, bool)

Color returns the color associated with a given value. If no color is defined for the value, it will return transparent black.

func (*PixKey) Gray

func (pk *PixKey) Gray(v int) (color.Color, bool)

Gray returns the gray color associated with a given value. If no color is defined for the value, it will return transparent black.

func (*PixKey) HasGrayScale

func (pk *PixKey) HasGrayScale() bool

HasGrayScale returns true if a gray scale is defined for the keys.

Jump to

Keyboard shortcuts

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