Create a sprite from its filename.

@param media The sprite media.
@return The sprite instance.
@throws LionEngineException If media is <code>null</code> or image cannot be read.
549186
protected static Sprite createSprite(Media media)
    {
        final Sprite sprite = Drawable.loadSprite(media);
        sprite.load();
        sprite.prepare();
        return sprite;
    }
659390
private static String getMessage(Media media)
    {
        Check.notNull(media);

        return new StringBuilder(Constant.BYTE_4).append('[').append(media.getPath()).append("] ").toString();
    }
25037
def create_sprite(images, width, height)
      library.create(output_image_file, images, width, height)
      pngcrush(output_image_file)
    end
360360
public static synchronized Audio loadAudio(Media media)
    {
        Check.notNull(media);

        final String extension = UtilFile.getExtension(media.getPath());
        return Optional.ofNullable(FACTORIES.get(extension))
                       .orElseThrow(() -> new LionEngineException(media, ERROR_FORMAT))
                       .loadAudio(media);
    }
172640
protected Component createContentPane() {
		Image image = getImage();
		if (image != null) {
			return new ImageCanvas(image);
		}
		return null;
	}
33684
public static BufferedImage loadImage(String fileName){
		File f = new File(fileName);
		if(f.exists()){
			return loadImage(f);
		}
		throw new ImageLoaderException(new FileNotFoundException(fileName));
	}
501999
public static File createMediaFile(String dirName) {
        String timeStamp = IMG_FILE_NAME_FORMAT.format(new Date());
        String imageFileName = PREFIX_IMAGE + timeStamp + EXTENSION_JPEG;
        return new File(getMediaDir(dirName), imageFileName);
    }
460862
public AnimatedImageResult build() {
    try {
      return new AnimatedImageResult(this);
    } finally {
      CloseableReference.closeSafely(mPreviewBitmap);
      mPreviewBitmap = null;
      CloseableReference.closeSafely(mDecodedFrames);
      mDecodedFrames = null;
    }
  }
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;
	}
28477
public static synchronized File getJarResources()
    {
        if (!loader.isPresent())
        {
            throw new LionEngineException(JAR_LOADER_ERROR);
        }

        final Media media = Medias.create(Constant.EMPTY_STRING);
        final String path = media.getFile().getPath().replace(File.separator, Constant.SLASH);
        final String prefix = loader.get().getPackage().getName().replace(Constant.DOT, Constant.SLASH);
        final int jarSeparatorIndex = path.indexOf(prefix);
        final String jar = path.substring(0, jarSeparatorIndex);

        return new File(jar);
    }
1035898
public static BufferedImage copyImage(BufferedImage image)
    {
        final BufferedImage copy = createImage(image.getWidth(),
                                               image.getHeight(),
                                               image.getColorModel().getTransparency());
        final Graphics2D g = copy.createGraphics();
        g.setComposite(AlphaComposite.Src);
        g.drawImage(image, 0, 0, null);
        g.dispose();
        return copy;
    }
440956
private Xml getNode(String... path)
    {
        Xml node = root;
        for (final String element : path)
        {
            try
            {
                node = node.getChild(element);
            }
            catch (final LionEngineException exception)
            {
                throw new LionEngineException(exception, media);
            }
        }
        return node;
    }
950320
public Drawable createFromStream(InputStream is, String srcName) {
        return createFromResourceStream(null, is, srcName);
    }
907712
public static GifImage create(byte[] source) {
    ensure();
    Preconditions.checkNotNull(source);

    ByteBuffer byteBuffer = ByteBuffer.allocateDirect(source.length);
    byteBuffer.put(source);
    byteBuffer.rewind();

    return nativeCreateFromDirectByteBuffer(byteBuffer);
  }
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");
	}
1207957
public static final synchronized void start(Engine engine)
    {
        Check.notNull(engine);

        if (started)
        {
            throw new LionEngineException(ERROR_STARTED_ALREADY);
        }
        Verbose.info(new StringBuilder(MIN_LENGTH).append(ENGINE_STARTING)
                                                  .append(Constant.ENGINE_VERSION)
                                                  .append(Constant.QUOTE)
                                                  .append(FOR)
                                                  .append(Constant.QUOTE)
                                                  .append(engine.getName())
                                                  .append(Constant.SPACE)
                                                  .append(engine.getVersion())
                                                  .append(Constant.QUOTE)
                                                  .toString());

        Medias.setFactoryMedia(new FactoryMediaDefault());

        engine.open();
        Engine.engine = engine;
        started = true;
    }
345797
public static ImageView createImageInstance(Context context) {
        if (sImageClass != null) {
            if (imageViewConstructor == null) {
                try {
                    imageViewConstructor = sImageClass.getConstructor(Context.class);
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
            }
            if (imageViewConstructor != null) {
                try {
                    return (ImageView) imageViewConstructor.newInstance(context);
                } catch (InstantiationException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                }
            }
        }
        return null;
    }