5 An Image object represents a resource that can be added to Material.
7 The image is discarded when all Materials using the Image object are discarded.
9 Note: if a resource was shared between Image objects it exists until its last reference is gone.
11 Image objects are responsible for the underlying resource's lifetime.
13 ### The hierarchy of Image is:
15 - {{#crossLink "image"}}Image base class {{/crossLink}} provides basic functionality
16 - {{#crossLink "ResourceImage"}}ResourceImage {{/crossLink}} used for loading image files and nine-patch files
17 - {{#crossLink "BufferImage"}}BufferImage {{/crossLink}} used for generating your own image
18 - {{#crossLink "FrameBufferImage"}}FrameBufferImage {{/crossLink}} contains the result of an 'off screen' render pass of a RenderTask.
23 // Create a resource image with a given URL
24 var image = new dali.ResourceImage( {url: "background.png"} );
26 // Create materials that specifie the visual properties of the renderer.
27 var material1 = new dali.Material();
28 var material2 = new dali.Material();
30 // Add images as texture to be used by the materials
31 material1.addTexture( image, "sTexture" );
32 material2.addTexture( image, "sTexture" );
35 The API supports functionality such as:
37 + {{#crossLink "image/Image:method"}}new dali.ResourceImage{{/crossLink}}
38 + {{#crossLink "image/getWidth:method"}}{{/crossLink}}
39 + {{#crossLink "image/getHeight:method"}}{{/crossLink}}
43 The Image class also has support for loading 9 patch Images if the filename contains .9.
46 var blackFrame = new dali.ResourceImage( {url:"black-frame.9.png"} );
47 var borderNinePatch = new dali.ResourceImage( {url:"border.9.png"} );
49 The nine patch image will scale automatically with the size of the actor.
51 Tool for making 9 patches
53 http://romannurik.github.io/AndroidAssetStudio/nine-patches.html
55 More information on them:
57 http://radleymarx.com/blog/simple-guide-to-9-patch/
59 http://developer.android.com/tools/help/draw9patch.html