本文整理汇总了Java中java.awt.Graphics2D.getRenderingHint方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics2D.getRenderingHint方法的具体用法?Java Graphics2D.getRenderingHint怎么用?Java Graphics2D.getRenderingHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Graphics2D
的用法示例。
在下文中一共展示了Graphics2D.getRenderingHint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintLayer
import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
protected void paintLayer(Graphics2D g2, JXLayer<? extends V> layer) {
super.paintLayer(g2, layer);
if (this.mainTraceInfo.getPoint() == null) {
return;
}
final Object oldValueAntiAlias = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
final Color oldColor = g2.getColor();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(COLOR_BLUE);
final int BALL_RADIUS = 8;
g2.fillOval((int)(this.mainTraceInfo.getPoint().getX() - (BALL_RADIUS >> 1) + 0.5), (int)(this.mainTraceInfo.getPoint().getY() - (BALL_RADIUS >> 1) + 0.5), BALL_RADIUS, BALL_RADIUS);
for (TraceInfo indicatorTraceInfo : this.indicatorTraceInfos) {
final Point2D point = indicatorTraceInfo.getPoint();
if (null == point) {
continue;
}
g2.fillOval((int)(point.getX() - (BALL_RADIUS >> 1) + 0.5), (int)(point.getY() - (BALL_RADIUS >> 1) + 0.5), BALL_RADIUS, BALL_RADIUS);
}
g2.setColor(oldColor);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldValueAntiAlias);
this.drawInformationBox(g2, layer);
}
示例2: getDefaultLCDContrast
import java.awt.Graphics2D; //导入方法依赖的package包/类
static Integer getDefaultLCDContrast() {
if (defaultContrast == null) {
GraphicsConfiguration gc =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice().getDefaultConfiguration();
Graphics2D g2d =
(Graphics2D)(gc.createCompatibleImage(1,1).getGraphics());
defaultContrast = (Integer)
g2d.getRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST);
}
return defaultContrast;
}
示例3: paintBorder
import java.awt.Graphics2D; //导入方法依赖的package包/类
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2 = (Graphics2D)g;
g2.setPaint(fillColor);
// NOTE: fillRoundRect seems to have poor performance on Linux
// g2.fillRoundRect(x + halfBorderStrokeWidth, y + halfBorderStrokeWidth,
// width - borderStrokeWidth, height - borderStrokeWidth,
// arcRadius * 2, arcRadius * 2);
int arcRadius2 = arcRadius * 2;
int arcRadius2p1 = arcRadius2 + 1;
g2.fillArc(x, y, arcRadius2, arcRadius2, 90, 90);
g2.fillArc(x + width - arcRadius2p1, y, arcRadius2, arcRadius2, 0, 90);
g2.fillArc(x, y + height - arcRadius2p1, arcRadius2, arcRadius2, 180, 90);
g2.fillArc(x + width - arcRadius2p1, y + height - arcRadius2p1, arcRadius2, arcRadius2, 270, 90);
g2.fillRect(x + arcRadius, y, width - arcRadius2p1, height);
g2.fillRect(x, y + arcRadius, arcRadius, height - arcRadius2p1);
g2.fillRect(x + width - arcRadius - 1, y + arcRadius, arcRadius, height - arcRadius2p1);
Object aa = null;
Object sc = null;
if (!forceSpeed) {
aa = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
sc = g2.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
}
g2.setStroke(borderStroke);
g2.setPaint(lineColor);
g2.drawRoundRect(x + halfBorderStrokeWidth, y + halfBorderStrokeWidth,
width - borderStrokeWidth, height - borderStrokeWidth,
arcRadius * 2, arcRadius * 2);
if (!forceSpeed) {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, aa);
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, sc);
}
}