Interface Shader

All Superinterfaces:
RefCounted
All Known Implementing Classes:
AngularGradient, BilinearGradient, BlendShader, Color4fShader, ColorShader, EmptyShader, Gradient1DShader, Gradient2DShader, GradientShader, ImageShader, LinearGradient, LocalMatrixShader, RadialGradient

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

    Fields
    Modifier and Type
    Field
    Description
    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 Type
    Method
    Description
    default boolean
    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.
    Return a shader that will apply the specified localMatrix to this shader.

    Methods inherited from interface icyllis.arc3d.core.RefCounted

    ref, unref
  • Field Details

    • TILE_MODE_REPEAT

      static final int TILE_MODE_REPEAT
      Repeat the shader's image horizontally and vertically.
      See Also:
    • TILE_MODE_MIRROR

      static final int TILE_MODE_MIRROR
      Repeat 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_CLAMP
      Replicate the edge color if the shader draws outside of its original bounds.
      See Also:
    • TILE_MODE_DECAL

      static final int TILE_MODE_DECAL
      Only draw within the original domain, return transparent-black everywhere else.
      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

      @Nonnull @SharedPtr default @SharedPtr Shader makeWithLocalMatrix(@Nonnull Matrixc localMatrix)
      Return a shader that will apply the specified localMatrix to this shader. The specified matrix will be applied AFTER any matrix associated with this shader.