java.awt.Graphics2D.getDeviceConfiguration()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(257)

本文整理了Java中java.awt.Graphics2D.getDeviceConfiguration()方法的一些代码示例,展示了Graphics2D.getDeviceConfiguration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphics2D.getDeviceConfiguration()方法的具体详情如下:
包路径:java.awt.Graphics2D
类名称:Graphics2D
方法名:getDeviceConfiguration

Graphics2D.getDeviceConfiguration介绍

[英]Returns the device configuration associated with this Graphics2D.
[中]返回与此Graphics2D关联的设备配置。

代码示例

代码示例来源:origin: org.apache.poi/poi

  1. public GraphicsConfiguration getDeviceConfiguration()
  2. {
  3. return getG2D().getDeviceConfiguration();
  4. }

代码示例来源:origin: apache/pdfbox

  1. @Override
  2. public GraphicsConfiguration getDeviceConfiguration()
  3. {
  4. return groupG2D.getDeviceConfiguration();
  5. }

代码示例来源:origin: geotools/geotools

  1. public GraphicsConfiguration getDeviceConfiguration() {
  2. return delegate.getDeviceConfiguration();
  3. }

代码示例来源:origin: geotools/geotools

  1. /** Call this method before starting to use the graphic for good */
  2. public void init() {
  3. if (delegate == null) {
  4. if (master instanceof DelayedBackbufferGraphic) {
  5. ((DelayedBackbufferGraphic) master).init();
  6. }
  7. image =
  8. master.getDeviceConfiguration()
  9. .createCompatibleImage(
  10. screenSize.width, screenSize.height, Transparency.TRANSLUCENT);
  11. delegate = image.createGraphics();
  12. delegate.setRenderingHints(master.getRenderingHints());
  13. }
  14. }

代码示例来源:origin: apache/pdfbox

  1. /**
  2. * Glyph bounding boxes.
  3. */
  4. @Override
  5. protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode,
  6. Vector displacement) throws IOException
  7. {
  8. // draw glyph
  9. super.showGlyph(textRenderingMatrix, font, code, unicode, displacement);
  10. // bbox in EM -> user units
  11. Shape bbox = new Rectangle2D.Float(0, 0, font.getWidth(code) / 1000, 1);
  12. AffineTransform at = textRenderingMatrix.createAffineTransform();
  13. bbox = at.createTransformedShape(bbox);
  14. // save
  15. Graphics2D graphics = getGraphics();
  16. Color color = graphics.getColor();
  17. Stroke stroke = graphics.getStroke();
  18. Shape clip = graphics.getClip();
  19. // draw
  20. graphics.setClip(graphics.getDeviceConfiguration().getBounds());
  21. graphics.setColor(Color.RED);
  22. graphics.setStroke(new BasicStroke(.5f));
  23. graphics.draw(bbox);
  24. // restore
  25. graphics.setStroke(stroke);
  26. graphics.setColor(color);
  27. graphics.setClip(clip);
  28. }

代码示例来源:origin: apache/pdfbox

  1. /**
  2. * Filled path bounding boxes.
  3. */
  4. @Override
  5. public void fillPath(int windingRule) throws IOException
  6. {
  7. // bbox in user units
  8. Shape bbox = getLinePath().getBounds2D();
  9. // draw path (note that getLinePath() is now reset)
  10. super.fillPath(windingRule);
  11. // save
  12. Graphics2D graphics = getGraphics();
  13. Color color = graphics.getColor();
  14. Stroke stroke = graphics.getStroke();
  15. Shape clip = graphics.getClip();
  16. // draw
  17. graphics.setClip(graphics.getDeviceConfiguration().getBounds());
  18. graphics.setColor(Color.GREEN);
  19. graphics.setStroke(new BasicStroke(.5f));
  20. graphics.draw(bbox);
  21. // restore
  22. graphics.setStroke(stroke);
  23. graphics.setColor(color);
  24. graphics.setClip(clip);
  25. }

代码示例来源:origin: apache/pdfbox

  1. private boolean isBitonal(Graphics2D graphics)
  2. {
  3. GraphicsConfiguration deviceConfiguration = graphics.getDeviceConfiguration();
  4. if (deviceConfiguration == null)
  5. {
  6. return false;
  7. }
  8. GraphicsDevice device = deviceConfiguration.getDevice();
  9. if (device == null)
  10. {
  11. return false;
  12. }
  13. DisplayMode displayMode = device.getDisplayMode();
  14. if (displayMode == null)
  15. {
  16. return false;
  17. }
  18. return displayMode.getBitDepth() == 1;
  19. }

