本文整理汇总了Java中java.awt.image.BufferedImage.TYPE_INT_ARGB属性的典型用法代码示例。如果您正苦于以下问题:Java BufferedImage.TYPE_INT_ARGB属性的具体用法?Java BufferedImage.TYPE_INT_ARGB怎么用?Java BufferedImage.TYPE_INT_ARGB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.image.BufferedImage
的用法示例。
在下文中一共展示了BufferedImage.TYPE_INT_ARGB属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImageGenerator
public ImageGenerator(int _width, int _height, Color bgColor)
{
width = _width;
height = _height;
bi = new BufferedImage(
width,
height,
BufferedImage.TYPE_INT_ARGB);
Graphics gr = bi.getGraphics();
if(null==bgColor){
bgColor = Color.WHITE;
}
gr.setColor(bgColor);
gr.fillRect(0, 0, width, height);
paint(gr);
gr.dispose();
}
示例2: makeTexturePaint
private TexturePaint makeTexturePaint(int size, boolean alpha) {
int s2 = size / 2;
int type =
alpha ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB;
BufferedImage img = new BufferedImage(size, size, type);
Color[] colors = makeGradientColors(4, alpha);
Graphics2D g2d = img.createGraphics();
g2d.setComposite(AlphaComposite.Src);
g2d.setColor(colors[0]);
g2d.fillRect(0, 0, s2, s2);
g2d.setColor(colors[1]);
g2d.fillRect(s2, 0, s2, s2);
g2d.setColor(colors[3]);
g2d.fillRect(0, s2, s2, s2);
g2d.setColor(colors[2]);
g2d.fillRect(s2, s2, s2, s2);
g2d.dispose();
Rectangle2D bounds = new Rectangle2D.Float(0, 0, size, size);
return new TexturePaint(img, bounds);
}
示例3: resizeToBig
private Image resizeToBig(Image originalImage, int biggerWidth, int biggerHeight) {
final BufferedImage resizedImage = new BufferedImage(biggerWidth, biggerHeight,
BufferedImage.TYPE_INT_ARGB);
final Graphics2D g = resizedImage.createGraphics();
g.setComposite(AlphaComposite.Src);
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.drawImage(originalImage, 0, 0, biggerWidth, biggerHeight, this);
g.dispose();
return resizedImage;
}
示例4: paintComponent
/**
* Paint the component using the Nimbus Table Header Background Painter
*/
@Override protected void paintComponent(Graphics g) {
@SuppressWarnings("unchecked")
Painter<JComponent> painter = (Painter) UIManager.get(
"TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter");
if (painter != null){
if (g instanceof Graphics2D){
painter.paint((Graphics2D)g,this,getWidth()+1,getHeight());
} else {
// paint using image to not Graphics2D to support
// Java 1.1 printing API
BufferedImage img = new BufferedImage(getWidth(),getHeight(),
BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D)img.getGraphics();
painter.paint(g2,this,getWidth()+1,getHeight());
g2.dispose();
g.drawImage(img,0,0,null);
img = null;
}
}
}
示例5: paintComponent
/**
* Paint the component using the Nimbus Table Header Background Painter
*/
@Override protected void paintComponent(Graphics g) {
Painter painter = (Painter) UIManager.get(
"TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter");
if (painter != null){
if (g instanceof Graphics2D){
painter.paint((Graphics2D)g,this,getWidth()+1,getHeight());
} else {
// paint using image to not Graphics2D to support
// Java 1.1 printing API
BufferedImage img = new BufferedImage(getWidth(),getHeight(),
BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D)img.getGraphics();
painter.paint(g2,this,getWidth()+1,getHeight());
g2.dispose();
g.drawImage(img,0,0,null);
img = null;
}
}
}
示例6: getBufferedImage
/**
* Resize and return the image passing the new height and width
* @param height
* @param width
* @return
*/
public BufferedImage getBufferedImage(int width, int height)
{
// using the new approach of Java 2D API
BufferedImage buf = new BufferedImage(width,height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D) buf.getGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.drawImage(image,0,0,width,height,null);
g2d.dispose();
return(buf);
}
示例7: getImage
public Image getImage() {
BufferedImage image =
new BufferedImage(getIconWidth(), getIconHeight(),
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
paintIcon(null, g, 0, 0);
g.dispose();
return image;
}
示例8: toBufferedImage
private BufferedImage toBufferedImage(Image source) {
if (source instanceof BufferedImage) {
return (BufferedImage) source;
}
// Create a buffered image with transparency
BufferedImage dest = new BufferedImage(source.getWidth(null), source.getHeight(null), BufferedImage.TYPE_INT_ARGB);
// Draw the image on to the buffered image
Graphics2D g = dest.createGraphics();
g.drawImage(source, 0, 0, null);
g.dispose();
return dest;
}
示例9: makeIcon
private static Image makeIcon(long hIcon, boolean getLargeIcon) {
if (hIcon != 0L && hIcon != -1L) {
// Get the bits. This has the side effect of setting the imageHash value for this object.
int size = getLargeIcon ? 32 : 16;
int[] iconBits = getIconBits(hIcon, size);
if (iconBits != null) {
BufferedImage img = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
img.setRGB(0, 0, size, size, iconBits, 0, size);
return img;
}
}
return null;
}
示例10: drawCentered
protected void drawCentered(Component c, Graphics graphics, Icon icon,
int x, int y) {
int w = icon.getIconWidth();
int h = icon.getIconHeight();
image[0] = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
super.drawCentered(c, image[0].getGraphics(), icon, w / 2, h / 2);
}
示例11: prepareTileset
private BufferedImage prepareTileset(ROM rom, ROMData data, BlockRenderer renderer, MapData mapData, boolean complete) {
Tileset global = TilesetCache.get(rom, data, mapData.getGlobalTilesetPtr());
Tileset local = TilesetCache.get(rom, data, mapData.getLocalTilesetPtr());
renderer.setTilesets(global, local);
Dimension dimension = getDimension(data);
if (complete && rom.getGame().isGem()) {
dimension.height = 3048;
}
return new BufferedImage(dimension.width, dimension.height, BufferedImage.TYPE_INT_ARGB);
}
示例12: toBufferedImage
public static BufferedImage toBufferedImage(final ImageIcon icon) {
if (icon == null) return null;
final int w = icon.getIconWidth(), h = icon.getIconHeight();
final BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
final Graphics g = bi.createGraphics();
icon.paintIcon(null, g, 0,0);
g.dispose();
return bi;
}
示例13: resizeImageSmooth
public static BufferedImage resizeImageSmooth(BufferedImage image, int wantedWidth, int wantedHeight) {
Image scaledImage = image.getScaledInstance(wantedWidth, wantedHeight, Image.SCALE_SMOOTH);
BufferedImage imageBuff = new BufferedImage(wantedWidth, wantedHeight, BufferedImage.TYPE_INT_ARGB);
Graphics g = imageBuff.createGraphics();
g.drawImage(scaledImage, 0, 0, null, null);
g.dispose();
return imageBuff;
}
示例14: createWindowImage
private Image createWindowImage() {
int iw = (int) (sw + 0.99);
int ih = (int) (sh + 0.99);
BufferedImage image = new BufferedImage(iw, ih,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
fillBackground(g);
drawTitleBar(g);
drawWindowBody(g);
return image;
}
示例15: getImgARGB
public static BufferedImage getImgARGB(final String name) {
try {
BufferedImage img = ImageIO.read(new File(name));
if (img != null) {
BufferedImage img2 = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D) img2.getGraphics();
g2.drawImage(img, null, 0, 0);
g2.dispose();
return img2;
}
} catch (IOException ex) {
Logger.getLogger(DataLoader.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}