use of java.awt.Graphics in project jdk8u_jdk by JetBrains.
the class MultiResolutionToolkitImageTest method generateImage.
static void generateImage(int scale) throws Exception {
BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setColor(scale == 1 ? COLOR_1X : COLOR_2X);
g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT);
File file = new File(scale == 1 ? IMAGE_NAME_1X : IMAGE_NAME_2X);
ImageIO.write(image, "png", file);
}
use of java.awt.Graphics in project jdk8u_jdk by JetBrains.
the class MultiResolutionCachedImageTest method createImage.
private static Image createImage(int width, int height) {
BufferedImage buffImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = buffImage.createGraphics();
g.setColor(TEST_COLOR);
g.fillRect(0, 0, width, height);
return buffImage;
}
use of java.awt.Graphics in project jdk8u_jdk by JetBrains.
the class IconTest method generateImage.
private static BufferedImage generateImage(int scale, Color c) {
int x = SZ * scale;
BufferedImage img = new BufferedImage(x, x, BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
try {
if (g != null) {
g.setColor(c);
g.fillRect(0, 0, x, x);
g.setColor(Color.GREEN);
g.drawRect(0, 0, x - 1, x - 1);
}
} finally {
g.dispose();
}
return img;
}
use of java.awt.Graphics in project jdk8u_jdk by JetBrains.
the class MultiResolutionTrayIconTest method generateImage.
private static BufferedImage generateImage(int w, int h, int scale, Color c) {
int x = w * scale, y = h * scale;
BufferedImage img = new BufferedImage(x, y, BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
g.setColor(c);
g.fillRect(0, 0, x, y);
g.setColor(Color.WHITE);
g.fillRect(x / 3, y / 3, x / 3, y / 3);
return img;
}
use of java.awt.Graphics in project jdk8u_jdk by JetBrains.
the class DestTypeTest method createTestImage.
public static BufferedImage createTestImage(int type) {
int w = 100;
int h = 500;
BufferedImage bi = new BufferedImage(3 * w, h, type);
Graphics g = bi.createGraphics();
g.setColor(Color.red);
g.fillRect(0, 0, w, h);
g.setColor(Color.green);
g.fillRect(w, 0, w, h);
g.setColor(Color.blue);
g.fillRect(2 * w, 0, w, h);
return bi;
}
Aggregations