Example usage for java.awt GraphicsDevice TYPE_RASTER_SCREEN

List of usage examples for java.awt GraphicsDevice TYPE_RASTER_SCREEN

Introduction

In this page you can find the example usage for java.awt GraphicsDevice TYPE_RASTER_SCREEN.

Prototype

int TYPE_RASTER_SCREEN

To view the source code for java.awt GraphicsDevice TYPE_RASTER_SCREEN.

Click Source Link

Document

Device is a raster screen.

Usage

From source file:Main.java

/**
 * Returns the GraphicsConfiguration for a point.
 *///from  w w  w  . ja  va2 s  . c o m
public static GraphicsConfiguration getGraphicsConfiguration(Component aComp, int anX, int aY) {
    // Get initial GC from component (if available) and point on screen
    GraphicsConfiguration gc = aComp != null ? aComp.getGraphicsConfiguration() : null;
    Point spoint = getScreenLocation(aComp, anX, aY);

    // Replace with alternate GraphicsConfiguration if point on another screen
    for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
        if (gd.getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
            GraphicsConfiguration dgc = gd.getDefaultConfiguration();
            if (dgc.getBounds().contains(spoint.x, spoint.y)) {
                gc = dgc;
                break;
            }
        }
    }

    // Return GraphicsConfiguration
    return gc;
}

From source file:org.apache.pdfbox.rendering.PageDrawer.java

@Override
public void showAnnotation(PDAnnotation annotation) throws IOException {
    lastClip = null;//from   w ww .  j  a  va  2s.  c  o  m
    //TODO support more annotation flags (Invisible, NoZoom, NoRotate)
    int deviceType = graphics.getDeviceConfiguration().getDevice().getType();
    if (deviceType == GraphicsDevice.TYPE_PRINTER && !annotation.isPrinted()) {
        return;
    }
    if (deviceType == GraphicsDevice.TYPE_RASTER_SCREEN && annotation.isNoView()) {
        return;
    }
    if (annotation.isHidden()) {
        return;
    }
    super.showAnnotation(annotation);
}