title: Android picasso image's edge is cut after transform
body: <p>I am using Picasso to transform an image into a rounded square image.
  It also has the border. But when I put this image to Imageview, it's edge is cut. Any solution for this? Android version is 4.4.2.</p>
  
  <p>My Imageview looks like this.</p>
  
  <pre><code>&lt;ImageView
          android:id="@+id/imageview_picture"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginLeft="@dimen/edge_margin"
          android:layout_marginRight="@dimen/edge_margin"
          android:adjustViewBounds="true" /&gt;
  </code></pre>
  
  <p>Below is code.</p>
  
  <pre><code>@Override public Bitmap transform(Bitmap source) {
      int ratio = source.getWidth() / mDisplayWidth;
      float strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, Constants.SHAPE_STROKE_WIDTH, mDisplayMetrics) * ratio;
      float radius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, Constants.SQUARE_RADIUS, mDisplayMetrics) * ratio;
  
      int x = (int) (mRectF.left * ratio);
      int y = (int) (mRectF.top * ratio);
      int width = (int) ((mRectF.right - mRectF.left) * ratio);
      int height = (int) ((mRectF.bottom - mRectF.top) * ratio);
  
      Bitmap bitmap = Bitmap.createBitmap(source, x, y, width, height);
  
      source.recycle();
  
      return getRoundedCornerBitmap(bitmap, radius, strokeWidth);
  }
  
  @Override public String key() {
      return "card_square";
  }
  
  private Bitmap getRoundedCornerBitmap(Bitmap bitmap, int color, float cornerSizePx, float borderSizePx) {
      Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(),
              Bitmap.Config.ARGB_8888);
      Canvas canvas = new Canvas(output);
  
      final Paint paint = new Paint();
      final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
      final RectF rectF = new RectF(rect);
  
      // prepare canvas for transfer
      paint.setAntiAlias(true);
      paint.setColor(0xFFFFFFFF);
      paint.setStyle(Paint.Style.FILL);
      canvas.drawARGB(0, 0, 0, 0);
      canvas.drawRoundRect(rectF, cornerSizePx, cornerSizePx, paint);
  
      // draw bitmap
      paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
      canvas.drawBitmap(bitmap, rect, rect, paint);
  
      bitmap.recycle();
  
      // draw border
      paint.setColor(color);
      paint.setStyle(Paint.Style.STROKE);
      paint.setStrokeWidth(borderSizePx);
      canvas.drawRoundRect(rectF, cornerSizePx, cornerSizePx, paint);
  
      return output;
  }`
  </code></pre>