Package icyllis.arc3d.sketch.shaders
Interface Shader
- All Superinterfaces:
RefCounted
- All Known Implementing Classes:
AngularGradient
,BilinearGradient
,BlendShader
,ColorShader
,EmptyShader
,Gradient1DShader
,Gradient2DShader
,GradientShader
,ImageShader
,LinearGradient
,LocalMatrixShader
,RadialGradient
,RRectShader
public sealed interface Shader
extends RefCounted
permits BlendShader, ColorShader, EmptyShader, GradientShader, ImageShader, LocalMatrixShader, RRectShader
Shaders specify the source color(s) for what is being drawn. If a paint
has no shader, then the paint's color is used. If the paint has a
shader, then the shader's color(s) are use instead, but they are
modulated by the paint's alpha. This makes it easy to create a shader
once (e.g. bitmap tiling or gradient) and then change its transparency
w/o having to modify the original shader... only the paint's alpha needs
to be modified.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Accepted bymakeWithLocalMatrix(Matrixc, int)
, whether the specified matrix will be applied AFTER or BEFORE any matrix associated with this shader, or replace the matrix associated with this shader with the specified matrix.static final int
Accepted bymakeWithLocalMatrix(Matrixc, int)
, whether the specified matrix will be applied AFTER or BEFORE any matrix associated with this shader, or replace the matrix associated with this shader with the specified matrix.static final int
Accepted bymakeWithLocalMatrix(Matrixc, int)
, whether the specified matrix will be applied AFTER or BEFORE any matrix associated with this shader, or replace the matrix associated with this shader with the specified matrix.static final int
Replicate the edge color if the shader draws outside of its original bounds.static final int
Only draw within the original domain, return transparent-black everywhere else.static final int
Repeat the shader's image horizontally and vertically, alternating mirror images so that adjacent images always seam.static final int
Repeat the shader's image horizontally and vertically. -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
isOpaque()
Returns true if the shader is guaranteed to produce only opaque colors, subject to the Paint using the shader to apply an opaque alpha value.default boolean
A return value of true means that its ref/unref is unnecessary, for example, they are just no op.default @NonNull @SharedPtr Shader
makeWithLocalMatrix
(@NonNull Matrixc localMatrix, int mode) Creates a new shader that will apply the specified localMatrix to this shader.default void
ref()
Increases the reference count by 1.default void
unref()
Decreases the reference count by 1.
-
Field Details
-
TILE_MODE_REPEAT
static final int TILE_MODE_REPEATRepeat the shader's image horizontally and vertically.- See Also:
-
TILE_MODE_MIRROR
static final int TILE_MODE_MIRRORRepeat the shader's image horizontally and vertically, alternating mirror images so that adjacent images always seam.- See Also:
-
TILE_MODE_CLAMP
static final int TILE_MODE_CLAMPReplicate the edge color if the shader draws outside of its original bounds.- See Also:
-
TILE_MODE_DECAL
static final int TILE_MODE_DECALOnly draw within the original domain, return transparent-black everywhere else.- See Also:
-
LOCAL_MATRIX_AFTER
static final int LOCAL_MATRIX_AFTERAccepted bymakeWithLocalMatrix(Matrixc, int)
, whether the specified matrix will be applied AFTER or BEFORE any matrix associated with this shader, or replace the matrix associated with this shader with the specified matrix.- See Also:
-
LOCAL_MATRIX_BEFORE
static final int LOCAL_MATRIX_BEFOREAccepted bymakeWithLocalMatrix(Matrixc, int)
, whether the specified matrix will be applied AFTER or BEFORE any matrix associated with this shader, or replace the matrix associated with this shader with the specified matrix.- See Also:
-
LOCAL_MATRIX_REPLACE
static final int LOCAL_MATRIX_REPLACEAccepted bymakeWithLocalMatrix(Matrixc, int)
, whether the specified matrix will be applied AFTER or BEFORE any matrix associated with this shader, or replace the matrix associated with this shader with the specified matrix.- See Also:
-
-
Method Details
-
isOpaque
default boolean isOpaque()Returns true if the shader is guaranteed to produce only opaque colors, subject to the Paint using the shader to apply an opaque alpha value. Subclasses should override this to allow some optimizations. -
makeWithLocalMatrix
@SharedPtr default @NonNull @SharedPtr Shader makeWithLocalMatrix(@NonNull Matrixc localMatrix, int mode) Creates a new shader that will apply the specified localMatrix to this shader. -
ref
default void ref()Description copied from interface:RefCounted
Increases the reference count by 1.- Specified by:
ref
in interfaceRefCounted
-
unref
default void unref()Description copied from interface:RefCounted
Decreases the reference count by 1.- Specified by:
unref
in interfaceRefCounted
-
isTriviallyCounted
default boolean isTriviallyCounted()A return value of true means that its ref/unref is unnecessary, for example, they are just no op. So callers can perform some optimizations. Subclass can override this method to indicate that an instance is trivially counted. For the same instance, the return value of this method must remain unchanged.
-