Code example for Matrix

Methods: isIdentity

0
  @Override 
  protected void dispatchDraw(Canvas canvas) {
    final int saveCount = canvas.save();
 
    final Matrix m = mController.getEffectsMatrix();
    if (!m.isIdentity())
      canvas.concat(m);
 
    final float alpha = mController.getEffectsAlpha();
    if (alpha != 1f)
      canvas.saveLayerAlpha(0, 0, canvas.getWidth(), canvas.getHeight(), (int)(255 * alpha), Canvas.HAS_ALPHA_LAYER_SAVE_FLAG);
 
    super.dispatchDraw(canvas);
 
    final int fadeFactor = mController.getFadeFactor();
    if (fadeFactor > 0f) {
      mFadePaint.setColor(Color.argb(fadeFactor, 0, 0, 0));
      canvas.drawRect(0, 0, getWidth(), getHeight(), mFadePaint);
    } 
 
    canvas.restoreToCount(saveCount);