/*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.javafx.iio;
import java.io.IOException;
/**
* A loader for images stored in a given format.
*/
public interface ImageLoader {
/**
* Gets a description of the image format supported by this loader.
*
* @return a description of the image format handled by this loader.
*/
ImageFormatDescription getFormatDescription();
// String getInput();
// void abort();
/**
* Disposes of any resources (such as native libraries) held by this loader.
* Any further invocation of any methods on this object are undefined.
*/
void dispose();
/**
* Adds a listener to monitor this loader.
*
* @param listener the listener to add.
*/
void addListener(ImageLoadListener listener);
/**
* Removes a listener from the list of those monitoring this loader.
* @param listener the listener to remove.
*/
void removeListener(ImageLoadListener listener);
/**
* Loads the image at a given index in an image stream. If no image exists
* at that index null
will be returned.
*
* @param imageIndex the zero-relative index of the image to load.
* @param width the desired image width. If non-positive,
* an IllegalArgumentException
will be thrown.
* @param height the desired image height. If non-positive,
* an IllegalArgumentException
will be thrown.
* @param preserveAspectRatio whether to preserve the width-to-height ratio
* of the image.
* @param smooth whether to use a smooth downscaling algorithm.
* @return the image at the specified index or null
on error.
*/
public ImageFrame load(int imageIndex, int width, int height,
boolean preserveAspectRatio, boolean smooth) throws IOException;
}