ColourMap

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

Constructors

ColourMap

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

ColourMap

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

ColourMap

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

ColourMap

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

Properties

A

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

B

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

Constant

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

Count

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

G

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

Height

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

IsConstant

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

OpaqueCount

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

R

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

TransparentCount

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

Width

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

Indexers

this[]

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

Methods

Blur

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

Blur

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

Clip

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

CreateFromBitmap

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

CreateFromBitmap

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

CreateFromDelegate

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

CreateFromImage

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

Gamma

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

Invert

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

Modify

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

SetChannel

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

SubMap

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

Tabulate

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

Tabulate

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

ToBitmap

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

ToBitmap

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

ToColourArray

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

Ungamma

#
public static ColourMap Ungamma(ColourMap map)
Perform a reverse gamma adjustment on this colour map.
map (ColourMap)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.