5 An Image object represents a resource that can be added to ImageActors and ShaderEffects.
7 The image is discarded when all ImageActors using the Image object are discarded or in case they
8 were created with dali.IMAGE_RELEASE_POLICY_UNUSED, taken off stage.
10 Note: if a resource was shared between Image objects it exists until its last reference is gone.
12 Image objects are responsible for the underlying resource's lifetime.
16 - dali.IMAGE_RELEASE_POLICY_UNUSED: release resource once ImageActor using it is taken off stage.
17 - dali.IMAGE_RELEASE_POLICY_NEVER: keep resource alive until Image object is thrown away ( default).
19 #### Resolution of conflicting policies
20 - If the same image is created more than once with conflicting policies, ReleasePolicy "Never" overrides "Unused".
23 ### The hierarchy of Image is:
25 - {{#crossLink "image"}}Image base class {{/crossLink}} provides basic functionality
26 - {{#crossLink "ResourceImage"}}ResourceImage {{/crossLink}} used for loading image files and nine-patch files
27 - {{#crossLink "NinePatchImage"}}NinePatch {{/crossLink}} used just for nine patch files
28 - {{#crossLink "BufferImage"}}BufferImage {{/crossLink}} used for generating your own image
29 - {{#crossLink "FrameBufferImage"}}FrameBufferImage {{/crossLink}} contains the result of an 'off screen' render pass of a RenderTask.
30 - {{#crossLink "NativeImage"}}NativeImage {{/crossLink}} Its data is provided by native resources, such as shared bitmap memory or pixmap from X11 or ECORE-X11, etc.
35 var image = new dali.ResourceImage( {url: "background.png"} );
37 var imageActor1 = new dali.ImageActor( image );
38 var imageActor2 = new dali.ImageActor( image );
40 shaderEffect.setEffectImage( image );
44 The API supports functionality such as:
46 + {{#crossLink "image/Image:method"}}new dali.ResourceImage{{/crossLink}}
47 + {{#crossLink "image/getWidth:method"}}{{/crossLink}}
48 + {{#crossLink "image/getHeight:method"}}{{/crossLink}}
52 The Image class also has support for loading 9 patch Images if the filename contains .9.
55 var blackFrame = new dali.ResourceImage( url:"black-frame.9.png"});
56 var borderNinePatch = new dali.ResourceImage( {url:"border.9.png"} );
57 // or if the image doesn't have a .9 filename, you can use the NinePatchImage class
58 var image = new dali.NinePatchImage( {url:"my_image.png"})
60 The nine patch image will scale automatically with the size of the actor.
62 Tool for making 9 patches
64 http://romannurik.github.io/AndroidAssetStudio/nine-patches.html
66 More information on them:
68 http://radleymarx.com/blog/simple-guide-to-9-patch/
70 http://developer.android.com/tools/help/draw9patch.html