public static DisplayMode[] getDisplayModes () { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = genv.getDefaultScreenDevice(); java.awt.DisplayMode desktopMode = device.getDisplayMode(); java.awt.DisplayMode[] displayModes = device.getDisplayModes(); ArrayList<DisplayMode> modes = new ArrayList<DisplayMode>(); int idx = 0; for (java.awt.DisplayMode mode : displayModes) { boolean duplicate = false; for (int i = 0; i < modes.size(); i++) { if (modes.get(i).width == mode.getWidth() && modes.get(i).height == mode.getHeight() && modes.get(i).bitsPerPixel == mode.getBitDepth()) { duplicate = true; break; } } if (duplicate) continue; if (mode.getBitDepth() != desktopMode.getBitDepth()) continue; modes.add(new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode .getBitDepth())); } return modes.toArray(new DisplayMode[modes.size()]); } }
public static DisplayMode[] getDisplayModes () { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = genv.getDefaultScreenDevice(); java.awt.DisplayMode desktopMode = device.getDisplayMode(); java.awt.DisplayMode[] displayModes = device.getDisplayModes(); ArrayList<DisplayMode> modes = new ArrayList<DisplayMode>(); int idx = 0; for (java.awt.DisplayMode mode : displayModes) { boolean duplicate = false; for (int i = 0; i < modes.size(); i++) { if (modes.get(i).width == mode.getWidth() && modes.get(i).height == mode.getHeight() && modes.get(i).bitsPerPixel == mode.getBitDepth()) { duplicate = true; break; } } if (duplicate) continue; if (mode.getBitDepth() != desktopMode.getBitDepth()) continue; modes.add(new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode .getBitDepth())); } return modes.toArray(new DisplayMode[modes.size()]); } }
public static DisplayMode getDesktopDisplayMode () { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = genv.getDefaultScreenDevice(); java.awt.DisplayMode mode = device.getDisplayMode(); return new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode.getBitDepth()); }
/** * Returns every possible bit depth for the given resolution. */ private static String[] getDepths(String resolution, DisplayMode[] modes) { ArrayList<String> depths = new ArrayList<String>(4); for (int i = 0; i < modes.length; i++) { // Filter out all bit depths lower than 16 - Java incorrectly // reports // them as valid depths though the monitor does not support them if (modes[i].getBitDepth() < 16 && modes[i].getBitDepth() > 0) { continue; } String res = modes[i].getWidth() + " x " + modes[i].getHeight(); String depth = modes[i].getBitDepth() + " bpp"; if (res.equals(resolution) && !depths.contains(depth)) { depths.add(depth); } } if (depths.size() == 1 && depths.contains("-1 bpp")) { // add some default depths, possible system is multi-depth supporting depths.clear(); depths.add("24 bpp"); } String[] res = new String[depths.size()]; depths.toArray(res); return res; }
public static DisplayMode getDesktopDisplayMode () { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = genv.getDefaultScreenDevice(); java.awt.DisplayMode mode = device.getDisplayMode(); return new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode.getBitDepth()); }
@Override public DefaultRequest discoverParameters(GoogleAnalyticsConfig config, DefaultRequest request) { super.discoverParameters(config, request); Toolkit toolkit = Toolkit.getDefaultToolkit(); if (isEmpty(request.screenResolution())) { Dimension screenSize = toolkit.getScreenSize(); request.screenResolution(((int) screenSize.getWidth()) + "x" + ((int) screenSize.getHeight()) + ", " + toolkit.getScreenResolution() + " dpi"); } if (isEmpty(request.screenColors())) { GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] graphicsDevices = graphicsEnvironment.getScreenDevices(); StringBuilder sb = new StringBuilder(); for (GraphicsDevice graphicsDevice : graphicsDevices) { if (sb.length() != 0) { sb.append(", "); } sb.append(graphicsDevice.getDisplayMode().getBitDepth()); } request.screenColors(sb.toString()); } return request; } }
/** * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ public int compare(DisplayMode a, DisplayMode b) { // Width if (a.getWidth() != b.getWidth()) { return (a.getWidth() > b.getWidth()) ? 1 : -1; } // Height if (a.getHeight() != b.getHeight()) { return (a.getHeight() > b.getHeight()) ? 1 : -1; } // Bit depth if (a.getBitDepth() != b.getBitDepth()) { return (a.getBitDepth() > b.getBitDepth()) ? 1 : -1; } // Refresh rate if (a.getRefreshRate() != b.getRefreshRate()) { return (a.getRefreshRate() > b.getRefreshRate()) ? 1 : -1; } // All fields are equal return 0; } }
int max = 0; for(java.awt.DisplayMode dm : VRdev.getDisplayModes()) { int check = dm.getHeight() + dm.getWidth() + dm.getRefreshRate() + dm.getBitDepth(); if( check > max ) { max = check; settings.setBitsPerPixel(useDM.getBitDepth()); settings.setFrequency(useDM.getRefreshRate()); settings.setSwapBuffers(true);
int max = 0; for(java.awt.DisplayMode dm : VRdev.getDisplayModes()) { int check = dm.getHeight() + dm.getWidth() + dm.getRefreshRate() + dm.getBitDepth(); if( check > max ) { max = check; settings.setBitsPerPixel(useDM.getBitDepth()); settings.setFrequency(useDM.getRefreshRate()); settings.setSwapBuffers(true);
if (currentDisplayMode.getWidth() == settings.getWidth() && currentDisplayMode.getHeight() == settings.getHeight()) { if (currentDisplayMode.getBitDepth() == settings.getBitsPerPixel()) { if (currentDisplayMode.getRefreshRate() == settings.getFrequency()) { matchingDisplayMode = currentDisplayMode; refreshRateUnknownDisplayMode = currentDisplayMode; } else if (currentDisplayMode.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI) { if (currentDisplayMode.getRefreshRate() == settings.getFrequency()) { multiBitsDepthSupportedDisplayMode = currentDisplayMode; new Object[]{gd.getDisplayMode().getWidth(), gd.getDisplayMode().getHeight(), gd.getDisplayMode().getBitDepth(), gd.getDisplayMode().getRefreshRate()});
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; }
public MyDisplayMode(DisplayMode dm) { height = dm.getHeight(); width = dm.getWidth(); bitDepth = dm.getBitDepth(); refreshRate.add(dm.getRefreshRate()); }
private void showCurrentMode() // print the display mode details for the graphics device { DisplayMode dm = gd.getDisplayMode(); logger.info("Current Display Mode: (" + dm.getWidth() + "," + dm.getHeight() + "," + dm.getBitDepth() + "," + dm.getRefreshRate() + ") "); }
/** * Returns a string representation of the supplied display mode. */ public static String toString (DisplayMode mode) { return "[width=" + mode.getWidth() + ", height=" + mode.getHeight() + ", depth=" + mode.getBitDepth() + ", refresh=" + mode.getRefreshRate() + "]"; } }
public static DisplayMode getDesktopDisplayMode () { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = genv.getDefaultScreenDevice(); java.awt.DisplayMode mode = device.getDisplayMode(); return new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode.getBitDepth()); }
/** * Returns a string representation of the supplied display mode. */ public static String toString (DisplayMode mode) { return "[width=" + mode.getWidth() + ", height=" + mode.getHeight() + ", depth=" + mode.getBitDepth() + ", refresh=" + mode.getRefreshRate() + "]"; } }
static public DisplayMode getDesktopDisplayMode () { java.awt.DisplayMode mode = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode(); return new JglfwDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode.getBitDepth()); } }
public void setResolution(@Nonnull Resolution resolution) { try { mainDevice.setDisplayMode(new java.awt.DisplayMode(resolution.getW(), resolution.getH(), mainDevice.getDisplayMode().getBitDepth(), resolution.getRefreshRate())); } catch (IllegalArgumentException | UnsupportedOperationException exception) { throw new UnexpectedException(exception); } }
public void setResolution(@Nonnull Resolution resolution) { try { mainDevice.setDisplayMode(new java.awt.DisplayMode(resolution.getW(), resolution.getH(), mainDevice.getDisplayMode().getBitDepth(), resolution.getRefreshRate())); } catch (IllegalArgumentException | UnsupportedOperationException exception) { throw new UnexpectedException(exception); } }
public void setScreenNumber(int screenNumber) { DisplayMode d = CanvasFrame.getDisplayMode(screenNumber); String oldDescription = getDescription(); firePropertyChange("screenNumber", this.screenNumber, this.screenNumber = screenNumber); firePropertyChange("description", oldDescription, getDescription()); firePropertyChange("imageWidth", this.imageWidth, this.imageWidth = d == null ? 0 : d.getWidth()); firePropertyChange("imageHeight", this.imageHeight, this.imageHeight = d == null ? 0 : d.getHeight()); firePropertyChange("bitDepth", this.bitDepth, this.bitDepth = d == null ? 0 : d.getBitDepth()); firePropertyChange("refreshRate", this.refreshRate, this.refreshRate = d == null ? 0 : d.getRefreshRate()); firePropertyChange("responseGamma", this.responseGamma, this.responseGamma = CanvasFrame.getGamma(screenNumber)); }