This class provides default implementations of several
Image
methods for classes that want to implement the
MultiResolutionImage
interface. For example,
public class CustomMultiResolutionImage extends AbstractMultiResolutionImage {
final Image[] resolutionVariants;
public CustomMultiResolutionImage(Image... resolutionVariants) {
this.resolutionVariants = resolutionVariants;
}
public Image getResolutionVariant(
double destImageWidth, double destImageHeight) {
// return a resolution variant based on the given destination image size
}
public List<Image> getResolutionVariants() {
return Collections.unmodifiableList(Arrays.asList(resolutionVariants));
}
protected Image getBaseImage() {
return resolutionVariants[0];
}
}