Java Code Examples for java.awt.GraphicsDevice#TYPE_PRINTER
The following examples show how to use
java.awt.GraphicsDevice#TYPE_PRINTER .
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: SwingDisplayServer.java From birt with Eclipse Public License 1.0 | 5 votes |
@Override public final int getDpiResolution( ) { if ( iDpiResolution == 0 ) { switch ( getGraphicsContext( ).getDeviceConfiguration( ) .getDevice( ) .getType( ) ) { case GraphicsDevice.TYPE_RASTER_SCREEN : // This is the only reliable dpi for the display, the one in // g2d.getTransform() // will be 72 dpi for the display, even when the OS has a // different dpi set. iDpiResolution = computeScreenDpi(); break; case GraphicsDevice.TYPE_PRINTER : // In that case the g2d already contains a transform with the right dpi of the printer // so we set the dpi to 72, since there is no adjustment needed iDpiResolution = 72; break; case GraphicsDevice.TYPE_IMAGE_BUFFER : if ( userResolution == 0 ) { // Use value set by user, if none, use screen resolution iDpiResolution = computeScreenDpi( ); } else { iDpiResolution = userResolution; } break; } adjustFractionalMetrics( ); } return iDpiResolution; }
Example 2
Source File: DrawingPanel.java From osp with GNU General Public License v3.0 | 5 votes |
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; boolean resetBuffered = buffered; if(g2.getDeviceConfiguration().getDevice().getType()==GraphicsDevice.TYPE_PRINTER) { buffered = false; //System.out.println("buffer off"); } super.paint(g); buffered = resetBuffered; }
Example 3
Source File: PageDrawer.java From gcs with Mozilla Public License 2.0 | 4 votes |
@Override public void showAnnotation(PDAnnotation annotation) throws IOException { lastClip = null; int deviceType = -1; if (graphics.getDeviceConfiguration() != null && graphics.getDeviceConfiguration().getDevice() != null) { 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; } if (annotation.isInvisible() && annotation instanceof PDAnnotationUnknown) { // "If set, do not display the annotation if it does not belong to one // of the standard annotation types and no annotation handler is available." return; } //TODO support NoZoom, example can be found in p5 of PDFBOX-2348 if (isHiddenOCG(annotation.getOptionalContent())) { return; } PDAppearanceDictionary appearance = annotation.getAppearance(); if (appearance == null || appearance.getNormalAppearance() == null) { annotation.constructAppearances(renderer.document); } if (annotation.isNoRotate() && getCurrentPage().getRotation() != 0) { PDRectangle rect = annotation.getRectangle(); AffineTransform savedTransform = graphics.getTransform(); // "The upper-left corner of the annotation remains at the same point in // default user space; the annotation pivots around that point." graphics.rotate(Math.toRadians(getCurrentPage().getRotation()), rect.getLowerLeftX(), rect.getUpperRightY()); super.showAnnotation(annotation); graphics.setTransform(savedTransform); } else { super.showAnnotation(annotation); } }
Example 4
Source File: PageDrawer.java From sambox with Apache License 2.0 | 4 votes |
@Override public void showAnnotation(PDAnnotation annotation) throws IOException { lastClip = null; int deviceType = -1; if (graphics.getDeviceConfiguration() != null && graphics.getDeviceConfiguration().getDevice() != null) { 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; } if (annotation.isInvisible() && annotation instanceof PDAnnotationUnknown) { // "If set, do not display the annotation if it does not belong to one // of the standard annotation types and no annotation handler is available." return; } // TODO support NoZoom, example can be found in p5 of PDFBOX-2348 if (isHiddenOCG(annotation.getOptionalContent())) { return; } PDAppearanceDictionary appearance = annotation.getAppearance(); if (appearance == null || appearance.getNormalAppearance() == null) { // TODO: Improve memory consumption by passing a ScratchFile annotation.constructAppearances(); } if (annotation.isNoRotate() && getCurrentPage().getRotation() != 0) { PDRectangle rect = annotation.getRectangle(); AffineTransform savedTransform = graphics.getTransform(); // "The upper-left corner of the annotation remains at the same point in // default user space; the annotation pivots around that point." graphics.rotate(Math.toRadians(getCurrentPage().getRotation()), rect.getLowerLeftX(), rect.getUpperRightY()); super.showAnnotation(annotation); graphics.setTransform(savedTransform); } else { super.showAnnotation(annotation); } }
Example 5
Source File: SVGGraphicsDevice.java From jfreesvg with GNU General Public License v3.0 | 2 votes |
/** * Returns the device type. * * @return The device type. */ @Override public int getType() { return GraphicsDevice.TYPE_PRINTER; }