Java Code Examples for android.graphics.PixelFormat#RGB_565
The following examples show how to use
android.graphics.PixelFormat#RGB_565 .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VNCServer.java From CatVision-io-SDK-Android with BSD 3-Clause "New" or "Revised" License | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public void push(Image image, int pixelFormat) { Image.Plane[] planes = image.getPlanes(); ByteBuffer b = planes[0].getBuffer(); if (pixelFormat == PixelFormat.RGBA_8888) { // planes[0].getPixelStride() has to be 4 (32 bit) jni_push_pixels_rgba_8888(b, planes[0].getRowStride()); } else if (pixelFormat == PixelFormat.RGB_565) { // planes[0].getPixelStride() has to be 16 (16 bit) jni_push_pixels_rgba_565(b, planes[0].getRowStride()); } else { Log.e(TAG, "Image reader acquired unsupported image format " + pixelFormat); } }
Example 2
Source File: OverlayView.java From AcDisplay with GNU General Public License v2.0 | 6 votes |
@NonNull private WindowManager.LayoutParams createLayoutParams() { int type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; int flags = WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD; WindowManager.LayoutParams lp = new WindowManager.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, type, flags, PixelFormat.RGB_565); lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN; return lp; }
Example 3
Source File: SurfaceView.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void setFormat(int format) { // for backward compatibility reason, OPAQUE always // means 565 for SurfaceView if (format == PixelFormat.OPAQUE) format = PixelFormat.RGB_565; mRequestedFormat = format; if (mSurfaceControl != null) { updateSurface(); } }
Example 4
Source File: WPVolumePanel.java From Noyze with Apache License 2.0 | 5 votes |
@Override public WindowManager.LayoutParams getWindowLayoutParams() { int flags = ( WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED ); WindowManager.LayoutParams WPARAMS = new WindowManager.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0, 0, WindowManager.LayoutParams.TYPE_SYSTEM_ERROR, flags, PixelFormat.RGB_565); WPARAMS.windowAnimations = android.R.style.Animation_Dialog; WPARAMS.packageName = getContext().getPackageName(); WPARAMS.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_CROSSFADE; WPARAMS.setTitle(TAG); Resources res = getResources(); final int panelWidth = getNotificationPanelWidth(); final int maxWidth = ((panelWidth > 0) ? panelWidth : res.getDimensionPixelSize(R.dimen.notification_panel_width)); final int menuWidth = res.getDimensionPixelSize(R.dimen.max_menu_width); final int screenWidth = getWindowWidth(); if (stretch || (maxWidth <= 0) || (!res.getBoolean(R.bool.isTablet) && screenWidth < menuWidth)) { WPARAMS.gravity = (Gravity.FILL_HORIZONTAL | Gravity.TOP); } else { WPARAMS.gravity = (Gravity.CENTER_HORIZONTAL | Gravity.TOP); WPARAMS.width = (maxWidth <= 0) ? menuWidth : maxWidth; } WPARAMS.screenBrightness = WPARAMS.buttonBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE; return WPARAMS; }
Example 5
Source File: PhysicalDisplayAndroid.java From 365browser with Apache License 2.0 | 5 votes |
@SuppressWarnings("deprecation") private int bitsPerComponent(int pixelFormatId) { switch (pixelFormatId) { case PixelFormat.RGBA_4444: return 4; case PixelFormat.RGBA_5551: return 5; case PixelFormat.RGBA_8888: case PixelFormat.RGBX_8888: case PixelFormat.RGB_888: return 8; case PixelFormat.RGB_332: return 2; case PixelFormat.RGB_565: return 5; // Non-RGB formats. case PixelFormat.A_8: case PixelFormat.LA_88: case PixelFormat.L_8: return 0; // Unknown format. Use 8 as a sensible default. default: return 8; } }
Example 6
Source File: WPVolumePanel.java From Noyze with Apache License 2.0 | 5 votes |
@Override public WindowManager.LayoutParams getWindowLayoutParams() { int flags = ( WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED ); WindowManager.LayoutParams WPARAMS = new WindowManager.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0, 0, WindowManager.LayoutParams.TYPE_SYSTEM_ERROR, flags, PixelFormat.RGB_565); WPARAMS.windowAnimations = android.R.style.Animation_Dialog; WPARAMS.packageName = getContext().getPackageName(); WPARAMS.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_CROSSFADE; WPARAMS.setTitle(TAG); Resources res = getResources(); final int panelWidth = getNotificationPanelWidth(); final int maxWidth = ((panelWidth > 0) ? panelWidth : res.getDimensionPixelSize(R.dimen.notification_panel_width)); final int menuWidth = res.getDimensionPixelSize(R.dimen.max_menu_width); final int screenWidth = getWindowWidth(); if (stretch || (maxWidth <= 0) || (!res.getBoolean(R.bool.isTablet) && screenWidth < menuWidth)) { WPARAMS.gravity = (Gravity.FILL_HORIZONTAL | Gravity.TOP); } else { WPARAMS.gravity = (Gravity.CENTER_HORIZONTAL | Gravity.TOP); WPARAMS.width = (maxWidth <= 0) ? menuWidth : maxWidth; } WPARAMS.screenBrightness = WPARAMS.buttonBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE; return WPARAMS; }
Example 7
Source File: DeviceDisplayInfo.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * @return Bits per component. */ @SuppressWarnings("deprecation") @CalledByNative public int getBitsPerComponent() { int format = getPixelFormat(); switch (format) { case PixelFormat.RGBA_4444: return 4; case PixelFormat.RGBA_5551: return 5; case PixelFormat.RGBA_8888: case PixelFormat.RGBX_8888: case PixelFormat.RGB_888: return 8; case PixelFormat.RGB_332: return 2; case PixelFormat.RGB_565: return 5; // Non-RGB formats. case PixelFormat.A_8: case PixelFormat.LA_88: case PixelFormat.L_8: return 0; // Unknown format. Use 8 as a sensible default. default: return 8; } }
Example 8
Source File: AndroidConfigChooser.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private int getPixelFormat(EGLConfig conf, EGLDisplay display, EGL10 egl) { int[] value = new int[1]; int result = PixelFormat.RGB_565; egl.eglGetConfigAttrib(display, conf, EGL10.EGL_RED_SIZE, value); if (value[0] == 8) { result = PixelFormat.RGBA_8888; /* egl.eglGetConfigAttrib(display, conf, EGL10.EGL_ALPHA_SIZE, value); if (value[0] == 8) { result = PixelFormat.RGBA_8888; } else { result = PixelFormat.RGB_888; }*/ } if (verbose) { logger.info("Using PixelFormat " + result); } //return result; TODO Test pixelformat return PixelFormat.TRANSPARENT; }
Example 9
Source File: DeviceDisplayInfo.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * @return Bits per component. */ @SuppressWarnings("deprecation") @CalledByNative public int getBitsPerComponent() { int format = getPixelFormat(); switch (format) { case PixelFormat.RGBA_4444: return 4; case PixelFormat.RGBA_5551: return 5; case PixelFormat.RGBA_8888: case PixelFormat.RGBX_8888: case PixelFormat.RGB_888: return 8; case PixelFormat.RGB_332: return 2; case PixelFormat.RGB_565: return 5; // Non-RGB formats. case PixelFormat.A_8: case PixelFormat.LA_88: case PixelFormat.L_8: return 0; // Unknown format. Use 8 as a sensible default. default: return 8; } }
Example 10
Source File: StreamConfigurationMap.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
private String formatToString(int format) { switch (format) { case ImageFormat.YV12: return "YV12"; case ImageFormat.YUV_420_888: return "YUV_420_888"; case ImageFormat.NV21: return "NV21"; case ImageFormat.NV16: return "NV16"; case PixelFormat.RGB_565: return "RGB_565"; case PixelFormat.RGBA_8888: return "RGBA_8888"; case PixelFormat.RGBX_8888: return "RGBX_8888"; case PixelFormat.RGB_888: return "RGB_888"; case ImageFormat.JPEG: return "JPEG"; case ImageFormat.YUY2: return "YUY2"; case ImageFormat.Y8: return "Y8"; case ImageFormat.Y16: return "Y16"; case ImageFormat.RAW_SENSOR: return "RAW_SENSOR"; case ImageFormat.RAW_PRIVATE: return "RAW_PRIVATE"; case ImageFormat.RAW10: return "RAW10"; case ImageFormat.DEPTH16: return "DEPTH16"; case ImageFormat.DEPTH_POINT_CLOUD: return "DEPTH_POINT_CLOUD"; case ImageFormat.RAW_DEPTH: return "RAW_DEPTH"; case ImageFormat.PRIVATE: return "PRIVATE"; default: return "UNKNOWN"; } }