List of usage examples for android.hardware.display DisplayManager VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR
int VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR
To view the source code for android.hardware.display DisplayManager VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR.
Click Source Link
From source file:Main.java
@TargetApi(Build.VERSION_CODES.KITKAT) public static ImageReader createImageReader(Activity c) { DisplayMetrics metrics = c.getResources().getDisplayMetrics(); int density = metrics.densityDpi; int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; //DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; Display display = c.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size);/*from ww w . j a va 2s .c o m*/ return ImageReader.newInstance(size.x, size.y, PixelFormat.RGB_565, 2); }
From source file:com.example.android.screencapture.ScreenCaptureFragment.java
private void setUpVirtualDisplay() { Log.i(TAG, "Setting up a VirtualDisplay: " + mSurfaceView.getWidth() + "x" + mSurfaceView.getHeight() + " (" + mScreenDensity + ")"); mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture", mSurfaceView.getWidth(), mSurfaceView.getHeight(), mScreenDensity, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR, mSurface, null, null);/*w w w. j av a 2 s. c o m*/ mButtonToggle.setText(R.string.stop); }
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 .ja va 2 s . com 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.orpheusdroid.screenrecorder.RecorderService.java
private VirtualDisplay createVirtualDisplay() { return mMediaProjection.createVirtualDisplay("MainActivity", WIDTH, HEIGHT, DENSITY_DPI, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR, mMediaRecorder.getSurface(), null /*Callbacks*/, null/*from www. j a v a 2s .co m*/ /*Handler*/); }
From source file:com.flyingcrop.ScreenCaptureFragment.java
private void setUpVirtualDisplay() { Log.i(TAG, "Setting up a VirtualDisplay: " + mSurfaceView.getWidth() + "x" + mSurfaceView.getHeight() + " (" + mScreenDensity + ")"); mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture", mWidth, mHeight, mScreenDensity, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR, mSurface, null, null); saveImage();// w w w . jav a2s .c o m }