How to Bitmap scalling and cropping from center? public class ScalingUtilities { /** * Utility function for decoding an image resource. The decoded bitmap will * be optimized for further scaling to the requested destination dimensions * and scaling logic. * * @param res * The resources object containing the image data * @param resId * The resource id of the image data * @param dstWidth * Width of destination area * @param dstHeight * Height of destination area * @param scalingLogic * Logic to use to avoid image stretching * @return Decoded bitmap */ public static Bitmap decodeResource(Resources res, int resId, int dstWidth, int dstHeight, ScalingLogic scalingLogic) { Options options = new Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(res, resId, options);
Comments
Post a Comment