ColourMap

References
public sealed class ColourMap
Represents an immutable rectangular grid of colours.

Constructors

ColourMap

#
Create a colour map from a rectangular array of colours.
public ColourMap(
Color[][]
colourArray
Array of colours.
)

ColourMap

#
Create a new constant map.
public ColourMap(
width,
Width of map.
height,
Height of map.
Color
constant
Constant value.
)

ColourMap

#
Create a new colour map.
public ColourMap(
red,
Red channel.
green,
Green channel.
blue,
Blue channel.
alpha
Alpha channel.
)

ColourMap

#
Create a new colour map.
public ColourMap(
red,
Red channel.
green,
Green channel.
blue
Blue channel.
)

Properties

A

#
Gets the alpha channel.
public NumberMap A { get; }

B

#
Gets the blue channel.
public NumberMap B { get; }

Constant

#
Gets the constant value of this map. If IsConstant is not true, this value is meaningless.
public Color Constant { get; }

Count

#
Gets the total number of entries in this map.
public long Count { get; }

G

#
Gets the green channel.
public NumberMap G { get; }

Height

#
Gets the height of the map.
public int Height { get; }

IsConstant

#
Gets whether this map contains only a single value.
public bool IsConstant { get; }

OpaqueCount

#
Gets the number of colours in this map that are fully opaque.
public long OpaqueCount { get; }

R

#
Gets the red channel.
public NumberMap R { get; }

TransparentCount

#
Gets the number of colours in this map that are fully transparent.
public long TransparentCount { get; }

Width

#
Gets the width of the map.
public int Width { get; }

Indexers

this[]

#
Gets the colour at the given (x,y) coordinate. If the map is constant this indexer will throw.
public Color this[
x,
X index.
y
Y index.
] { get; }
Value at (x,y).

Methods

Blur

#
Blur this colour map.
public ColourMap Blur(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
token = default(CancellationToken)
Cancellation token.
)
Blurred colourmap.

Blur

#
Blur this colour map.
public ColourMap Blur(
horizontal,
Horizontal tiling.
vertical,
Vertical tiling.
profile,
Blur profile.
radius,
Blur radius.
token = default(CancellationToken)
Cancellation token.
)
Blurred colourmap.

Clip

#
Clip the entire colour map, ie. ensure all channels are within the (0~1) range.
public static ColourMap Clip(
map
Map to clip.
)
Clipped map.

CreateFromBitmap

#
Copy the bitmap colours into a ColourMap.
public static ColourMap CreateFromBitmap(
Bitmap
bitmap
Bitmap to extract.
)

CreateFromBitmap

#
Copy the bitmap colours into a ColourMap.
public static ColourMap CreateFromBitmap(
BitmapData
data
Bitmap data to extract.
)

CreateFromDelegate

#
Populate a colour map using a shader delegate.
public static ColourMap CreateFromDelegate(
width,
Width of map to create.
height,
Height of map to create.
shader
Shader delegate.
)
Instantiated colour map.

CreateFromImage

#
Copy the image colours into a ColourMap.
public static ColourMap CreateFromImage(
Image
image
Image to extract.
)

Gamma

#
Perform a gamma adjustment on this colour map.
public static ColourMap Gamma(
map
Map.
)
Adjusted map.

Invert

#
Perform a gamma adjustment on this colour map.
public static ColourMap Invert(
map,
Map.
maintainLuminance
If true, inversion will happen in HSL space.
)
Adjusted map.

Modify

#
Apply a custom modifier to this map.
public static ColourMap Modify(
map,
Original map.
Func<Color, Color>
modificationDelegate
Custom modifier delegate.
)
Modified map.

SetChannel

#
Set the specified channel value of each colour.
public static ColourMap SetChannel(
map,
Original map.
newValue,
New channel value.
channel
Channel to set.
)
Modified map.

SubMap

#
Copy a portion of this map into a new map.
public ColourMap SubMap(
x0,
Inclusive index of first column to include in duplicate.
x1,
Exclusive index of last column to include in duplicate.
y0,
Inclusive index of first row to include in duplicate.
y1
Exclusive index of last row to include in duplicate.
)
Colour map portion.

Tabulate

#
Pull all values in a map to a collection of allowed values.
public static ColourMap Tabulate(
map,
Map.
IEnumerable<Color>
table
Collection of values to tabulate against.
)
Tabulated map.

Tabulate

#
Pull all values in a map to a collection of allowed values.
public static ColourMap Tabulate(
map,
Map.
params Color[]
table
Collection of values to tabulate against.
)
Tabulated map.

ToBitmap

#
Create a bitmap out of this colour map.
public Bitmap ToBitmap()
Bitmap.

ToBitmap

#
Create a bitmap out of this colour map.
public Bitmap ToBitmap(
PixelFormat
format
Pixel format to use.
)
Bitmap.

ToColourArray

#
Create a nested colour array from this map.
public Color[][] ToColourArray()
Colour array.

Ungamma

#
Perform a reverse gamma adjustment on this colour map.
public static ColourMap Ungamma(
map
Map.
)
Adjusted map.

Operators

OperationResultDescription
Color+ColourMapColourMapAdd a value to this float map.
ColourMap+ColourMapColourMapAdd two maps together.
ColourMap+ColorColourMapAdd a value to this float map.
Color*ColourMapColourMapMultiply this map by a factor.
ColourMap*ColourMapColourMapMultiply two maps together.
ColourMap*ColorColourMapMultiply this map by a factor.
ColourMap*floatColourMapMultiply this map by a factor.
float*ColourMapColourMapMultiply this map by a factor.
Color-ColourMapColourMapSubtract the entire map from a value.
ColourMap-ColourMapColourMapSubtract one map from another.
ColourMap-ColorColourMapSubtract a value from this float map.
-ColourMapColourMapInversion operator.
+ColourMapColourMapIdentity operator.