// Zoom in and out the public static bitmap zoombitmap (Bitmap bitmap, int W, int h) {int width = bitmap. getwidth (); int Height = bitmap. getheight (); matrix = new matrix (); float scalewidht = (float) W/width); float scaleheight = (float) h/height); matrix. postscale (scalewidht, scaleheight); bitmap newbmp = bitmap. createbitmap (bitmap, 0, 0, width, height, matrix, true); Return newbmp;} // converts drawable to bitmappub LIC static bitmap drawabletobitmap (drawable) {int width = drawable. getintrinsicwidth (); int Height = drawable. getintrinsicheight (); Bitmap bitmap = bitmap. createbitmap (width, height, drawable. getopacity ()! = Pixelformat. opaque? Bitmap. config. argb_8888: bitmap. config. rgb_565); canvas = new canvas (Bitmap); drawable. setbounds (0, 0, width, height); drawable. draw (canvas); Return bitmap;} // public static bitmap getroundedcornerbitmap (Bitmap bitmap, float roundpx) {bitmap output = bitmap. createbitmap (bitmap. getwidth (), bitmap. getheight (), config. argb_8888); canvas = new canvas (output); Final int color = 0xff0000242; Final paint = new paint (); Final rect = new rect (0, 0, bitmap. getwidth (), bitmap. getheight (); Final rectf = new rectf (rect); paint. setantialias (true); canvas. drawargb (0, 0, 0, 0); paint. setcolor (color); canvas. drawroundrect (rectf, roundpx, roundpx, paint); paint. setxfermode (New porterduduxfermode (mode. src_in); canvas. drawbitmap (bitmap, rect, rect, paint); Return output;} // obtain the image method with reflection public static bitmap createreflectionimagewithorigin (Bitmap bitmap) {final int reflectiongap = 4; int width = bitmap. getwidth (); int Height = bitmap. getheight (); matrix = new matrix (); matrix. prescale (1,-1); bitmap reflectionimage = bitmap. createbitmap (bitmap, 0, height/2, width, height/2, matrix, false); bitmap bitmapwithreflection = bitmap. createbitmap (width, (height + height/2), config. argb_8888); canvas = new canvas (bitmapwithreflection); canvas. drawbitmap (bitmap, 0, 0, null); paint deafalutpaint = new paint (); canvas. drawrect (0, height, width, height + reflectiongap, deafalutpaint); canvas. drawbitmap (reflectionimage, 0, height + reflectiongap, null); paint = new paint (); lineargradient shader = new lineargradient (0, bitmap. getheight (), 0, bitmapwithreflection. getheight () + reflectiongap, 0x70ffffff, 0x00ffffff, tilemode. clamp); paint. setshader (shader); // set the transfer mode to be Porter Duff and destination inpaint. setxfermode (New porterduduxfermode (mode. dst_in); // draw a rectangle using the paint with our linear gradientcanvas. drawrect (0, height, width, bitmapwithreflection. getheight () + reflectiongap, paint); Return bitmapwithreflection ;}