Factory method for create a new {@link ImageIcon}.

@param image
the file that contains the image
@return the new {@link ImageIcon}
496092
public static ImageIcon newImageIcon(File image)
	{
		ImageIcon img = new ImageIcon(image.getAbsolutePath());
		return img;
	}
951588
public static Graphics2D createGraphics(BufferedImage image, Color color) {
		final Graphics2D g = image.createGraphics();
		// 填充背景
		g.setColor(color);
		g.fillRect(0, 0, image.getWidth(), image.getHeight());

		return g;
	}
480364
public void updateIcon(long identifier, ImageHolder image) {
        IDrawerItem drawerItem = getDrawerItem(identifier);
        if (drawerItem instanceof Iconable) {
            Iconable pdi = (Iconable) drawerItem;
            pdi.withIcon(image);
            updateItem((IDrawerItem) pdi);
        }
    }
389419
@Override
    public ImageIcon getImageIconResource( final String       key,
                                           final ImageIcon    defaultValue )
        throws
            UtilException
    {
        String    imagePath = getFormattedPropValue( key );

        if ( imagePath == null )
        {
            return defaultValue;
        }

        return resourceToImageIcon( imagePath );
    }
1234852
public CalculusBuilder analyze(ImageView image) {

        if(image == null)
            throw new IllegalArgumentException("Image must not be null");

        mImage = Utils.getBitmapFromImageView(image);

        return new CalculusBuilder(mImage);
    }
302217
public void setIcon(Image image) {

        m_iconPanel.setVisible(true);
        if (image == null) {
            return;
        }
        m_iconPanel.setWidget(image);
    }
759092
public static BufferedImage cloneImage( BufferedImage image ) {
		BufferedImage newImage = new BufferedImage( image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB );
		Graphics2D g = newImage.createGraphics();
		g.drawRenderedImage( image, null );
		g.dispose();
		return newImage;
	}
87579
public ServerBuilder setIcon(InputStream icon, String fileType) {
        delegate.setIcon(icon, fileType);
        return this;
    }
598250
public BufferedImage copyImage(BufferedImage image) {
        BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
        Graphics2D g2d = newImage.createGraphics();
        g2d.drawImage(image, 0, 0, null);
        g2d.dispose();
        return newImage;
    }
982206
public static Img getSmallLayerIcon(Layer<?> layer) {
		String url = getSmallLayerIconUrl(layer);
		if (url != null) {
			return new Img(url);
		} else {
			return null;
		}
	}
809124
public INDArray toRaveledTensor(BufferedImage image) {
        try {
            image = scalingIfNeed(image, false);
            return toINDArrayBGR(image).ravel();
        } catch (Exception e) {
            throw new RuntimeException("Unable to load image", e);
        }
    }
147078
public IconType<FacesConfigManagedPropertyType<T>> getOrCreateIcon()
   {
      List<Node> nodeList = childNode.get("icon");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new IconTypeImpl<FacesConfigManagedPropertyType<T>>(this, "icon", childNode, nodeList.get(0));
      }
      return createIcon();
   }
974043
protected static BufferedImage toBufferedImage(Image image) {
        if (image instanceof BufferedImage) {
            return (BufferedImage) image;
        }

        // This code ensures that all the pixels in the image are loaded
        image = new ImageIcon(image).getImage();

        // Determine if the image has transparent pixels; for this method's
        // implementation, see e661 Determining If an Image Has Transparent
        // Pixels
        boolean hasAlpha = hasAlpha(image);

        // Create a buffered image with a format that's compatible with the
        // screen
        BufferedImage       bimage = null;
        GraphicsEnvironment ge     = GraphicsEnvironment.getLocalGraphicsEnvironment();

        try {

            // Determine the type of transparency of the new buffered image
            int transparency = Transparency.OPAQUE;

            if (hasAlpha) {
                transparency = Transparency.BITMASK;
            }

            // Create the buffered image
            GraphicsDevice        gs = ge.getDefaultScreenDevice();
            GraphicsConfiguration gc = gs.getDefaultConfiguration();

            bimage = gc.createCompatibleImage(image.getWidth(null), image.getHeight(null), transparency);
        } catch (HeadlessException e) {
            // The system does not have a screen
        }

        if (bimage == null) {

            // Create a buffered image using the default color model
            int type = BufferedImage.TYPE_INT_RGB;

            if (hasAlpha) {
                type = BufferedImage.TYPE_INT_ARGB;
            }

            bimage = new BufferedImage(image.getWidth(null), image.getHeight(null), type);
        }

        // Copy image to buffered image
        Graphics g = bimage.createGraphics();

        // Paint the image onto the buffered image
        g.drawImage(image, 0, 0, null);
        g.dispose();

        return bimage;
    }
1165567
public static Graphics2D createGraphics(BufferedImage image, Color color) {
		return GraphicsUtil.createGraphics(image, color);
	}
877389
private static Graphics createGraphics(Image image) throws SlickException {
		init();
		
		if (fbo) {
			try {
				return new FBOGraphics(image);
			} catch (Exception e) {
				fbo = false;
				Log.warn("FBO failed in use, falling back to PBuffer");
			}
		}
		
		if (pbuffer) {
			if (pbufferRT) {
				return new PBufferGraphics(image);
			} else {
				return new PBufferUniqueGraphics(image);
			}
		}
		
		throw new SlickException("Failed to create offscreen buffer even though the card reports it's possible");
	}
214865
private ImageIcon createIcon(String resourcePath) {
		if (getView() == null) {
			return null;
		}
		return new ImageIcon(ExtensionScript.class.getResource(resourcePath));
	}
1220455
public static BufferedImage rotate(BufferedImage image, int angle)
    {
        final int width = image.getWidth();
        final int height = image.getHeight();
        final int transparency = image.getColorModel().getTransparency();

        final Rectangle rectangle = new Rectangle(0, 0, width, height);
        rectangle.rotate(angle);

        final BufferedImage rotated = createImage(rectangle.getWidth(), rectangle.getHeight(), transparency);
        final Graphics2D g = rotated.createGraphics();

        optimizeGraphicsSpeed(g);
        g.rotate(Math.toRadians(angle), rectangle.getWidth() / 2.0, rectangle.getHeight() / 2.0);

        final double ox = rectangle.getWidth() - (double) width;
        final double oy = rectangle.getHeight() - (double) height;
        final double cos = UtilMath.cos(angle);
        final double sin = UtilMath.sin(angle);
        final double angleOffsetX = sin * ox + cos * oy;
        final double angleOffsetY = -sin * oy + cos * ox;

        g.drawImage(image, null, (int) ((ox - angleOffsetX) / 2.0), (int) ((oy - angleOffsetY) / 2.0));
        g.dispose();

        return rotated;
    }