BrushBehavior


public final class BrushBehavior


A behavior describing how stroke input properties should affect the shape and color of the brush tip.

The behavior is conceptually a tree made from the various node types defined below. Each edge of the tree graph represents passing a nullable finite floating point value (with "null" representing an undefined value) from a node to its parent, and each node in the tree fits into one of the following categories:

  1. Leaf nodes generate an output value without graph inputs. For example, they can create a value from properties of stroke input.

  2. Filter nodes can conditionally toggle branches of the graph "on" by outputting their input value, or "off" by outputting a null value.

  3. Operator nodes take in one or more input values and generate an output. For example, by mapping input to output with an easing function.

  4. Terminal nodes apply one or more input values to chosen properties of the brush tip.

For each input in a stroke, BrushTip.behaviors are applied as follows:

  1. The actual target modifier (as calculated above) for each tip property is accumulated from every BrushBehavior present on the current BrushTip. Multiple behaviors can affect the same Target. Depending on the Target, modifiers from multiple behaviors will stack either additively or multiplicatively, according to the documentation for that Target. Regardless, the order of specified behaviors does not affect the result.

  2. The modifiers are applied to the shape and color shift values of the tip's state according to the documentation for each Target. The resulting tip property values are then clamped or normalized to within their valid range of values. E.g. the final value of BrushTip.cornerRounding will be clamped within 0, 1. Generally: The affected shape values are those found in BrushTip members. The color shift values remain in the range -100% to +100%. Note that when stored on a vertex, the color shift is encoded such that each channel is in the range 0, 1, where 0.5 represents a 0% shift.

Note that the accumulated tip shape property modifiers may be adjusted by the implementation before being applied: The rates of change of shape properties may be constrained to keep them from changing too rapidly with respect to distance traveled from one input to the next.

Summary

Public constructors

BrushBehavior(
    @NonNull TerminalNode terminalNode,
    @NonNull String developerComment
)

Constructs a BrushBehavior with a single TerminalNode.

BrushBehavior(
    @NonNull List<@NonNull TerminalNode> terminalNodes,
    @NonNull String developerComment
)

Constructs a BrushBehavior with a list of TerminalNodes.

Public methods

boolean
equals(Object other)
final @NonNull List<@NonNull TerminalNode>

An immutable list of the targets that this BrushBehavior affects.

int
@NonNull String

Public constructors

BrushBehavior

Added in 1.1.0-alpha03
public BrushBehavior(
    @NonNull TerminalNode terminalNode,
    @NonNull String developerComment
)

Constructs a BrushBehavior with a single TerminalNode.

BrushBehavior

public BrushBehavior(
    @NonNull List<@NonNull TerminalNode> terminalNodes,
    @NonNull String developerComment
)

Constructs a BrushBehavior with a list of TerminalNodes.

Public methods

equals

public boolean equals(Object other)

getTerminalNodes

Added in 1.1.0-alpha03
public final @NonNull List<@NonNull TerminalNodegetTerminalNodes()

An immutable list of the targets that this BrushBehavior affects.

hashCode

public int hashCode()

toString

public @NonNull String toString()