title: Clip round from image using xfermode in android
body: <p>I need to create a rounded <code>ImageView</code> in Android. Now I use <code>Canvas.clipPath()</code> but hardware acceleration isn't supported by it. Of course I use <code>View.LAYER_TYPE_SOFTWARE</code> for this view.</p>
  
  <pre><code>public class RoundedCornerImageView extends MaptrixImageView
  {   
      private final Path clipPath = new Path();
  
      public RoundedCornerImageView(Context context)
      {
          this(context, null);
      }
  
      @SuppressLint("NewApi")
      public RoundedCornerImageView(Context context, AttributeSet attrs)
      {
          super(context, attrs);
  
          if (Build.VERSION.SDK_INT &gt;= 11) {
                 setLayerType(View.LAYER_TYPE_SOFTWARE, null);
          }
      }
  
      @Override
      protected void onDraw(Canvas canvas) 
      {   
          float radius = ((float) getWidth()) / 2;
  
          clipPath.reset();
          clipPath.addCircle(radius, radius, radius, Path.Direction.CW);
  
          canvas.clipPath(clipPath);
          super.onDraw(canvas);
      }
  }
  </code></pre>
  
  <p>But I would like use hardware acceleration with this View. Can I use the <code>XferMode</code> class for this <code>ImageView</code>?</p>