use of java.awt.image.FilteredImageSource in project cayenne by apache.
the class FilteredIconFactory method createIcon.
public static Icon createIcon(Icon icon, FilterType filterType) {
if (icon != null && icon.getIconWidth() > 0 && icon.getIconHeight() > 0) {
BufferedImage img = new BufferedImage(icon.getIconWidth(), icon.getIconWidth(), BufferedImage.TYPE_INT_ARGB);
icon.paintIcon(DUMMY, img.getGraphics(), 0, 0);
ImageProducer producer = new FilteredImageSource(img.getSource(), filterType.filter);
Image resultImage = DUMMY.createImage(producer);
return new ImageIcon(resultImage);
}
return null;
}
Aggregations