Class deCarta.Mobile.ImagePack
ImagePack Allows dynamic loading of different image sets depending on resolution. The ImagePack allows you to load a base64 encoded set of images (a "pack"). These are generated server-side, either statically with a build tool or dynamically. The content of an imagePack is an object with the following structure
{
"image name" : {
img : "base64 data",
scale: (float)
}
}
Each image will be loaded and rescaled to screen size (depending on the DPR of the
device) according to the scale paramter. This allows you to load the same pack
for different ratios. For example, you could load a pack
containing images with a scale of 2. These images will contain *twice as many pixels*
as required for display (hence the 2 factor). When displayed on a regular screen
the extra data will be discarded, but when displayed on a ahigh res screen
they will utilize its full resolution. Of course this works the other way around
as well : you can load a pack of low res images with a scale setting of 1, and they
will be upscaled on high res screens to display the correct size.
A Java tool to generate image packs is provided with the api. Please refer to the
documentation in the Tools section of the API distribution.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Tool for loading images
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
deCarta.Mobile.ImagePack.get(id)
Get an image: returns a clone of the original image for use in the application
|
| <static> |
deCarta.Mobile.ImagePack.importLoadedPack(packName, onComplete)
|
| <static> |
deCarta.Mobile.ImagePack.load(pack, onComplete)
Load a pack.
|
Method Detail
<static>
deCarta.Mobile.ImagePack.get(id)
Get an image: returns a clone of the original image for use in the application
- Parameters:
- id
- is the name of the image in the pack
<static>
deCarta.Mobile.ImagePack.importLoadedPack(packName, onComplete)
- Parameters:
- packName
- onComplete
<static>
deCarta.Mobile.ImagePack.load(pack, onComplete)
Load a pack.
- Parameters:
- pack
- (string) relative of absolute uri
- onComplete
- a callback function that will be notified when the pack is ready for use