Example usage for android.graphics ImageFormat RGB_565

List of usage examples for android.graphics ImageFormat RGB_565

Introduction

In this page you can find the example usage for android.graphics ImageFormat RGB_565.

Prototype

int RGB_565

To view the source code for android.graphics ImageFormat RGB_565.

Click Source Link

Document

RGB format used for pictures encoded as RGB_565.

Usage

From source file:Main.java

public static String translatePreviewFormat(int supportedPreviewFormat) {
    switch (supportedPreviewFormat) {
    case ImageFormat.JPEG:
        return "ImageFormat.JPEG";
    case ImageFormat.NV16:
        return "ImageFormat.NV16";
    case ImageFormat.NV21:
        return "ImageFormat.NV21";
    case ImageFormat.RAW10:
        return "ImageFormat.RAW10";
    case ImageFormat.RAW_SENSOR:
        return "ImageFormat.RAW_SENSOR";
    case ImageFormat.RGB_565:
        return "ImageFormat.RGB_565";
    case ImageFormat.UNKNOWN:
        return "ImageFormat.UNKNOWN";
    case ImageFormat.YUV_420_888:
        return "ImageFormat.YUV_420_888";
    case ImageFormat.YUY2:
        return "ImageFormat.YUY2";
    case ImageFormat.YV12:
        return "ImageFormat.YV12";
    default://from   w w w  . ja  v a  2s. c  o m
        return "xxxxxxxxdefault";
    }
}

From source file:com.sien.cpshoot.screencapture.ScreenCaptureFragment.java

private void setUpVirtualDisplay() {
    Log.i(TAG, "Setting up a VirtualDisplay: " + mSurfaceView.getWidth() + "x" + mSurfaceView.getHeight() + " ("
            + mScreenDensity + ")");

    //---------------cp.add
    final int w = mSurfaceView.getWidth();
    final int h = mSurfaceView.getHeight();
    final ImageReader mImageReader = ImageReader.newInstance(w, h, ImageFormat.RGB_565, 2);
    DisplayMetrics metrics = new DisplayMetrics();
    WindowManager mWindowManager = getActivity().getWindowManager();
    mWindowManager.getDefaultDisplay().getMetrics(metrics);
    int mScreenDensity = metrics.densityDpi;
    //----end//from w w  w.  j ava2s. c om
    mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture", mSurfaceView.getWidth(),
            mSurfaceView.getHeight(), mScreenDensity, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            mImageReader.getSurface(), null, null);

    //---------------cp.add
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            saveImage(mImageReader, w, h);
        }
    }, 100);

    //-----end
    mButtonToggle.setText(R.string.stop);
}

From source file:com.fallahpoor.infocenter.fragments.CameraFragment.java

private String getPictureFormat(Camera.Parameters cameraParams) {

    int intFormat = cameraParams.getPictureFormat();
    String format;/*from  www.j  ava2 s  . c om*/

    switch (intFormat) {
    case ImageFormat.JPEG:
        format = "JPEG";
        break;
    case ImageFormat.RGB_565:
        format = "RGB";
        break;
    default:
        format = getString(R.string.unknown);
    }

    return format;

}