Java 类org.newdawn.slick.opengl.ImageDataFactory 实例源码

项目:trashjam2017    文件:BigImage.java   
/**
 * Create a new big image by loading it from the specified reference
 * 
 * @param ref The reference to the image to load
 * @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
 * @param tileSize The maximum size of the tiles to use to build the bigger image
 * @throws SlickException Indicates we were unable to locate the resource
 */
private void build(String ref, int filter, int tileSize) throws SlickException {
    try {
        final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
        final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
        build(data, imageBuffer, filter, tileSize);
    } catch (IOException e) {
        throw new SlickException("Failed to load: "+ref, e);
    }
}
项目:Progetto-C    文件:BigImage.java   
/**
 * Create a new big image by loading it from the specified reference
 * 
 * @param ref The reference to the image to load
 * @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
 * @param tileSize The maximum size of the tiles to use to build the bigger image
 * @throws SlickException Indicates we were unable to locate the resource
 */
private void build(String ref, int filter, int tileSize) throws SlickException {
    try {
        final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
        final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
        build(data, imageBuffer, filter, tileSize);
    } catch (IOException e) {
        throw new SlickException("Failed to load: "+ref, e);
    }
}
项目:BaseClient    文件:BigImage.java   
/**
 * Create a new big image by loading it from the specified reference
 * 
 * @param ref The reference to the image to load
 * @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
 * @param tileSize The maximum size of the tiles to use to build the bigger image
 * @throws SlickException Indicates we were unable to locate the resource
 */
private void build(String ref, int filter, int tileSize) throws SlickException {
    try {
        final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
        final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
        build(data, imageBuffer, filter, tileSize);
    } catch (IOException e) {
        throw new SlickException("Failed to load: "+ref, e);
    }
}
项目:osu-beatmap-utils    文件:ImageLoader.java   
@Override
public void run() {
    // load image data into a ByteBuffer to use constructor Image(ImageData)
    LoadableImageData imageData = ImageDataFactory.getImageDataFor(file.getAbsolutePath());
    try (BufferedInputStream in = this.in = new BufferedInputStream(new FileInputStream(file))) {
        ByteBuffer textureBuffer = imageData.loadImage(in, false, null);
        if (!isInterrupted())
            data = new LoadedImageData(imageData, textureBuffer);
    } catch (Exception e) {
        if (!isInterrupted())
            Log.warn(String.format("Failed to load background image '%s'.", file), e);
    }
    this.in = null;
}
项目:opsu-dance    文件:ImageLoader.java   
@Override
public void run() {
    // load image data into a ByteBuffer to use constructor Image(ImageData)
    LoadableImageData imageData = ImageDataFactory.getImageDataFor(file.getAbsolutePath());
    try (BufferedInputStream in = this.in = new BufferedInputStream(new FileInputStream(file))) {
        ByteBuffer textureBuffer = imageData.loadImage(in, false, null);
        if (!isInterrupted())
            data = new LoadedImageData(imageData, textureBuffer);
    } catch (IOException e) {
        if (!isInterrupted())
            Log.warn(String.format("Failed to load background image '%s'.", file), e);
    }
    this.in = null;
}
项目:code404    文件:BigImage.java   
/**
 * Create a new big image by loading it from the specified reference
 * 
 * @param ref The reference to the image to load
 * @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
 * @param tileSize The maximum size of the tiles to use to build the bigger image
 * @throws SlickException Indicates we were unable to locate the resource
 */
private void build(String ref, int filter, int tileSize) throws SlickException {
    try {
        final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
        final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
        build(data, imageBuffer, filter, tileSize);
    } catch (IOException e) {
        throw new SlickException("Failed to load: "+ref, e);
    }
}
项目:opsu    文件:ImageLoader.java   
@Override
public void run() {
    // load image data into a ByteBuffer to use constructor Image(ImageData)
    LoadableImageData imageData = ImageDataFactory.getImageDataFor(file.getAbsolutePath());
    try (BufferedInputStream in = this.in = new BufferedInputStream(new FileInputStream(file))) {
        ByteBuffer textureBuffer = imageData.loadImage(in, false, null);
        if (!isInterrupted())
            data = new LoadedImageData(imageData, textureBuffer);
    } catch (Exception e) {
        if (!isInterrupted())
            Log.warn(String.format("Failed to load background image '%s'.", file), e);
    }
    this.in = null;
}
项目:GPVM    文件:BigImage.java   
/**
 * Create a new big image by loading it from the specified reference
 * 
 * @param ref The reference to the image to load
 * @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
 * @param tileSize The maximum size of the tiles to use to build the bigger image
 * @throws SlickException Indicates we were unable to locate the resource
 */
