use of java.awt.image.VolatileImage in project jdk8u_jdk by JetBrains.
the class StrikeDisposalCrashTest method renderText.
private static void renderText(Frame frame, Font f1) {
VolatileImage vi = frame.createVolatileImage(256, 32);
vi.validate(frame.getGraphicsConfiguration());
Graphics2D g = vi.createGraphics();
g.setFont(f1);
g.drawString(text, 0, vi.getHeight() / 2);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.drawString(text, 0, vi.getHeight() / 2);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
g.drawString(text, 0, vi.getHeight() / 2);
Toolkit.getDefaultToolkit().sync();
}
use of java.awt.image.VolatileImage in project jdk8u_jdk by JetBrains.
the class MutableColorTest method main.
public static void main(String[] args) {
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
bmImage = gc.createCompatibleImage(64, 64, Transparency.BITMASK);
argbImage = gc.createCompatibleImage(64, 64, Transparency.TRANSLUCENT);
if (gc.getColorModel().getPixelSize() > 8) {
VolatileImage vi = gc.createCompatibleVolatileImage(64, 64, Transparency.OPAQUE);
do {
if (vi.validate(gc) == VolatileImage.IMAGE_INCOMPATIBLE) {
vi = gc.createCompatibleVolatileImage(64, 64, Transparency.OPAQUE);
vi.validate(gc);
}
int color = testImage(vi, false, false);
testResult("vi_noclip_notx", vi.getSnapshot(), color);
color = testImage(vi, true, true);
testResult("vi_clip_tx", vi.getSnapshot(), color);
color = testImage(vi, true, false);
testResult("vi_clip_notx", vi.getSnapshot(), color);
color = testImage(vi, false, true);
testResult("vi_noclip_tx", vi.getSnapshot(), color);
} while (vi.contentsLost());
}
BufferedImage bi = new BufferedImage(64, 64, BufferedImage.TYPE_INT_RGB);
int color = testImage(bi, false, false);
testResult("bi_noclip_notx", bi, color);
color = testImage(bi, true, true);
testResult("bi_clip_tx", bi, color);
color = testImage(bi, true, false);
testResult("bi_clip_notx", bi, color);
color = testImage(bi, false, true);
testResult("bi_noclip_tx", bi, color);
System.err.println("Test passed.");
}
Aggregations