android.graphics.PixelFormat#RGB_565 ( )源码实例Demo

下面列出了android.graphics.PixelFormat#RGB_565 ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: CatVision-io-SDK-Android   文件: VNCServer.java
@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);
	}
}
 
源代码2 项目: AcDisplay   文件: OverlayView.java
@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;
}
 
源代码3 项目: android_9.0.0_r45   文件: SurfaceView.java
@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();
    }
}
 
源代码4 项目: Noyze   文件: WPVolumePanel.java
@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;
}
 
源代码5 项目: 365browser   文件: PhysicalDisplayAndroid.java
@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;
    }
}
 
源代码6 项目: Noyze   文件: WPVolumePanel.java
@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;
}
 
源代码7 项目: android-chromium   文件: DeviceDisplayInfo.java
/**
 * @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;
    }
}
 
源代码8 项目: MikuMikuStudio   文件: AndroidConfigChooser.java
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;
}
 
源代码9 项目: android-chromium   文件: DeviceDisplayInfo.java
/**
 * @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;
    }
}
 
源代码10 项目: android_9.0.0_r45   文件: StreamConfigurationMap.java
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";
    }
}