BrushPaint.StampingTexture


public final class BrushPaint.StampingTexture extends BrushPaint.TextureLayer


A texture that is "stamped" onto each particle of the stroke, scaled or rotated appropriately to cover the whole particle.

Summary

Nested types

Builder for StampingTexture.

Public constructors

StampingTexture(
    @NonNull String clientTextureId,
    @NonNull BrushPaint.TextureLayer.BlendMode blendMode
)

Creates a new StampingTexture with the specified parameters.

StampingTexture(
    @NonNull String clientTextureId,
    @NonNull BrushPaint.TextureLayer.BlendMode blendMode,
    @IntRange(from = 1, to = 16777216) int animationFrames,
    @IntRange(from = 1, to = 4096) int animationRows,
    @IntRange(from = 1, to = 4096) int animationColumns,
    @IntRange(from = 0, to = 16777216) long animationDurationMillis,
    @NonNull BrushPaint.AnimationRepeatMode animationRepeatMode
)

Creates a new StampingTexture with the specified parameters.

Public methods

static final @NonNull BrushPaint.StampingTexture.Builder

Returns a new StampingTexture.Builder.

final @NonNull BrushPaint.StampingTexture
copy(
    @NonNull String clientTextureId,
    @NonNull BrushPaint.TextureLayer.BlendMode blendMode
)

Creates a copy of this and allows named properties to be altered while keeping the rest unchanged.

final @NonNull BrushPaint.StampingTexture
copy(
    @NonNull String clientTextureId,
    @NonNull BrushPaint.TextureLayer.BlendMode blendMode,
    @IntRange(from = 1, to = 16777216) int animationFrames,
    @IntRange(from = 1, to = 4096) int animationRows,
    @IntRange(from = 1, to = 4096) int animationColumns,
    @IntRange(from = 0, to = 16777216) long animationDurationMillis,
    @NonNull BrushPaint.AnimationRepeatMode animationRepeatMode
)

Creates a copy of this and allows named properties to be altered while keeping the rest unchanged.

boolean
equals(Object other)
final @IntRange(from = 1, to = 4096) int
final @IntRange(from = 0, to = 16777216) long
final @IntRange(from = 1, to = 16777216) int
final @NonNull BrushPaint.AnimationRepeatMode
final @IntRange(from = 1, to = 4096) int
final @NonNull String

The client texture ID for this texture layer.

int
final @NonNull BrushPaint.StampingTexture.Builder

Returns a Builder with values set equivalent to this.

@NonNull String

Inherited methods

From androidx.ink.brush.BrushPaint.TextureLayer
final @NonNull Version

Returns the minimum required Version for this TextureLayer.

final @NonNull BrushPaint.TextureLayer.BlendMode

The rule by which the texture layers up to and including this one are combined with the subsequent layer.

Public constructors

StampingTexture

Added in 1.1.0-alpha11
public StampingTexture(
    @NonNull String clientTextureId,
    @NonNull BrushPaint.TextureLayer.BlendMode blendMode
)

Creates a new StampingTexture with the specified parameters.

Parameters
@NonNull String clientTextureId

A string identifier of an image that provides the color for a particular pixel for this layer. The coordinates within this image that will be used are determined by the other parameters.

@NonNull BrushPaint.TextureLayer.BlendMode blendMode

The method by which the texture layers up to this one (index <= i) are combined with the subsequent texture layer (index == i+1). For the last texture layer, this defines the method by which the texture layer is combined with the brush color (possibly after that color gets per-vertex adjustments).

StampingTexture

Added in 1.1.0-alpha11
public StampingTexture(
    @NonNull String clientTextureId,
    @NonNull BrushPaint.TextureLayer.BlendMode blendMode,
    @IntRange(from = 1, to = 16777216) int animationFrames,
    @IntRange(from = 1, to = 4096) int animationRows,
    @IntRange(from = 1, to = 4096) int animationColumns,
    @IntRange(from = 0, to = 16777216) long animationDurationMillis,
    @NonNull BrushPaint.AnimationRepeatMode animationRepeatMode
)

Creates a new StampingTexture with the specified parameters.

Java callers should use the Builder class instead.

Parameters
@NonNull String clientTextureId

A string identifier of an image that provides the color for a particular pixel for this layer. The coordinates within this image that will be used are determined by the other parameters.

@NonNull BrushPaint.TextureLayer.BlendMode blendMode

