Skip to content

CellEffects

Namespace: Hex1b.Surfaces

Assembly: Hex1b.dll

Provides factory methods for common computed cell effects.

csharp
public static class CellEffects

Inheritance

ObjectCellEffects

Methods

BlurBackground()

Creates a blur approximation effect by averaging with adjacent cells.

Returns: CellCompute

A delegate for the blur effect.

csharp
public static CellCompute BlurBackground()

Conditional(Func<int, int, bool>, CellCompute, CellCompute)

Creates a conditional effect that applies one of two effects based on a predicate.

Parameters:

  • predicate (Func<Int32, Int32, Boolean>): A function that determines which effect to apply based on position.
  • whenTrue (CellCompute): The effect to apply when the predicate returns true.
  • whenFalse (CellCompute): The effect to apply when the predicate returns false.

Returns: CellCompute

A delegate for the conditional effect.

csharp
public static CellCompute Conditional(Func<int, int, bool> predicate, CellCompute whenTrue, CellCompute whenFalse)

Dim(float)

Creates a dim/fade effect that reduces the intensity of cells below.

Parameters:

  • amount (Single): The dim amount from 0.0 (no change) to 1.0 (fully black). Default is 0.5.

Returns: CellCompute

A delegate for the dim effect.

csharp
public static CellCompute Dim(float amount = 0.5)

DropShadow(float)

Creates a drop shadow effect that darkens the cells below.

Parameters:

  • opacity (Single): The shadow opacity from 0.0 (invisible) to 1.0 (fully opaque black). Default is 0.5.

Returns: CellCompute

A delegate for the shadow effect.

csharp
public static CellCompute DropShadow(float opacity = 0.5)

Invert()

Creates an invert effect that inverts the colors of cells below.

Returns: CellCompute

A delegate for the invert effect.

csharp
public static CellCompute Invert()

Passthrough()

Creates a passthrough effect that simply returns the cell below unchanged. Useful for testing or as a base for conditional effects.

Returns: CellCompute

A delegate that passes through cells unchanged.

csharp
public static CellCompute Passthrough()

Tint(Hex1bColor, float)

Creates a tint overlay effect that applies a color tint to cells below.

Parameters:

  • tintColor (Hex1bColor): The color to tint with.
  • opacity (Single): The tint opacity from 0.0 (invisible) to 1.0 (full tint). Default is 0.3.

Returns: CellCompute

A delegate for the tint effect.

csharp
public static CellCompute Tint(Hex1bColor tintColor, float opacity = 0.3)

Released under the MIT License.