Show / Hide Table of Contents

Class Algorithms

Provides a few minor helper methods related to filling.

Inheritance
object
Algorithms
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole
Assembly: SadConsole.dll
Syntax
public static class Algorithms

Methods

FloodFill<TNode>(TNode, Func<TNode, bool>, Action<TNode>, Func<TNode, NodeConnections<TNode>>)

A very slow 4-way fill algorithm to change items from one type to another.

Declaration
public static void FloodFill<TNode>(TNode node, Func<TNode, bool> shouldNodeChange, Action<TNode> changeNode, Func<TNode, Algorithms.NodeConnections<TNode>> getNodeConnections)
Parameters
Type Name Description
TNode node

The item to change.

Func<TNode, bool> shouldNodeChange

Determines if the node should change.

Action<TNode> changeNode

After it is determined if the node should change, this changes the node.

Func<TNode, Algorithms.NodeConnections<TNode>> getNodeConnections

Gets any other nodes connected to this node.

Type Parameters
Name Description
TNode

The item type that is changed.

GradientFill(Point, Point, int, int, Rectangle, Gradient, Action<int, int, Color>)

Processes an area and applies a gradient calculation to each part of the area.

Declaration
public static void GradientFill(Point cellSize, Point position, int strength, int angle, Rectangle area, Gradient gradient, Action<int, int, Color> applyAction)
Parameters
Type Name Description
Point cellSize

The size of an individual cell. Makes the angle uniform.

Point position

The center of the gradient.

int strength

The width of the gradient spread.

int angle

The angle to apply the gradient.

Rectangle area

The area to calculate.

Gradient gradient

The color gradient to fill with.

Action<int, int, Color> applyAction

The callback called for each part of the area.

In this article

Back to top

Back to top Generated by DocFX