Divooka Reference

Color

46 nodes

On this page 46

Alpha

Function

Opacity (Transparency), higher value means more opaque.

Signature
Alpha(Color: Color) -> Byte
byte Alpha(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultByte
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Blue

Function

Blue channel, from 0 (none) to 255 (full).

Signature
Blue(Color: Color) -> Byte
byte Blue(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultByte
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Green

Function

Green channel, from 0 (none) to 255 (full).

Signature
Green(Color: Color) -> Byte
byte Green(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultByte
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Red

Function

Red channel, from 0 (none) to 255 (full).

Signature
Red(Color: Color) -> Byte
byte Red(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultByte
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Make Color

Function

Overload 1 of 7

Signature
ColorElement() -> Color
ColorElement ColorElement()

Creates transparent black: every channel, alpha included, is 0.

Returns

resultColor

Overload 2 of 7

Signature
ColorElement(singleValue: Byte) -> Color
ColorElement ColorElement(byte singleValue)

Creates an opaque gray, with red, green and blue all set to the same value and alpha 255.

Parameters

nametypedefaultdescription
singleValueByte—Gray level from 0 (black) to 255 (white).

Returns

resultColor

Overload 3 of 7

Signature
ColorElement(singleValue: Byte, alpha: Byte) -> Color
ColorElement ColorElement(byte singleValue, byte alpha = 255)

Creates a gray, with red, green and blue all set to the same value, and the given opacity.

Parameters

nametypedefaultdescription
singleValueByte—Gray level from 0 (black) to 255 (white).
alphaByte255Opacity from 0 (fully transparent) to 255 (fully opaque).

Returns

resultColor

Overload 4 of 7

Signature
ColorElement -> Color
    red: Byte
    green: Byte
    blue: Byte
    alpha: Byte
ColorElement ColorElement(
    byte red,
    byte green,
    byte blue,
    byte alpha = 255)

Creates a color from its red, green, blue and alpha channels, each from 0 to 255.

Parameters

nametypedefaultdescription
redByte—Red channel, 0-255.
greenByte—Green channel, 0-255.
blueByte—Blue channel, 0-255.
alphaByte255Opacity, 0 (fully transparent) to 255 (fully opaque); opaque when omitted.

Returns

resultColor

Overload 5 of 7

Signature
ColorElement(bytes: Byte Array) -> Color
ColorElement ColorElement(byte[] bytes)

Creates a color from the first four bytes of an array, read in red, green, blue, alpha order.

Parameters

nametypedefaultdescription
bytesByte Array—At least four bytes; any beyond the fourth are ignored. Fewer than four throws System.IndexOutOfRangeException.

Returns

resultColor

Overload 6 of 7

Signature
ColorElement(pixel: Pixel) -> Color
ColorElement ColorElement(Pixel pixel)

Creates a color from a BigGustave PNG pixel, copying its red, green, blue and alpha bytes unchanged.

Parameters

nametypedefaultdescription
pixelPixel—The PNG decoder's pixel.

Returns

resultColor

Overload 7 of 7

Signature
ColorElement -> Color
    r: Low Accuracy Number
    g: Low Accuracy Number
    b: Low Accuracy Number
    a: Low Accuracy Number
ColorElement ColorElement(float r, float g, float b, float a)

Creates a color from fractional channels in the 0-1 range, each multiplied by 255 and truncated (not rounded) to a byte.

Parameters

nametypedefaultdescription
rLow Accuracy Number—Red channel, 0-1.
gLow Accuracy Number—Green channel, 0-1.
bLow Accuracy Number—Blue channel, 0-1.
aLow Accuracy Number—Opacity, 0 (fully transparent) to 1 (fully opaque).

Returns

resultColor

Remarks

Inputs are not clamped before the conversion, so keep every channel within 0-1.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Equals

Function

Overload 1 of 2

Signature
Equals(Color: Color, other: Color) -> Truth
bool Equals(ColorElement Color, ColorElement other)

Whether both colors have exactly the same red, green, blue and alpha bytes.

Parameters

nametypedefaultdescription
ColorColor—
otherColor—The color to compare with.

Returns

resultTruth

Overload 2 of 2

Signature
Equals(Color: Color, obj: Any) -> Truth
bool Equals(ColorElement Color, object obj)

Whether Obj is a Image.ColorElement with exactly the same four channels.

Parameters

nametypedefaultdescription
ColorColor—
objAny—The object to compare with.

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

Alpha Float

Function

The opacity as a fraction from 0 (fully transparent) to 1 (fully opaque).

Signature
AlphaFloat(Color: Color) -> Low Accuracy Number
float AlphaFloat(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultLow Accuracy Number
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Blue Float

Function

The blue channel as a fraction from 0 to 1 (the byte divided by 255).

Signature
BlueFloat(Color: Color) -> Low Accuracy Number
float BlueFloat(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultLow Accuracy Number
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Green Float

Function

The green channel as a fraction from 0 to 1 (the byte divided by 255).

Signature
GreenFloat(Color: Color) -> Low Accuracy Number
float GreenFloat(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultLow Accuracy Number
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Red Float

Function

The red channel as a fraction from 0 to 1 (the byte divided by 255).

Signature
RedFloat(Color: Color) -> Low Accuracy Number
float RedFloat(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultLow Accuracy Number
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Get Hash Code

Function

A hash code built from all four channels, consistent with ColorElement.Equals.

Signature
GetHashCode(Color: Color) -> Integer
int GetHashCode(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultInteger
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

Save As Text

Function

The color as text, in the same "#RRGGBBAA" hex form as ColorElement.ToString.

Signature
SaveAsText(Color: Color) -> Text
string SaveAsText(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To Console Color

Function

Converts this Color instance to the closest matching ConsoleColor.
The match is determined by the Euclidean distance between RGB components.

Signature
ToConsoleColor(Color: Color) -> ConsoleColor
ConsoleColor ToConsoleColor(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultConsoleColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To Grayscale

Function

A standard interpretation of (floating point) grayscale.

Signature
ToGrayscale(Color: Color) -> Low Accuracy Number
float ToGrayscale(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultLow Accuracy Number
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To Hex

Function

Convert color to RGB hex representation.

Signature
ToHex(Color: Color, alpha: Truth) -> Text
string ToHex(ColorElement Color, bool alpha = false)

Parameters

nametypedefaultdescription
ColorColor—
alphaTruthFalse

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To Luminance

Function

The perceived brightness of the color as a gray level, weighting red, green and blue as 0.299, 0.587 and 0.114 (Rec. 601) and rounding to the nearest byte.

Signature
ToLuminance(Color: Color) -> Byte
byte ToLuminance(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultByte

Remarks

The weights are applied to the stored bytes directly, without converting from sRGB to linear light. Alpha is ignored.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To Red Gray

Function

Treats the color as a grayscale value by taking its red channel alone, the convention this library uses for single-channel images.

Signature
ToRedGray(Color: Color) -> Byte
byte ToRedGray(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultByte
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To String

Function

Returns a hexadecimal string representation of the Image.ColorElement.

Signature
ToString(Color: Color) -> Text
string ToString(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To Tuple3

Function

The red, green and blue bytes (0-255) as a tuple, dropping alpha.

Signature
ToTuple3(Color: Color) -> (Byte, Byte, Byte)
(byte, byte, byte) ToTuple3(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

result(Byte, Byte, Byte)
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To Tuple4

Function

The red, green, blue and alpha bytes (0-255) as a tuple.

Signature
ToTuple4(Color: Color) -> (Byte, Byte, Byte, Byte)
(byte, byte, byte, byte) ToTuple4(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

result(Byte, Byte, Byte, Byte)
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To Vector3

Function

The red, green and blue channels as fractions from 0 to 1 in X, Y and Z, dropping alpha.

Signature
ToVector3(Color: Color) -> Vector3
Vector3 ToVector3(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultVector3

Remarks

The bytes are divided by 255 as stored; no sRGB-to-linear conversion is applied.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

To Vector4

Function

The red, green, blue and alpha channels as fractions from 0 to 1 in X, Y, Z and W.

Signature
ToVector4(Color: Color) -> Vector4
Vector4 ToVector4(ColorElement Color)

Parameters

nametypedefaultdescription
ColorColor—

Returns

resultVector4

Remarks

The bytes are divided by 255 as stored; no sRGB-to-linear conversion is applied.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

With Alpha

Function

Returns a copy of this color with the same red, green and blue but a different opacity.

Signature
WithAlpha(Color: Color, alpha: Byte) -> Color
ColorElement WithAlpha(ColorElement Color, byte alpha)

Parameters

nametypedefaultdescription
ColorColor—
alphaByte—The new opacity, 0 (fully transparent) to 255 (fully opaque).

Returns

resultColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

Write To Stream

Function

Writes the color as four raw bytes, red, green, blue then alpha.

Signature
WriteToStream -> Large Integer
    Color: Color
    writer: BinaryWriter
long WriteToStream(ColorElement Color, BinaryWriter writer)

Parameters

nametypedefaultdescription
ColorColor—
writerBinaryWriter—The writer to append to.

Returns

resultLarge Integer
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
Color
Package
Image Processing

From Argb

Function

Creates a color from alpha, red, green and blue bytes, given alpha first.

Signature
FromArgb(a: Byte, r: Byte, g: Byte, b: Byte) -> Color
ColorElement FromArgb(byte a, byte r, byte g, byte b)

Parameters

nametypedefaultdescription
aByte—Opacity, 0 (fully transparent) to 255 (fully opaque).
rByte—Red channel, 0-255.
gByte—Green channel, 0-255.
bByte—Blue channel, 0-255.

Returns

resultColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

From Console Color

Function

Converts a ConsoleColor to a Color instance using a fixed mapping.

Signature
FromConsoleColor(consoleColor: ConsoleColor) -> Color
ColorElement FromConsoleColor(ConsoleColor consoleColor)

Parameters

nametypedefaultdescription
consoleColorConsoleColor—

Returns

resultColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

From Rgb

Function

Creates a fully opaque color from red, green and blue bytes.

Signature
FromRgb(r: Byte, g: Byte, b: Byte) -> Color
ColorElement FromRgb(byte r, byte g, byte b)

Parameters

nametypedefaultdescription
rByte—Red channel, 0-255.
gByte—Green channel, 0-255.
bByte—Blue channel, 0-255.

Returns

resultColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

From Sc Rgb

Function

This node carries no documentation.

Signature
FromScRgb -> Color
    a: Integer
    r: Low Accuracy Number
    g: Low Accuracy Number
    b: Low Accuracy Number
ColorElement FromScRgb(int a, float r, float g, float b)

Parameters

nametypedefaultdescription
aInteger—
rLow Accuracy Number—
gLow Accuracy Number—
bLow Accuracy Number—

Returns

resultColor

Remarks

TODO: looks broken. this forwards to the all-float constructor, so a gets multiplied by 255 again — FromScRgb(255, ...). Look at usages and see how to/whether to fix this.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

From Unit Float

Function

This node carries no documentation.

Signature
FromUnitFloat(value: Low Accuracy Number) -> Color
ColorElement FromUnitFloat(float value)

Parameters

nametypedefaultdescription
valueLow Accuracy Number—Value between 0-1

Returns

resultColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Get Color Nullable

Function

Gets color from serialization.

Signature
GetColorNullable(bytes: Byte Array) -> Optional Color
ColorElement? GetColorNullable(byte[] bytes)

Parameters

nametypedefaultdescription
bytesByte Array—

Returns

resultOptional Color
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Interp

Function

Overload 1 of 3

Signature
Interp(c1: Color, c2: Color, alpha: Byte) -> Color
ColorElement Interp(
    ColorElement c1,
    ColorElement c2,
    byte alpha)

This node carries no documentation.

Parameters

nametypedefaultdescription
c1Color—
c2Color—
alphaByte—

Returns

resultColor

Remarks

Ignores alpha, effectively assumping premultiplied.

Overload 2 of 3

Signature
Interp(c1: Color, c2: Color, ratio: Number) -> Color
ColorElement Interp(
    ColorElement c1,
    ColorElement c2,
    double ratio)

This node carries no documentation.

Parameters

nametypedefaultdescription
c1Color—
c2Color—
ratioNumber—

Returns

resultColor

Remarks

Ignores alpha, effectively assumping premultiplied.

Overload 3 of 3

Signature
Interp -> Color
    from: Color
    to: Color
    blend: Low Accuracy Number
    useAlphaFromTarget: Truth
ColorElement Interp(
    ColorElement from,
    ColorElement to,
    float blend,
    bool useAlphaFromTarget)

Linear interpolate with proper alpha treatment.

Parameters

nametypedefaultdescription
fromColor—The color returned at a blend of 0.
toColor—The color blended towards; reached at a blend of 1 (and, when Use Alpha From Target is set, only if it is fully opaque).
blendLow Accuracy Number—Value between 0-1
useAlphaFromTargetTruth—

Returns

resultColor

Remarks

In general, this is a weird operation; Use with care at call site - likely we would want something more well defined.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Load From Text

Function

Reads a color from text, accepting the same hex codes and color names as ColorElement.Parse.

Signature
LoadFromText(text: Text) -> Color
ColorElement LoadFromText(string text)

Parameters

nametypedefaultdescription
textText—A hex code such as "#RRGGBBAA" or a Image.MediaColors name.

Returns

resultColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Multiply Rgb Preserve Alpha

Function

Brightens or darkens a color by multiplying red, green and blue by a factor, keeping its alpha unchanged.

Signature
MultiplyRgbPreserveAlpha -> Color
    color: Color
    multiplier: Number
ColorElement MultiplyRgbPreserveAlpha(
    ColorElement color,
    double multiplier)

Parameters

nametypedefaultdescription
colorColor—The color to scale.
multiplierNumber—The factor applied to each of red, green and blue; 1 leaves the color unchanged.

Returns

resultColor

Remarks

Each channel is rounded and clamped to 0-255, so a large factor saturates at white rather than wrapping; a NaN or infinite product gives 0.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Addition Operation

Function

Adds two colors channel by channel for red, green and blue; the result is always opaque.

Signature
op_Addition(a: Color, b: Color) -> Color
ColorElement op_Addition(ColorElement a, ColorElement b)

Parameters

nametypedefaultdescription
aColor—The first color; its alpha is ignored.
bColor—The second color; its alpha is ignored.

Returns

resultColor

Remarks

The byte arithmetic wraps rather than clamps: a channel that would exceed 255 comes back near 0.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Equality Operation

Function

Whether two colors have exactly the same red, green, blue and alpha bytes.

Signature
op_Equality(left: Color, right: Color) -> Truth
bool op_Equality(ColorElement left, ColorElement right)

Parameters

nametypedefaultdescription
leftColor—The first color.
rightColor—The second color.

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Inequality Operation

Function

Whether two colors differ in any of red, green, blue or alpha.

Signature
op_Inequality(left: Color, right: Color) -> Truth
bool op_Inequality(ColorElement left, ColorElement right)

Parameters

nametypedefaultdescription
leftColor—The first color.
rightColor—The second color.

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Multiply Operation

Function

Scales red, green and blue by a factor, truncating each result to a byte; the result is always opaque.

Signature
op_Multiply(a: Color, m: Number) -> Color
ColorElement op_Multiply(ColorElement a, double m)

Parameters

nametypedefaultdescription
aColor—The color to scale; its alpha is ignored.
mNumber—The factor applied to each of red, green and blue.

Returns

resultColor

Remarks

Results are not clamped, so keep the factor small enough that no channel exceeds 255; ColorElement.MultiplyRgbPreserveAlpha clamps and keeps alpha.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Subtraction Operation

Function

Subtracts one color from another channel by channel for red, green and blue; the result is always opaque.

Signature
op_Subtraction(a: Color, b: Color) -> Color
ColorElement op_Subtraction(ColorElement a, ColorElement b)

Parameters

nametypedefaultdescription
aColor—The color subtracted from; its alpha is ignored.
bColor—The color subtracted; its alpha is ignored.

Returns

resultColor

Remarks

The byte arithmetic wraps rather than clamps: a channel that would go below 0 comes back near 255.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Parse

Function

Parses a string representation of a color and returns the corresponding Image.ColorElement instance.

Signature
Parse(textColor: Text) -> Color
ColorElement Parse(string textColor)

Parameters

nametypedefaultdescription
textColorText—A string representing the color. This can either be a hexadecimal value (starting with '#') in the format "#RRGGBB" or "#RRGGBBAA" (with an optional alpha component) or the name of a predefined color in Image.MediaColors.

Returns

resultColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Parse Hex ARGB

Function

Parses a hexadecimal string representation of a color in ARGB order.

Signature
ParseHexARGB(hex: Text) -> Color
ColorElement ParseHexARGB(string hex)

Parameters

nametypedefaultdescription
hexText—A hexadecimal string representing the color. The string may optionally start with '#' and must be in the format "AARRGGBB", where the alpha component comes first.

Returns

resultColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Parse Hex RGBA

Function

Parses a hexadecimal string representation of a color in RGBA order.

Signature
ParseHexRGBA(hex: Text) -> Color
ColorElement ParseHexRGBA(string hex)

Parameters

nametypedefaultdescription
hexText—A hexadecimal string representing the color. The string may optionally start with '#' and must be in the format "RRGGBB" or "RRGGBBAA", where the alpha component is optional and defaults to 255 if omitted.

Returns

resultColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Read From Stream

Function

Reads a color written by ColorElement.WriteToStream: four bytes, red, green, blue then alpha.

Signature
ReadFromStream(reader: BinaryReader) -> (result: Large Integer, value: Color)
long ReadFromStream(BinaryReader reader, out ColorElement value)

Parameters

nametypedefaultdescription
readerBinaryReader—The reader positioned at the color.

Returns

resultLarge Integer
valueColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Serialize

Function

Nullable serialization helper.

Signature
Serialize(value: Optional Color) -> Byte Array
byte[] Serialize(ColorElement? value)

Parameters

nametypedefaultdescription
valueOptional Color—Can be null

Returns

resultByte Array
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Try Parse

Function

Tries to read a color from text, either a hex code starting with '#' or the name of a color in Image.MediaColors, without throwing on bad input.

Signature
TryParse(textColor: Text) -> (result: Truth, color: Color)
bool TryParse(string textColor, out ColorElement color)

Parameters

nametypedefaultdescription
textColorText—The text to parse, such as "#FF8000", "#FF800080" or "Orange".

Returns

resultTruth
colorColor

Remarks

Surrounding whitespace is ignored and color names are matched case-insensitively. A hex code is read as "#RRGGBB" or "#RRGGBBAA" (see ColorElement.TryParseHexRGBA).

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Try Parse Hex ARGB

Function

Tries to read a hex color in alpha, red, green, blue order (the order XAML color codes use), without throwing on bad input.

Signature
TryParseHexARGB(hex: Text) -> (result: Truth, color: Color)
bool TryParseHexARGB(string hex, out ColorElement color)

Parameters

nametypedefaultdescription
hexText—Exactly eight hex digits, "AARRGGBB", optionally preceded by '#' and surrounded by whitespace.

Returns

resultTruth
colorColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing

Try Parse Hex RGBA

Function

Tries to read a hex color in red, green, blue, alpha order, without throwing on bad input.

Signature
TryParseHexRGBA(hex: Text) -> (result: Truth, color: Color)
bool TryParseHexRGBA(string hex, out ColorElement color)

Parameters

nametypedefaultdescription
hexText—Six or eight hex digits, "RRGGBB" or "RRGGBBAA", optionally preceded by '#' and surrounded by whitespace. Alpha defaults to 255 (opaque) when only six digits are given.

Returns

resultTruth
colorColor
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Color
Package
Image Processing