List of utility methods to do Image Create
Image | createImage(byte[] data) create Image return new ImageIcon(data).getImage(); |
BufferedImage | createImage(Component comp, Icon icon) create Image return createImage(comp, icon, null);
|
BufferedImage | createImage(Icon icon) Returns an image got by drawing an Icon. int w = icon.getIconWidth(); int h = icon.getIconHeight(); BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); Color color = g2.getColor(); Composite compos = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC)); g2.setColor(new Color(1f, 1f, 1f, 0f)); ... |
BufferedImage | createImage(JPanel panel) Crea una imagen del contenido de un JPanel int w = panel.getWidth(); int h = panel.getHeight(); BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g = bi.createGraphics(); panel.paint(g); return bi; |
Icon | createImage(String str) create Image final int ICON_DIMENSION = 16; final Color BG_COLOR = new Color(96, 224, 96); if (str.length() > 1) return null; BufferedImage image = new BufferedImage(ICON_DIMENSION, ICON_DIMENSION, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setComposite(AlphaComposite.Src); graphics.setColor(new Color(0, 0, 0, 0)); ... |
Image | createImage(URL url, String description, boolean checkPresence) create Image return createImageIcon(url, description, null, null).getImage();
|
BufferedImage | createImageCopy(Image image) create Image Copy return createImageCopy(image, false);
|
ImageIcon | createImageFromBase64String(String s) create Image From Base String return null;
|
BufferedImage | createImageFromInvisibleComponent(JComponent component) create Image From Invisible Component Dimension componentSize = component.getPreferredSize(); component.setDoubleBuffered(false); component.setSize(componentSize); component.addNotify(); component.validate(); BufferedImage img = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getDefaultConfiguration().createCompatibleImage(component.getWidth(), component.getHeight()); Graphics2D grap = img.createGraphics(); ... |
BufferedImage | createImageFromVisibleComponent(JComponent comp, int cw, int ch) create Image From Visible Component BufferedImage retImage = null; if (comp == null) return retImage; try { GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = genv.getDefaultScreenDevice(); GraphicsConfiguration gc = gd.getDefaultConfiguration(); java.awt.image.ColorModel cm = gc.getColorModel(); ... |