title: Android canvas add stroke and elevation
body: <p>I am creating a thumbnail from a large image via canvas to use it as marker in google map and how can i add a border (stroke) of 2 dp and also light elevation in my thumbnail</p>
  <p><strong>Canvas function</strong></p>
  <pre><code>public static  Bitmap getCroppedBitmap(Bitmap bitmap) {
          Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
                  bitmap.getHeight(), Bitmap.Config.ARGB_8888);
          Canvas canvas = new Canvas(output);
  
          final int color = 0xff424242;
          final Paint paint = new Paint();
          final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
  
          paint.setAntiAlias(true);
          canvas.drawARGB(0, 0, 0, 0);
          paint.setColor(color);
          canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2,
                  bitmap.getWidth() / 2, paint);
          paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
  
          canvas.drawBitmap(bitmap, rect, rect, paint);
  
          return output;
      }
  </code></pre>