涉及到像素点的循环中,避免废操作

        public static Bitmap getTransparentBitmap(Bitmap sourceImg, int number){  
            int[] argb = new int[sourceImg.getWidth() * sourceImg.getHeight()];  
            sourceImg.getPixels(argb, 0, sourceImg.getWidth(), 0, 0, sourceImg  
                    .getWidth(), sourceImg.getHeight());
            number = number * 255 / 100;
            for (int i = 0; i < argb.length; i++) {  
            Log.d("mm", "------------");    
                argb[i] = (number << 24) | (argb[i] & 0x00FFFFFF);  
            }
            sourceImg = Bitmap.createBitmap(argb, sourceImg.getWidth(), sourceImg   
                    .getHeight(), Config.ARGB_8888);  
            return sourceImg;  
        }

上面这段代码中,涉及到像素点的循环,仅仅加了一行log,时长就增加了3个数量级。

原文地址:https://www.cnblogs.com/fordreamxin/p/4902750.html