The method by which the texture layers up to this one (index <= i) are combined with the subsequent texture layer (index == i+1). For the last texture layer, this defines the method by which the texture layer is combined with the brush color (possibly after that color gets per-vertex adjustments).

@IntRange(from = 1, to = 16777216) int animationFrames

The number of animation frames in this texture, or 1 for no animation. If greater than 1, then the texture image is treated as a grid of animation frame images, with dimensions of animationRows by animationColumns frames. The frames will be indexed in row-major order, where row=0 and column=0 is frame index 0, then row=0 and column=1 is frame index 1, and so on. animationFrames must be at most the product of animationRows and animationColumns, and there may be unused frame cells in the final row.

@IntRange(from = 1, to = 4096) int animationRows

The number of frame rows in this texture. See animationFrames for more detail. When constructing an animation texture image, avoid making it too large in any one dimension by choosing values for animationRows and animationColumns that are close to each other, but just large enough such that animationFrames<= animationRows * animationColumns.

@IntRange(from = 1, to = 4096) int animationColumns

Like animationRows, but for columns.

@IntRange(from = 0, to = 16777216) long animationDurationMillis

The duration of one complete animation loop for this texture (either passing through each frame once if animationRepeatMode is AnimationRepeatMode.RESTART, or passing back and forth through each frame if animationRepeatMode is AnimationRepeatMode.REVERSE), or zero to disable automatic looping animations (in which case the current animation frame will be controlled solely by any androidx.ink.brush.behavior.TargetNode.Target.PAINT_ANIMATION_PROGRESS_OFFSET behavior targets). Must be between 0 and 2^24 (inclusive). Ignored if animationFrames is 1 (its default value), because that indicates that animation is disabled.

@NonNull BrushPaint.AnimationRepeatMode animationRepeatMode

Specifies what should happen when the animation reaches the last frame: either it can immediately restart back at the first frame, or it can reverse direction. Ignored if animationFrames is 1 (its default value), because that indicates that animation is disabled.

Public methods

builder

Added in 1.1.0-alpha11
public static final @NonNull BrushPaint.StampingTexture.Builder builder()

Returns a new StampingTexture.Builder.

copy

Added in 1.1.0-alpha11
public final @NonNull BrushPaint.StampingTexture copy(
    @NonNull String clientTextureId,
    @NonNull BrushPaint.TextureLayer.BlendMode blendMode
)

Creates a copy of this and allows named properties to be altered while keeping the rest unchanged.

Java callers should use Builder instead.

copy

Added in 1.1.0-alpha11
public final @NonNull BrushPaint.StampingTexture copy(
    @NonNull String clientTextureId,
    @NonNull BrushPaint.TextureLayer.BlendMode blendMode,
    @IntRange(from = 1, to = 16777216) int animationFrames,
    @IntRange(from = 1, to = 4096) int animationRows,
    @IntRange(from = 1, to = 4096) int animationColumns,
    @IntRange(from = 0, to = 16777216) long animationDurationMillis,
    @NonNull BrushPaint.AnimationRepeatMode animationRepeatMode
)

Creates a copy of this and allows named properties to be altered while keeping the rest unchanged.

Java callers should use Builder instead.

equals

public boolean equals(Object other)

getAnimationColumns

Added in 1.1.0-alpha11
public final @IntRange(from = 1, to = 4096) int getAnimationColumns()

getAnimationDurationMillis

Added in 1.1.0-alpha11
public final @IntRange(from = 0, to = 16777216) long getAnimationDurationMillis()

getAnimationFrames

Added in 1.1.0-alpha11
public final @IntRange(from = 1, to = 16777216) int getAnimationFrames()

getAnimationRepeatMode

Added in 1.1.0-alpha11
public final @NonNull BrushPaint.AnimationRepeatMode getAnimationRepeatMode()

getAnimationRows

Added in 1.1.0-alpha11
public final @IntRange(from = 1, to = 4096) int getAnimationRows()

getClientTextureId

Added in 1.1.0-alpha11
public final @NonNull String getClientTextureId()

The client texture ID for this texture layer.

hashCode

public int hashCode()

toBuilder

Added in 1.1.0-alpha11
public final @NonNull BrushPaint.StampingTexture.Builder toBuilder()

Returns a Builder with values set equivalent to this. Java developers, use the returned builder to build a copy of a StampingTexture. Kotlin developers, see copy method.

toString

public @NonNull String toString()