use of java.awt.Graphics2D in project jdk8u_jdk by JetBrains.
the class RLECompressionTest method getTestImage.
private BufferedImage getTestImage(int type) {
BufferedImage src = null;
IndexColorModel icm = getTestColorModel(type);
src = new BufferedImage(w, h, BufferedImage.TYPE_BYTE_INDEXED, icm);
Graphics2D g = src.createGraphics();
g.setColor(Color.white);
g.fillRect(0, 0, w, h);
g.dispose();
return src;
}
use of java.awt.Graphics2D in project jdk8u_jdk by JetBrains.
the class Write3ByteBgrTest method createTestImage.
private static BufferedImage createTestImage(int type, Color c) {
BufferedImage i = null;
if (type == BufferedImage.TYPE_CUSTOM) {
WritableRaster wr = Raster.createBandedRaster(DataBuffer.TYPE_BYTE, width, height, // scanlineStride
width, // bankIndices[],
new int[] { 0, 1, 2 }, // bankOffsets[],
new int[] { 1, 2, 0 }, null);
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel cm = new ComponentColorModel(cs, new int[] { 8, 8, 8 }, false, false, ColorModel.OPAQUE, DataBuffer.TYPE_BYTE);
i = new BufferedImage(cm, wr, false, null);
} else {
i = new BufferedImage(width, height, type);
}
Graphics2D g = i.createGraphics();
g.setColor(c);
g.fillRect(0, 0, width, height);
g.setColor(Color.white);
g.drawRect(10, 10, width - 20, height - 20);
return i;
}
use of java.awt.Graphics2D in project jdk8u_jdk by JetBrains.
the class WritingColorChangeTest method createTestImage.
private static BufferedImage createTestImage(int type, Color c) {
BufferedImage i = new BufferedImage(width, height, type);
Graphics2D g = i.createGraphics();
g.setColor(c);
g.fillRect(0, 0, width, height);
return i;
}
use of java.awt.Graphics2D in project jdk8u_jdk by JetBrains.
the class bug8032667 method getImage.
static Image getImage(JComponent component) {
final BufferedImage image = new BufferedImage(scaledWidth, scaledHeight, BufferedImage.TYPE_INT_ARGB);
final Graphics g = image.getGraphics();
((Graphics2D) g).scale(scale, scale);
component.paint(g);
g.dispose();
return image;
}
use of java.awt.Graphics2D in project jdk8u_jdk by JetBrains.
the class bug8032667_image_diff method getImage.
static BufferedImage getImage(JComponent component, int scale, int width, int height) {
final BufferedImage image = new BufferedImage(scale * width, scale * height, BufferedImage.TYPE_INT_ARGB);
final Graphics g = image.getGraphics();
((Graphics2D) g).scale(scale, scale);
component.paint(g);
g.dispose();
return image;
}
Aggregations