Code example for BitmapShader

0
 
  @Override 
  public Pattern createPattern(Image img) { 
    Asserts.checkArgument(img instanceof AndroidImage); 
    Bitmap bitmap = ((AndroidImage) img).getBitmap(); 
    BitmapShader shader = new BitmapShader(bitmap, TileMode.REPEAT, TileMode.REPEAT); 
    return new AndroidPattern(shader); 
  } 
 
  @Override 
  public Gradient createRadialGradient(float x, float y, float r, int[] colors, float[] positions) { 
    RadialGradient gradient = new RadialGradient(x, y, r, colors, positions, TileMode.CLAMP); 
    return new AndroidGradient(gradient); 
  } 
 
  @Override 
  public int screenHeight() { 
    return displayMetrics.heightPixels; 
  } 
 
  @Override