Code example for Paint

Methods: setColor, setMaskFilter, setStrokeWidth, setStyle

0
 
  private float centerX;
  private float centerY;
 
  private final Paint basePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  private final Paint shadePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
 
  public LightIconDrawable(float topOffset, float rightOffset,
                           int lightColor, int darkColor, int shadeColor, float radius) {
    this.topOffset = topOffset;
    this.rightOffset = rightOffset;
    this.lightColor = lightColor;
    this.darkColor = darkColor;
    this.radius = radius;
 
    if (lightColor == darkColor) {
      basePaint.setColor(lightColor);
    } 
 
    shadePaint.setStyle(Style.STROKE);
    shadePaint.setStrokeWidth(1);
    shadePaint.setMaskFilter(new BlurMaskFilter(2, Blur.INNER));
    shadePaint.setColor(shadeColor);
  } 
 
  /* (non-Javadoc) 
   * @see android.graphics.drawable.Drawable#draw(android.graphics.Canvas) 
   */