Class Shader

java.lang.Object
icyllis.modernui.graphics.Shader
Direct Known Subclasses:
ComposeShader, GradientShader, ImageShader

public abstract class Shader extends Object
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. image 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.

All subclasses are required to be reentrant-safe : it must be legal to share the same instance between several threads.

Since:
3.11
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Tile modes, also known as address modes and wrap modes.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Perform a deferred cleanup if the underlying resource is not released.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Shader

      public Shader()
  • Method Details

    • release

      public void release()
      Perform a deferred cleanup if the underlying resource is not released. Manually mark the underlying resources closed, if needed. After this operation, this shader represents a no-op, and its GPU resource will be reclaimed as soon as possible after use.

      This will not affect shaders already installed on the Paint, until the Paint is reset or closed.

      When this object becomes phantom-reachable, the system will automatically do this cleanup operation.