本文整理匯總了Java中java.awt.RenderingHints.VALUE_ANTIALIAS_OFF屬性的典型用法代碼示例。如果您正苦於以下問題:Java RenderingHints.VALUE_ANTIALIAS_OFF屬性的具體用法?Java RenderingHints.VALUE_ANTIALIAS_OFF怎麽用?Java RenderingHints.VALUE_ANTIALIAS_OFF使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.RenderingHints
的用法示例。
在下文中一共展示了RenderingHints.VALUE_ANTIALIAS_OFF屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == cmbPaint) {
paintType = (PaintType)cmbPaint.getSelectedItem();
} else if (source == cmbCycle) {
cycleMethod = (CycleMethod)cmbCycle.getSelectedItem();
} else if (source == cmbSpace) {
colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem();
} else if (source == cmbShape) {
shapeType = (ShapeType)cmbShape.getSelectedItem();
} else if (source == cmbXform) {
xformType = (XformType)cmbXform.getSelectedItem();
} else if (source == cbAntialias) {
antialiasHint = cbAntialias.isSelected() ?
RenderingHints.VALUE_ANTIALIAS_ON :
RenderingHints.VALUE_ANTIALIAS_OFF;
} else if (source == cbRender) {
renderHint = cbRender.isSelected() ?
RenderingHints.VALUE_RENDER_QUALITY :
RenderingHints.VALUE_RENDER_SPEED;
}
gradientPanel.updatePaint();
}
示例2: render
@Override
public BufferedImage render(final BufferedImage baseImage) {
int width = baseImage.getWidth();
int height = baseImage.getHeight();
// create an opaque image
RenderingHints hints = new RenderingHints(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
hints.add(new RenderingHints(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY));
hints.add(new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY));
hints.add(new RenderingHints(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY));
BufferedImage imageWithBackground = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Graphics2D graph = (Graphics2D) imageWithBackground.getGraphics();
graph.setRenderingHints(hints);
graph.setPaint(new GradientPaint(0, 0, colorFrom, width, height, colorTo));
graph.fill(new Rectangle2D.Double(0, 0, width, height));
graph.drawImage(baseImage, 0, 0, null);
graph.dispose();
return imageWithBackground;
}