本文整理了Java中java.awt.Graphics2D.setRenderingHints()
方法的一些代码示例,展示了Graphics2D.setRenderingHints()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphics2D.setRenderingHints()
方法的具体详情如下:
包路径:java.awt.Graphics2D
类名称:Graphics2D
方法名:setRenderingHints
暂无
代码示例来源:origin: skylot/jadx
private void applyRenderHints(Graphics g) {
if (g instanceof Graphics2D) {
Graphics2D g2d = (Graphics2D) g;
if (DESKTOP_HINTS != null) {
g2d.setRenderingHints(DESKTOP_HINTS);
} else {
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
}
}
}
代码示例来源:origin: org.apache.poi/poi
public void setRenderingHints(Map<?, ?> map)
{
getG2D().setRenderingHints(map);
}
代码示例来源:origin: pentaho/pentaho-kettle
public void setAntialias( boolean antiAlias ) {
if ( antiAlias ) {
RenderingHints hints =
new RenderingHints( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
hints.add( new RenderingHints( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY ) );
hints.add( new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ) );
// hints.add(new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,
// RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY));
gc.setRenderingHints( hints );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public void setAntialias( boolean antiAlias ) {
if ( antiAlias ) {
RenderingHints hints =
new RenderingHints( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
hints.add( new RenderingHints( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY ) );
hints.add( new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ) );
// hints.add(new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,
// RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY));
gc.setRenderingHints( hints );
}
}
代码示例来源:origin: coobird/thumbnailator
g.setRenderingHints(RENDERING_HINTS);
代码示例来源:origin: redwarp/9-Patch-Resizer
hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
graphics.setRenderingHints(hints);
代码示例来源:origin: plantuml/plantuml
g2.setRenderingHints(hints);
g2.drawImage(ret, 0, 0, w, h, null);
g2.dispose();
代码示例来源:origin: coobird/thumbnailator
g.setRenderingHints(RENDERING_HINTS);
g.setComposite(AlphaComposite.Src);
代码示例来源:origin: org.apache.poi/poi
void createRaster() {
ColorModel cm = getColorModel();
raster = cm.createCompatibleWritableRaster((int)deviceBounds.getWidth(), (int)deviceBounds.getHeight());
BufferedImage img = new BufferedImage(cm, raster, false, null);
Graphics2D graphics = img.createGraphics();
graphics.setRenderingHints(hints);
graphics.translate(-deviceBounds.getX(), -deviceBounds.getY());
graphics.transform(xform);
Raster img2 = pCtx.getRaster(0, 0, gradientSteps, 1);
int[] rgb = new int[cm.getNumComponents()];
for (int i = gradientSteps-1; i>=0; i--) {
img2.getPixel(i, 0, rgb);
Color c = new Color(rgb[0],rgb[1],rgb[2]);
if (rgb.length == 4) {
// it doesn't work to use just a color with transparency ...
graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, rgb[3]/255.0f));
}
graphics.setStroke(new BasicStroke(i+1, capStyle, joinStyle));
graphics.setColor(c);
graphics.draw(shape);
}
graphics.dispose();
}
}
代码示例来源:origin: Dreampie/Resty
graphics.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
int cp = 4 + random.nextInt(3);
int[] xPoints = new int[cp];
代码示例来源:origin: stackoverflow.com
area.add(new Area(pointer));
g2.setRenderingHints(hints);
代码示例来源:origin: apache/pdfbox
@Override
public void setRenderingHints(Map<?, ?> hints)
{
groupG2D.setRenderingHints(hints);
alphaG2D.setRenderingHints(hints);
}
代码示例来源:origin: geotools/geotools
public void setRenderingHints(Map<?, ?> hints) {
delegate.setRenderingHints(hints);
}
代码示例来源:origin: stackoverflow.com
BufferedImage scaledImage = new BufferedImage(
scaledWidth,
scaledHeight,
BufferedImage.TYPE_INT_RGB
);
Graphics2D g = scaledImage.createGraphics();
g.setRenderingHints(
RenderingHints.Key.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC
);
g.drawImage(panelImage, 0, 0, scaledWidth, scaledHeight, null);
g.dispose();
代码示例来源:origin: tomighty/tomighty
private void configureGraphics(Graphics2D g) {
Map<?, ?> desktopHints = (Map<?, ?>) Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints");
if(desktopHints != null) {
g.setRenderingHints(desktopHints);
}
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
}
代码示例来源:origin: apache/pdfbox
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHints(HexView.RENDERING_HINTS);
int x = HexView.LINE_INSET-2;
int y = 16;
g.drawString("Offset", x, y);
x += HexView.ADDRESS_PANE_WIDTH + 2;
for (int i = 0; i <= 15; i++)
{
g.drawString(String.format("%02X", i), x, y);
x += HexView.CHAR_WIDTH;
}
x+=HexView.LINE_INSET*2;
g.drawString("Text", x, y);
}
}
代码示例来源:origin: RaiMan/SikuliX2
@Override
public void paintComponent(Graphics g){
Dimension d = new Dimension(textBox.width + triangle.width, textBox.height);
Dimension originalSize = canonicalSize;
Dimension actualSize = getActualSize();
float scalex = 1f * actualSize.width / originalSize.width;
float scaley = 1f * actualSize.height / originalSize.height;
((Graphics2D) g).scale(scalex, scaley);
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setFont(font);
g2d.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON));
g2d.setColor(colorFront);
g2d.fill(flagShape);
// draw outline
Stroke pen = new BasicStroke(1.0F);
g2d.setStroke(pen);
g2d.setColor(colorFrame);
g2d.draw(flagShape);
g2d.setColor(colorText);
g2d.drawString(text, textBox.x + PADDING_X,
textBox.y + textBox.height - fm.getDescent() - PADDING_Y);
}
}
代码示例来源: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
g2d.setRenderingHints(HexView.RENDERING_HINTS);
代码示例来源:origin: apache/pdfbox
g2d.setRenderingHints(HexView.RENDERING_HINTS);
内容来源于网络,如有侵权,请联系作者删除!