/** <Br/> * [Image Scaling] <br> <br/> * [function description] <br/> * @ Param bitmaporg <br/> * @ Param dstw <br/> * @ Param d...... <br/> * @ return <br/> */<br/> Public static bitmap resizeimage (Bitmap bitmaporg, int dstw, int d......) <br/>{</P> <p> bitmap resizedbitmap; <br/> int srcw = bitmaporg. getwidth (); <br/> int srch = bitmaporg. getheight (); </P> <p> // If the length and width are smaller than the generated target image, directly return the image <br/> If (srcw <= dstw & srch <= dsomething) <br/>{</P> <p> return bitmaporg; <br/>}< br/> // else if (srcw> dstw & srch <DTH) <br/> // {<br/> // resizedbitmap <br/> //} </P> <p> float scalewidth = (float) dstw)/srcw; <br/> float scaleheight = (float) d......)/srch; </P> <p> // create a matrix for the manipulation <br/> matrix = new matrix (); <br/> // resize the bitmap <br/> matrix. postscale (scalewidth, scaleheight); <br/> // If You Want to rotate the bitmap <br/> // matrix. postrotate (45); </P> <p> // recreate the new bitmap <br/> resizedbitmap = bitmap. createbitmap (bitmaporg, 0, 0, srcw, srch, <br/> matrix, true); <br/> bitmaporg. recycle (); <br/> // make a drawable from Bitmap to allow to set the bitmap <br/> // to the imageview, imagebutton or what ever <br/> return resizedbitmap; </P> <p >}</P> <p>/** <br/> * [Image rounded corner processing] <br> <br/> * [function description] <br/> * @ Param bitmap <br/> * @ Param roundpx <br/> * @ return <br/> */ <br/> Public static bitmap getrcb (Bitmap bitmap, float roundpx) // rcb means rounded corner bitmap <br/>{< br/> bitmap dstbmp = bitmap. createbitmap (bitmap. getwidth (), <br/> bitmap. getheight (), config. argb_8888); <br/> canvas = new canvas (dstbmp); </P> <p> final int color = 0xff0000242; <br/> final paint = new paint (); <br/> final rect = new rect (0, 0, bitmap. getwidth (), bitmap. getheight (); <br/> final rectf = new rectf (rect); <br/> paint. setantialias (true); <br/> canvas. drawargb (0, 0, 0, 0); <br/> paint. setcolor (color); <br/> canvas. drawroundrect (rectf, roundpx, roundpx, paint); <br/> paint. setxfermode (New porterduduxfermode (mode. src_in); <br/> canvas. drawbitmap (bitmap, rect, rect, paint); </P> <p> return dstbmp; <br/>}