android Programming Glossary: croppedimage
Crop-to-fit image in Android http://stackoverflow.com/questions/5226922/crop-to-fit-image-in-android answer from Android Gallery source code here at line 230 D croppedImage Bitmap.createBitmap mOutputX mOutputY Bitmap.Config.RGB_565.. mOutputY Bitmap.Config.RGB_565 Canvas canvas new Canvas croppedImage Rect srcRect mCrop.getCropRect Rect dstRect new Rect 0 0 mOutputX..
How to crop image in android http://stackoverflow.com/questions/6464123/how-to-crop-image-in-android want alpha channel which is the third param here. Bitmap croppedImage Bitmap.createBitmap width height mCircleCrop Bitmap.Config.ARGB_8888.. Bitmap.Config.RGB_565 Canvas canvas new Canvas croppedImage RectF dstRect new RectF 0 0 width height canvas.drawBitmap mBitmap.. the all important PortDuff.Mode.CLEAR. Canvas c new Canvas croppedImage Path p new Path p.addCircle width 2F height 2F width 2F Path.Direction.CW..
Crop-to-fit image in Android http://stackoverflow.com/questions/5226922/crop-to-fit-image-in-android improve this question Thanks to open source I found the answer from Android Gallery source code here at line 230 D croppedImage Bitmap.createBitmap mOutputX mOutputY Bitmap.Config.RGB_565 Canvas canvas new Canvas croppedImage Rect srcRect mCrop.getCropRect.. here at line 230 D croppedImage Bitmap.createBitmap mOutputX mOutputY Bitmap.Config.RGB_565 Canvas canvas new Canvas croppedImage Rect srcRect mCrop.getCropRect Rect dstRect new Rect 0 0 mOutputX mOutputY int dx srcRect.width dstRect.width 2 int dy srcRect.height..
How to crop image in android http://stackoverflow.com/questions/6464123/how-to-crop-image-in-android r.width int height int r.height If we are circle cropping we want alpha channel which is the third param here. Bitmap croppedImage Bitmap.createBitmap width height mCircleCrop Bitmap.Config.ARGB_8888 Bitmap.Config.RGB_565 Canvas canvas new Canvas croppedImage.. Bitmap.createBitmap width height mCircleCrop Bitmap.Config.ARGB_8888 Bitmap.Config.RGB_565 Canvas canvas new Canvas croppedImage RectF dstRect new RectF 0 0 width height canvas.drawBitmap mBitmap r dstRect null canvas.drawOval dstRect null canvas.drawBitmap.. So we fill in the area around the circle with alpha. Note the all important PortDuff.Mode.CLEAR. Canvas c new Canvas croppedImage Path p new Path p.addCircle width 2F height 2F width 2F Path.Direction.CW c.clipPath p Region.Op.DIFFERENCE c.drawColor..
|