private void build(String ref, int filter, int tileSize) throws SlickException {
    try {
        final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
        final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
        build(data, imageBuffer, filter, tileSize);
    } catch (IOException e) {
        throw new SlickException("Failed to load: "+ref, e);
    }
}
项目:GPVM    文件:BigImage.java   
/**
 * Create a new big image by loading it from the specified reference
 * 
 * @param ref The reference to the image to load
 * @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
 * @param tileSize The maximum size of the tiles to use to build the bigger image
 * @throws SlickException Indicates we were unable to locate the resource
 */
private void build(String ref, int filter, int tileSize) throws SlickException {
    try {
        final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
        final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
        build(data, imageBuffer, filter, tileSize);
    } catch (IOException e) {
        throw new SlickException("Failed to load: "+ref, e);
    }
}
项目:SpaceStationAlpha    文件:BigImage.java   
/**
 * Create a new big image by loading it from the specified reference
 * 
 * @param ref The reference to the image to load
 * @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
 * @param tileSize The maximum size of the tiles to use to build the bigger image
 * @throws SlickException Indicates we were unable to locate the resource
 */
private void build(String ref, int filter, int tileSize) throws SlickException {
    try {
        final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
        final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
        build(data, imageBuffer, filter, tileSize);
    } catch (IOException e) {
        throw new SlickException("Failed to load: "+ref, e);
    }
}
项目:cretion    文件:BigImage.java   
/**
 * Create a new big image by loading it from the specified reference
 * 
 * @param ref The reference to the image to load
 * @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
 * @param tileSize The maximum size of the tiles to use to build the bigger image
 * @throws SlickException Indicates we were unable to locate the resource
 */
private void build(String ref, int filter, int tileSize) throws SlickException {
    try {
        final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
        final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
        build(data, imageBuffer, filter, tileSize);
    } catch (IOException e) {
        throw new SlickException("Failed to load: "+ref, e);
    }
}
项目:slick2d-maven    文件:BigImage.java   
/**
 * Create a new big image by loading it from the specified reference
 * 
 * @param ref The reference to the image to load
 * @param filter The image filter to apply (@see #Image.FILTER_NEAREST)
 * @param tileSize The maximum size of the tiles to use to build the bigger image
 * @throws SlickException Indicates we were unable to locate the resource
 */
private void build(String ref, int filter, int tileSize) throws SlickException {
    try {
        final LoadableImageData data = ImageDataFactory.getImageDataFor(ref);
        final ByteBuffer imageBuffer = data.loadImage(ResourceLoader.getResourceAsStream(ref), false, null);
        build(data, imageBuffer, filter, tileSize);
    } catch (IOException e) {
        throw new SlickException("Failed to load: "+ref, e);
    }
}
项目:aphelion    文件:AsyncTextureLoader.java   
@Override
public Object[] work(String resourceKey) throws PromiseException
{
        // avoid the resource cache, AsyncTextureLoader has its own cache
        InputStream in = db.getInputStreamSync(resourceKey); 
        ResourceDB.FileEntry fileEntry = db.getFileEntry(resourceKey);

        if (in == null || fileEntry == null)
        {
                log.log(Level.SEVERE, "Unable to load texture, the given resource key ({0}) does not exist", resourceKey);
                throw new InvalidResourceKeyException();
        }

        String fileName = fileEntry.zipEntry == null ? fileEntry.file.getName() : fileEntry.zipEntry;

        LoadableImageData imageData = ImageDataFactory.getImageDataFor(fileName);

        try
        {
                ByteBuffer textureBytes = imageData.loadImage(new BufferedInputStream(in), false, null);

                if (textureBytes == null)
                {
                        throw new IOException("loadImage returned null");
                }

                log.log(Level.INFO, "Texture data for {0} read. {1} {2} {3} {4} {5}", new Object[] {
                        resourceKey,
                        imageData.getWidth(),
                        imageData.getHeight(),
                        imageData.getDepth(),
                        imageData.getTexWidth(),
                        imageData.getTexHeight()
                });

                return new Object[] {
                        textureBytes,
                        imageData.getWidth(),
                        imageData.getHeight(),
                        imageData.getDepth(),
                        imageData.getTexWidth(),
                        imageData.getTexHeight()
                };

        }
        catch (IOException | UnsatisfiedLinkError | UnsupportedOperationException ex)
        {
                log.log(Level.SEVERE, "Exception while parsing image for texture " + resourceKey, ex);
                throw new PromiseException(ex);
        }
}