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

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

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

Graphics2D.drawGlyphVector介绍

暂无

代码示例

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

@Override
public void drawGlyphVector(GlyphVector g, float x, float y)
{
  groupG2D.drawGlyphVector(g, x, y);
  alphaG2D.drawGlyphVector(g, x, y);
}

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

public void drawGlyphVector(GlyphVector g, float x, float y) {
  delegate.drawGlyphVector(g, x, y);
}

代码示例来源:origin: magefree/mage

/**
 * Draw a String centered in the middle of a Rectangle.
 *
 * @param g The Graphics instance.
 * @param text The String to draw.
 * @param rect The Rectangle to center the text in.
 * @param font
 */
public void drawCenteredStringWOutline(Graphics2D g, String text, Rectangle rect, Font font) {
  // Get the FontMetrics
  FontMetrics metrics = g.getFontMetrics(font);
  // Determine the X coordinate for the text
  int x = rect.x + (rect.width - metrics.stringWidth(text)) / 2;
  // Determine the Y coordinate for the text (note we add the ascent, as in java 2d 0 is top of the screen)
  int y = rect.y + ((rect.height - metrics.getHeight()) / 2) + metrics.getAscent();
  // Set the font
  g.setFont(font);
  GlyphVector gv = font.createGlyphVector(g.getFontRenderContext(), text);
  g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
      RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
      RenderingHints.VALUE_FRACTIONALMETRICS_ON);
  g.drawGlyphVector(gv, x, y);
  g.translate(x - 1, y - 1);
  for (int i = 0; i < text.length(); i++) {
    g.setColor(Color.BLACK);
    g.draw(gv.getGlyphOutline(i));
  }
  g.translate(-x + 1, -y + 1);
}

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

final Rectangle2D rect = bounds.get(i);
ypos += rect.getHeight();
graphics.drawGlyphVector(line, xpos, ypos);

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

drawStraightLabelStrikethroughIfNeeded(outline, metrics, false);
if (labelRenderingMode == LabelRenderingMode.STRING) {
  graphics.drawGlyphVector(gv, 0, 0);
} else if (labelRenderingMode == LabelRenderingMode.OUTLINE) {
  graphics.fill(outline);
    graphics.fill(outline);
  } else {
    graphics.drawGlyphVector(gv, 0, 0);

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

@Override
public void drawGlyphVector(GlyphVector g, float x, float y)
{
  groupG2D.drawGlyphVector(g, x, y);
  alphaG2D.drawGlyphVector(g, x, y);
}

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

/**
 * Forwards the call to the parent.
 *
 * @param g the <code>GlyphVector</code> to be rendered
 * @param x coordinates.
 * @param y the position in User Space where the glyphs should be rendered
 */
public void drawGlyphVector( final GlyphVector g, final float x, final float y ) {
 parent.drawGlyphVector( g, x, y );
}

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

@Override
public void drawGlyphVector (GlyphVector g, float x, float y)
{
  _copy.drawGlyphVector(g, x, y);
  _primary.drawGlyphVector(g, x, y);
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

@Override
public void drawGlyphVector(final Graphics2D graphics, final GlyphVector str,
              final int x, final int y) {
  graphics.drawGlyphVector(str, x, y);
}

代码示例来源:origin: us.ihmc/Plotting

private void drawGlyphVector(GlyphVector g, float x, float y)
{
 graphics2d.drawGlyphVector(g, x, y);
}

代码示例来源:origin: org.swinglabs.swingx/swingx-graphics

@Override
public void drawGlyphVector(GlyphVector g, float x, float y) {
  delegate.drawGlyphVector(g, x, y);
}

代码示例来源:origin: robo-code/robocode

@Override
public void drawGlyphVector(GlyphVector gv, float x, float y) {
  g.drawGlyphVector(gv, x, y);
}

代码示例来源:origin: jzy3d/jzy3d-api

@Override
public void drawGlyphVector(Graphics2D graphics, GlyphVector str, int x,
    int y) {
  graphics.setColor(Color.WHITE);
  graphics.setPaint(/*new GradientPaint(x, y, color, x, y + gradientSize
      / 2, color2, true)*/color);
  graphics.drawGlyphVector(str, x, y);
}

代码示例来源:origin: jzy3d/jzy3d-api

@Override
public void drawGlyphVector(Graphics2D graphics, GlyphVector str, int x,
    int y) {
  //shadow
  graphics.setColor(DROP_SHADOW_COLOR);
  graphics.drawGlyphVector(str, x + dropShadowDepth, y + dropShadowDepth);
  
  // normal
  graphics.setColor(Color.WHITE);
  graphics.setPaint(new GradientPaint(x, y, color1, x, y + gradientSize
      / 2, color2, true));
  graphics.drawGlyphVector(str, x, y);
}

代码示例来源:origin: jzy3d/jzy3d-api

@Override
public void drawGlyphVector(Graphics2D graphics, GlyphVector str, int x,
    int y) {
  graphics.setColor(Color.WHITE);
  graphics.setPaint(new GradientPaint(x, y, color1, x, y + gradientSize
      / 2, color2, true));
  graphics.drawGlyphVector(str, x, y);
}

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

public void drawGlyphVector(GlyphVector g, float x, float y)
{
  System.out.println( "drawGlyphVector(GlyphVector, float, float):" );
  System.out.println( "g = " + g );
  System.out.println( "x = " + x );
  System.out.println( "y = " + y );
  g2D.drawGlyphVector( g, x, y );
}

代码示例来源:origin: com.haulmont.thirdparty/poi

public void drawGlyphVector(GlyphVector g, float x, float y)
{
  System.out.println( "drawGlyphVector(GlyphVector, float, float):" );
  System.out.println( "g = " + g );
  System.out.println( "x = " + x );
  System.out.println( "y = " + y );
  g2D.drawGlyphVector( g, x, y );
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

public void drawGlyphVector(GlyphVector g, float x, float y)
{
  System.out.println( "drawGlyphVector(GlyphVector, float, float):" );
  System.out.println( "g = " + g );
  System.out.println( "x = " + x );
  System.out.println( "y = " + y );
  g2D.drawGlyphVector( g, x, y );
}

代码示例来源:origin: org.scijava/j3dcore

@Override
public final void drawGlyphVector(GlyphVector g, float x, float y) {
// XXXX: call validate with bounding box of primitive
validate();
offScreenGraphics2D.drawGlyphVector(g, x, y);
}

代码示例来源:origin: org.xhtmlrenderer/core-renderer

public void drawGlyphVector(OutputDevice outputDevice, FSGlyphVector fsGlyphVector, float x, float y ) {
  Object prevHint = null;
  Graphics2D graphics = ((Java2DOutputDevice)outputDevice).getGraphics();
  
  if ( graphics.getFont().getSize() > threshold ) {
    prevHint = graphics.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
    graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, antiAliasRenderingHint );
  }
  GlyphVector vector = ((AWTFSGlyphVector)fsGlyphVector).getGlyphVector();
  graphics.drawGlyphVector(vector, (int)x, (int)y );
  if ( graphics.getFont().getSize() > threshold ) {
    graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, prevHint );
  }
}

相关文章

Graphics2D类方法