代码示例来源:origin: apache/pdfbox

  1. graphics.setClip(graphics.getDeviceConfiguration().getBounds());
  2. graphics.setColor(Color.cyan);
  3. graphics.setStroke(new BasicStroke(.5f));

代码示例来源:origin: org.apache.pdfbox/pdfbox

  1. @Override
  2. public GraphicsConfiguration getDeviceConfiguration()
  3. {
  4. return groupG2D.getDeviceConfiguration();
  5. }

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

  1. /**
  2. * @see Graphics2D#getDeviceConfiguration()
  3. */
  4. public GraphicsConfiguration getDeviceConfiguration() {
  5. return dg2.getDeviceConfiguration();
  6. }

代码示例来源:origin: pentaho/pentaho-reporting

  1. /**
  2. * Returns the device configuration associated with this <code>Graphics2D</code>.
  3. *
  4. * @return the device configuration of this <code>Graphics2D</code>.
  5. */
  6. public GraphicsConfiguration getDeviceConfiguration() {
  7. return parent.getDeviceConfiguration();
  8. }

代码示例来源:origin: com.github.librepdf/openpdf

  1. /**
  2. * @see Graphics2D#getDeviceConfiguration()
  3. */
  4. public GraphicsConfiguration getDeviceConfiguration() {
  5. return dg2.getDeviceConfiguration();
  6. }

代码示例来源:origin: apache/pdfbox

  1. if (graphics.getDeviceConfiguration() != null &&
  2. graphics.getDeviceConfiguration().getDevice() != null)
  3. deviceType = graphics.getDeviceConfiguration().getDevice().getType();

代码示例来源:origin: org.openmicroscopy/ome-poi

  1. public GraphicsConfiguration getDeviceConfiguration()
  2. {
  3. System.out.println( "getDeviceConfiguration():" );
  4. return g2D.getDeviceConfiguration();
  5. }

代码示例来源:origin: com.itextpdf/itextpdf

  1. /**
  2. * @see Graphics2D#getDeviceConfiguration()
  3. */
  4. @Override
  5. public GraphicsConfiguration getDeviceConfiguration() {
  6. return getDG2().getDeviceConfiguration();
  7. }

代码示例来源:origin: org.geotools/gt-render

  1. /**
  2. * Call this method before starting to use the graphic for good
  3. */
  4. public void init() {
  5. if (delegate == null) {
  6. image = master.getDeviceConfiguration().createCompatibleImage(screenSize.width,
  7. screenSize.height, Transparency.TRANSLUCENT);
  8. delegate = image.createGraphics();
  9. delegate.setRenderingHints(master.getRenderingHints());
  10. }
  11. }

代码示例来源:origin: org.jaitools/jt-utils

  1. @Override
  2. public GraphicsConfiguration getDeviceConfiguration() {
  3. Graphics2D gr = getProxy();
  4. copyGraphicsParams(gr);
  5. GraphicsConfiguration gc = gr.getDeviceConfiguration();
  6. gr.dispose();
  7. return gc;
  8. }

代码示例来源:origin: com.googlecode.jaitools/jt-utils

  1. @Override
  2. public GraphicsConfiguration getDeviceConfiguration() {
  3. Graphics2D gr = getProxy();
  4. copyGraphicsParams(gr);
  5. GraphicsConfiguration gc = gr.getDeviceConfiguration();
  6. gr.dispose();
  7. return gc;
  8. }

代码示例来源:origin: JetBrains/jediterm

  1. /**
  2. * This method perfectly detects retina Graphics2D for jdk7+
  3. * For Apple JDK6 it returns false.
  4. *
  5. * @param g graphics to be tested
  6. * @return false if the device of the Graphics2D is not a retina device,
  7. * jdk is an Apple JDK or Oracle API has been changed.
  8. */
  9. private static boolean isMacRetina(Graphics2D g) {
  10. GraphicsDevice device = g.getDeviceConfiguration().getDevice();
  11. return isOracleMacRetinaDevice(device);
  12. }

代码示例来源:origin: org.docx4j/xhtmlrenderer

  1. protected LayoutContext newLayoutContext(Graphics2D g) {
  2. XRLog.layout(Level.FINEST, "new context begin");
  3. getSharedContext().setCanvas(this);
  4. XRLog.layout(Level.FINEST, "new context end");
  5. LayoutContext result = getSharedContext().newLayoutContextInstance();
  6. Graphics2D layoutGraphics =
  7. g.getDeviceConfiguration().createCompatibleImage(1, 1).createGraphics();
  8. result.setFontContext(new Java2DFontContext(layoutGraphics));
  9. getSharedContext().getTextRenderer().setup(result.getFontContext());
  10. return result;
  11. }

相关文章

Graphics2D类方法