Code example for Matrix

Methods: createBitmappostScalepostTranslatesetRotate

            try { 
                Bitmap b2 = Bitmap.createBitmap(
                        b, 0, 0, b.getWidth(), b.getHeight(), m, true);
                if (b != b2) {
                    b = b2;
            } catch (OutOfMemoryError ex) {
                // We have no memory to rotate. Return the original bitmap. 
        return b;
     * Compute the sample size as a function of minSideLength 
     * and maxNumOfPixels. 
     * minSideLength is used to specify that minimal width or height of a 
     * bitmap. 
     * maxNumOfPixels is used to specify the maximal size in pixels that is 
     * tolerable in terms of memory usage. 
     * The function returns a sample size based on the constraints. 
     * Both size and minSideLength can be passed in as IImage.UNCONSTRAINED, 
     * which indicates no care of the corresponding constraint. 
     * The functions prefers returning a sample size that 
     * generates a smaller bitmap, unless minSideLength = IImage.UNCONSTRAINED. 
Experience pair programming with AI  Get Codota for Java