Android Bitmap Color Change initBitmapFactoryOptions( BitmapFactory.Options bitmapOptions, int maxWidth, int maxHeight)

Here you can find the source of initBitmapFactoryOptions( BitmapFactory.Options bitmapOptions, int maxWidth, int maxHeight)

Description

init Bitmap Factory Options

Parameter

Parameter Description
bitmapOptions bitmap options
maxWidth max width
maxHeight max height

Return

true if success

Declaration

public static boolean initBitmapFactoryOptions(
        BitmapFactory.Options bitmapOptions, int maxWidth, int maxHeight) 

Method Source Code

//package com.java2s;

import android.graphics.BitmapFactory;

public class Main {
    /**//ww  w  . j a  v a  2 s. c o  m
     * @param bitmapOptions bitmap options
     * @param maxWidth      max width
     * @param maxHeight     max height
     * @return true if success
     */
    public static boolean initBitmapFactoryOptions(
            BitmapFactory.Options bitmapOptions, int maxWidth, int maxHeight) {
        if (bitmapOptions.inJustDecodeBounds && bitmapOptions.outHeight > 0
                && bitmapOptions.outWidth > 0) {
            if (bitmapOptions.outWidth > (maxWidth << 1)
                    || bitmapOptions.outHeight > (maxHeight << 1)) {
                bitmapOptions.inSampleSize = Math.max(
                        bitmapOptions.outWidth / maxWidth,
                        bitmapOptions.outHeight / maxHeight);
            }
            bitmapOptions.inJustDecodeBounds = false;
            return true;
        }
        return false;
    }
}

Related

  1. doBrightness(Bitmap src, int value)
  2. erosion(Bitmap bitmap, int[][] se)
  3. getGrayscaleHistogram(Bitmap bm)
  4. increaseGreen(Bitmap src, int value)
  5. initAlphaChannel( BitmapFactory.Options bitmapOptions)
  6. makeSaturated(Bitmap source, int level)
  7. makeVivid(Bitmap src, int type, float percent)
  8. setAlpha(Bitmap sourceImg, int number)
  9. setAlpha(Bitmap sourceImg, int number)