资 源 简 介
This utility has two purposes
To pre-load images with a single line of code, and reliably inform your code when loading is complete.
To get the original dimensions of an image. This is particularly useful for resizing images while maintaining aspect ratio. In fact, this case is so common that the library also includes a subclass of Image that automatically resizes itself and preserves aspect ratio.
Usage
Preload an image.
ImagePreloader.load(, null);
Preload an image, and display the dimensions when it finishes loading.
ImagePreloader.load(, new ImageLoadHander() { public void imageLoaded(ImageLoadEvent event) { if (event.isLoadFailed()) Window.alert("Image " + event.getImageUrl() + " failed to load."); else Window.alert("Image " + event.getImageUrl() + " loaded ("