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

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

本文整理了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

public GraphicsConfiguration getDeviceConfiguration()
{
  return getG2D().getDeviceConfiguration();
}

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

@Override
public GraphicsConfiguration getDeviceConfiguration()
{
  return groupG2D.getDeviceConfiguration();
}

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

public GraphicsConfiguration getDeviceConfiguration() {
  return delegate.getDeviceConfiguration();
}

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

/** Call this method before starting to use the graphic for good */
public void init() {
  if (delegate == null) {
    if (master instanceof DelayedBackbufferGraphic) {
      ((DelayedBackbufferGraphic) master).init();
    }
    image =
        master.getDeviceConfiguration()
            .createCompatibleImage(
                screenSize.width, screenSize.height, Transparency.TRANSLUCENT);
    delegate = image.createGraphics();
    delegate.setRenderingHints(master.getRenderingHints());
  }
}

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

/**
 * Glyph bounding boxes.
 */
@Override
protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode,
             Vector displacement) throws IOException
{
  // draw glyph
  super.showGlyph(textRenderingMatrix, font, code, unicode, displacement);
  
  // bbox in EM -> user units
  Shape bbox = new Rectangle2D.Float(0, 0, font.getWidth(code) / 1000, 1);
  AffineTransform at = textRenderingMatrix.createAffineTransform();
  bbox = at.createTransformedShape(bbox);
  
  // save
  Graphics2D graphics = getGraphics();
  Color color = graphics.getColor();
  Stroke stroke = graphics.getStroke();
  Shape clip = graphics.getClip();
  // draw
  graphics.setClip(graphics.getDeviceConfiguration().getBounds());
  graphics.setColor(Color.RED);
  graphics.setStroke(new BasicStroke(.5f));
  graphics.draw(bbox);
  // restore
  graphics.setStroke(stroke);
  graphics.setColor(color);
  graphics.setClip(clip);
}

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

/**
 * Filled path bounding boxes.
 */
@Override
public void fillPath(int windingRule) throws IOException
{
  // bbox in user units
  Shape bbox = getLinePath().getBounds2D();
  
  // draw path (note that getLinePath() is now reset)
  super.fillPath(windingRule);
  
  // save
  Graphics2D graphics = getGraphics();
  Color color = graphics.getColor();
  Stroke stroke = graphics.getStroke();
  Shape clip = graphics.getClip();
  // draw
  graphics.setClip(graphics.getDeviceConfiguration().getBounds());
  graphics.setColor(Color.GREEN);
  graphics.setStroke(new BasicStroke(.5f));
  graphics.draw(bbox);
  // restore
  graphics.setStroke(stroke);
  graphics.setColor(color);
  graphics.setClip(clip);
}

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

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;
}

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

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

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

@Override
public GraphicsConfiguration getDeviceConfiguration()
{
  return groupG2D.getDeviceConfiguration();
}

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

/**
 * @see Graphics2D#getDeviceConfiguration()
 */
public GraphicsConfiguration getDeviceConfiguration() {
  return dg2.getDeviceConfiguration();
}

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

/**
 * Returns the device configuration associated with this <code>Graphics2D</code>.
 *
 * @return the device configuration of this <code>Graphics2D</code>.
 */
public GraphicsConfiguration getDeviceConfiguration() {
 return parent.getDeviceConfiguration();
}

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

/**
 * @see Graphics2D#getDeviceConfiguration()
 */
public GraphicsConfiguration getDeviceConfiguration() {
  return dg2.getDeviceConfiguration();
}

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

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

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

public GraphicsConfiguration getDeviceConfiguration()
{
  System.out.println( "getDeviceConfiguration():" );
  return g2D.getDeviceConfiguration();
}

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

/**
 * @see Graphics2D#getDeviceConfiguration()
 */
@Override
public GraphicsConfiguration getDeviceConfiguration() {
  return getDG2().getDeviceConfiguration();
}

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

/**
 * Call this method before starting to use the graphic for good
 */
public void init() {
  if (delegate == null) {
    image = master.getDeviceConfiguration().createCompatibleImage(screenSize.width,
        screenSize.height, Transparency.TRANSLUCENT);
    delegate = image.createGraphics();
    delegate.setRenderingHints(master.getRenderingHints());
  }
}

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

@Override
public GraphicsConfiguration getDeviceConfiguration() {
  Graphics2D gr = getProxy();
  copyGraphicsParams(gr);
  GraphicsConfiguration gc = gr.getDeviceConfiguration();
  gr.dispose();
  return gc;
}

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

@Override
public GraphicsConfiguration getDeviceConfiguration() {
  Graphics2D gr = getProxy();
  copyGraphicsParams(gr);
  GraphicsConfiguration gc = gr.getDeviceConfiguration();
  gr.dispose();
  return gc;
}

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

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

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

protected LayoutContext newLayoutContext(Graphics2D g) {
  XRLog.layout(Level.FINEST, "new context begin");
  getSharedContext().setCanvas(this);
  XRLog.layout(Level.FINEST, "new context end");
  LayoutContext result = getSharedContext().newLayoutContextInstance();
  Graphics2D layoutGraphics =
    g.getDeviceConfiguration().createCompatibleImage(1, 1).createGraphics();
  result.setFontContext(new Java2DFontContext(layoutGraphics));
  getSharedContext().getTextRenderer().setup(result.getFontContext());
  return result;
}

相关文章

Graphics2D类方法