use of java.awt.image.RescaleOp in project java-swing-tips by aterai.
the class LookAndFeelUtil method makeRolloverIcon.
private static Icon makeRolloverIcon(Icon srcIcon) {
int w = srcIcon.getIconWidth();
int h = srcIcon.getIconHeight();
BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = img.createGraphics();
srcIcon.paintIcon(null, g2, 0, 0);
float[] scaleFactors = { 1.2f, 1.2f, 1.2f, 1f };
float[] offsets = { 0f, 0f, 0f, 0f };
RescaleOp op = new RescaleOp(scaleFactors, offsets, g2.getRenderingHints());
g2.dispose();
return new ImageIcon(op.filter(img, null));
}
use of java.awt.image.RescaleOp in project java-swing-tips by aterai.
the class RightPopupBasicComboBoxUI method makeRolloverIcon.
private static Icon makeRolloverIcon(Icon srcIcon) {
int w = srcIcon.getIconWidth();
int h = srcIcon.getIconHeight();
BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = img.createGraphics();
srcIcon.paintIcon(null, g2, 0, 0);
float[] scaleFactors = { 1.2f, 1.2f, 1.2f, 1f };
float[] offsets = { 0f, 0f, 0f, 0f };
BufferedImageOp op = new RescaleOp(scaleFactors, offsets, g2.getRenderingHints());
g2.dispose();
return new ImageIcon(op.filter(img, null));
}
Aggregations