List of utility methods to do ImageIcon
BufferedImage | absoluteDifferenceImage(ImageIcon icon1, ImageIcon icon2, double scale) Generate the absolute difference image between two images return plotRGB(absoluteDifferenceImage(grabRGB(icon1), grabRGB(icon2), scale), icon1.getIconWidth(),
icon1.getIconHeight());
|
ImageIcon | componentToImageIcon(Component c, String description, boolean paintBorder) create an ImageIcon delegate of a component return componentToImageIcon(c, description, paintBorder, 1, Image.SCALE_SMOOTH);
|
BufferedImage | convert(ImageIcon icon) Convert the Input ImageIcon into a BufferedImage with type TYPE_INT_ARGB if (icon == null) { throw new IllegalArgumentException("ImageIcon is null"); BufferedImage buffered = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g = buffered.createGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, ... |
String | createBase64StringFromImage(ImageIcon image) create Base String From Image return null;
|
ImageIcon | createColorImageIcon(int w, int h, int c) Create a colored image icon. BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { img.setRGB(j, i, c); return new ImageIcon(img); |
Cursor | createCursor(ImageIcon cursorIcon, Point hotSpot, String name) create Cursor return createCursor(cursorIcon.getImage(), hotSpot, name);
|
Cursor | createCursor(ImageIcon icon, Point hotspot) Creates a cursor from an ImageIcon if (icon == null) { return null; return createCursor(icon.getImage(), hotspot, icon.getDescription()); |
ImageIcon | createDisabledImage(final ImageIcon imageIcon) Creates a new grayed image based on the image passed in. final GrayFilter filter = new GrayFilter(true, 75); final ImageProducer imageSource = imageIcon.getImage().getSource(); final ImageProducer imageProducer = new FilteredImageSource(imageSource, filter); final Image grayImage = Toolkit.getDefaultToolkit().createImage(imageProducer); return new ImageIcon(grayImage); |
ImageIcon | createEmptyImageIcon(final int width, final int height) Creates an empty image. final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR_PRE); final Graphics2D g = image.createGraphics(); g.dispose(); return new ImageIcon(image); |
ImageIcon | createFileImageIcon(final String path) create File Image Icon try { ImageIcon imageIcon; File file; URL url; file = new File(path); if (!file.exists()) throw new Error(String.format("Image \"%s\" not found.", path)); url = file.toURI().toURL(); ... |