Java Code Examples for java.awt.DisplayMode#getBitDepth()
The following examples show how to use
java.awt.DisplayMode#getBitDepth() .
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: X11GraphicsDevice.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 2
Source File: X11GraphicsDevice.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 3
Source File: X11GraphicsDevice.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 4
Source File: X11GraphicsDevice.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 5
Source File: Win32GraphicsDevice.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
protected synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 6
Source File: Win32GraphicsDevice.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 7
Source File: X11GraphicsDevice.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 8
Source File: Win32GraphicsDevice.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 9
Source File: PDFRenderer.java From gcs with Mozilla Public License 2.0 | 6 votes |
private boolean isBitonal(Graphics2D graphics) { GraphicsConfiguration deviceConfiguration = graphics.getDeviceConfiguration(); if (deviceConfiguration == null) { return false; } GraphicsDevice device = deviceConfiguration.getDevice(); if (device == null) { return false; } DisplayMode displayMode = device.getDisplayMode(); if (displayMode == null) { return false; } return displayMode.getBitDepth() == 1; }
Example 10
Source File: X11GraphicsDevice.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 11
Source File: X11GraphicsDevice.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) { if (!isDisplayChangeSupported()) { return null; } DisplayMode[] modes = getDisplayModes(); for (DisplayMode mode : modes) { if (dm.equals(mode) || (dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN && dm.getWidth() == mode.getWidth() && dm.getHeight() == mode.getHeight() && dm.getBitDepth() == mode.getBitDepth())) { return mode; } } return null; }
Example 12
Source File: AltTabCrashTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 13
Source File: AltTabCrashTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 14
Source File: AltTabCrashTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 15
Source File: ComboTest.java From netbeans with Apache License 2.0 | 5 votes |
static boolean checkGraphicsEnvironment() { if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadless()) { System.err.println("Cannot run test in a headless environment"); } DisplayMode dm = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode(); int i = dm.getBitDepth(); if (i == dm.BIT_DEPTH_MULTI || i >= 16) { return true; } return false; }
Example 16
Source File: ComboTest.java From netbeans with Apache License 2.0 | 5 votes |
static boolean checkGraphicsEnvironment() { if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadless()) { System.err.println("Cannot run test in a headless environment"); } DisplayMode dm = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode(); int i = dm.getBitDepth(); if (i == dm.BIT_DEPTH_MULTI || i >= 16) { return true; } return false; }
Example 17
Source File: AltTabCrashTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 18
Source File: AltTabCrashTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private DisplayMode findDisplayMode() { GraphicsDevice gd = getGraphicsConfiguration().getDevice(); DisplayMode dms[] = gd.getDisplayModes(); DisplayMode currentDM = gd.getDisplayMode(); for (DisplayMode dm : dms) { if (dm.getBitDepth() > 8 && dm.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && dm.getBitDepth() != currentDM.getBitDepth() && dm.getWidth() == currentDM.getWidth() && dm.getHeight() == currentDM.getHeight()) { // found a mode which has the same dimensions but different // depth return dm; } if (dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI && (dm.getWidth() != currentDM.getWidth() || dm.getHeight() != currentDM.getHeight())) { // found a mode which has the same depth but different // dimensions return dm; } } return null; }
Example 19
Source File: GraphicsTestCase.java From netbeans with Apache License 2.0 | 4 votes |
/** Determine if the graphics environment is 24 bit and has standard fonts, * so pixel position and color tests will not erroneously fail. This method is * thread safe. */ public static boolean canSafelyRunPixelTests() { if (graphicsTestsSafe != null) { return graphicsTestsSafe.booleanValue(); } try { boolean result = false; if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadless()) { System.err.println("Cannot run test in a headless environment"); graphicsTestsSafe = Boolean.FALSE; return false; } DisplayMode dm = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().getDisplayMode(); int i = dm.getBitDepth(); if (i == dm.BIT_DEPTH_MULTI || i >= 16) { result = true; Font f = UIManager.getFont("controlFont"); if (f == null) { f = new JTable().getFont(); } Graphics g = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().getDefaultConfiguration(). createCompatibleImage(10,10).getGraphics(); FontMetrics fm = g.getFontMetrics(f); if (fm.getHeight() != 16) { System.err.println("Cannot run this test - default font size is not " + 16 + " pixels in height - could lead to false fails"); System.err.println("Basic font size is " + fm.getHeight()); //Some environments, such as Mandrake linux or Windows with //large fonts will supply fonts bigger than the error icon, //causing the pixel tests to fail due to icon positioning //differences result = false; } } if (result) { result = tryPrototypePixelTest(); } return result; } catch (Exception e) { graphicsTestsSafe = Boolean.FALSE; e.printStackTrace(); return false; } }
Example 20
Source File: NonExistentDisplayModeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static DisplayMode deriveSize(DisplayMode dm) { int w = dm.getWidth() / 7; int h = dm.getHeight() / 3; return new DisplayMode(w, h, dm.getBitDepth(), dm.getRefreshRate()); }