22 package com.realtime.crossfire.jxclient.faces;
24 import java.awt.image.BufferedImage;
25 import javax.swing.Icon;
26 import javax.swing.ImageIcon;
27 import org.jetbrains.annotations.NotNull;
56 width = srcImageIcon.getIconWidth();
57 height = srcImageIcon.getIconHeight();
59 srcData =
new int[width*
height];
60 final BufferedImage srcBufferedImage =
new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
61 srcImageIcon.paintIcon(null, srcBufferedImage.getGraphics(), 0, 0);
62 srcBufferedImage.getRGB(0, 0, width, height, srcData, 0, width);
74 final BufferedImage image =
new BufferedImage(width/8, height/8, BufferedImage.TYPE_INT_ARGB);
75 image.setRGB(0, 0, width/8, height/8, scaler.
getScaledData(), 0, width/8);
77 return new ImageIcon(image);
final int [] srcData
The source data from the image.
int [] getScaledData()
Returns the scale image data.
final int height
The height of the image.
ImageScale8d(@NotNull final Icon srcImageIcon)
Creates a new instance.
A utility to scale down an image by 8 in both dimensions.
final int width
The width of the image.
Scales down a raw image to an eighth in both dimensions.
ImageIcon getScaledImage()
Returns the scaled image.