Example usage for android.graphics Bitmap createBitmap

List of usage examples for android.graphics Bitmap createBitmap

Introduction

In this page you can find the example usage for android.graphics Bitmap createBitmap.

Prototype

public static Bitmap createBitmap(@Nullable DisplayMetrics display, @NonNull @ColorInt int colors[], int width,
        int height, @NonNull Config config) 

Source Link

Document

Returns a immutable bitmap with the specified width and height, with each pixel value set to the corresponding value in the colors array.

Usage

From source file:Main.java

private static Bitmap cropTo(Bitmap image, int height, int width) {
    return Bitmap.createBitmap(image, 0, 0, width, height);
}

From source file:Main.java

public static Bitmap testePartionBitmap(Bitmap bitmap) {

    Bitmap outroBitmap = Bitmap.createBitmap(bitmap, 10, 10, 100, 100);
    return outroBitmap;
}

From source file:Main.java

public static Bitmap cutImg(Bitmap bm, int x, int y, int newWidth, int newHeight) {
    bm = Bitmap.createBitmap(bm, x, y, newWidth, newHeight);

    return bm;/*from  ww w  .j  a v  a 2 s  .c o  m*/
}

From source file:Main.java

public static Bitmap getPartOfBitmap(Bitmap bitmap, int x, int y, int width, int height) {
    Bitmap bm = Bitmap.createBitmap(bitmap, x, y, width, height);
    return bm;/* ww  w  .  jav a2s .c  om*/
}

From source file:Main.java

public static Bitmap crop(Bitmap bitmap, int x, int y, int width, int height) {
    return Bitmap.createBitmap(bitmap, x, y, width, height);
}

From source file:Main.java

public static final Bitmap cropBitmap(Bitmap bitmap, int cropX, int cropY, int cropWidth, int cropHeight) {
    Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, cropX, cropY, cropWidth, cropHeight);
    bitmap.recycle();/*from  ww  w . ja  va  2  s .c  o  m*/
    return resizedBitmap;
}

From source file:Main.java

public static Bitmap resizeBmp(Bitmap bitmap, int requiredSizeW, int requireSizeH) {
    Bitmap outBitamp = Bitmap.createBitmap(bitmap, 0, 0, requiredSizeW, requireSizeH);
    bitmap.recycle();//from   w  w w  .j  a  v  a  2  s.  co  m
    return outBitamp;
}

From source file:Main.java

public static Bitmap getOneFrameImg(Bitmap source, int frameIndex, int totalCount) {
    int singleW = source.getWidth() / totalCount;
    return Bitmap.createBitmap(source, (frameIndex - 1) * singleW, 0, singleW, source.getHeight());
}

From source file:Main.java

public static Bitmap clearBitmap(Bitmap sourceBitmap) {
    Bitmap newBitmap = Bitmap.createBitmap(sourceBitmap, 0, 0, sourceBitmap.getWidth(),
            sourceBitmap.getHeight());//from  www .j  a  va2s . co  m
    Bitmap mutableBitmap = newBitmap.copy(Bitmap.Config.ARGB_8888, true);
    mutableBitmap.eraseColor(Color.TRANSPARENT);
    return mutableBitmap;
}

From source file:Main.java

public static Bitmap crop(Bitmap bitmap, int x, int y, int width, int height, boolean recycle)
        throws OutOfMemoryError {
    Bitmap output = Bitmap.createBitmap(bitmap, x, y, width, height);
    if (recycle && bitmap != output) {
        bitmap.recycle();/*from  w  w w. j  a v  a  2 s.c  o m*/
    }
    return output;
}