X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=plugins%2Fdali-script-v8%2Fdocs%2Fcontent%2Fimage.js;h=e5810ded2aea27b7e900d4b3736097925c66c9ab;hb=d8a62ef92f9ddecc199eb88ed7698194bc539662;hp=f9ef313cec8a68f853d9658ad4a50d67a8d81b6c;hpb=46516d3e1711bd272cc00002876cf207465fa8ce;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/plugins/dali-script-v8/docs/content/image.js b/plugins/dali-script-v8/docs/content/image.js index f9ef313..e5810de 100644 --- a/plugins/dali-script-v8/docs/content/image.js +++ b/plugins/dali-script-v8/docs/content/image.js @@ -2,43 +2,34 @@ * ## Image API -An Image object represents a resource that can be added to ImageActors and ShaderEffects. +An Image object represents a resource that can be added to Material. -The image is discarded when all ImageActors using the Image object are discarded or in case they -were created with dali.IMAGE_RELEASE_POLICY_UNUSED, taken off stage. +The image is discarded when all Materials using the Image object are discarded. Note: if a resource was shared between Image objects it exists until its last reference is gone. Image objects are responsible for the underlying resource's lifetime. -### ReleasePolicies - - - dali.IMAGE_RELEASE_POLICY_UNUSED: release resource once ImageActor using it is taken off stage. - - dali.IMAGE_RELEASE_POLICY_NEVER: keep resource alive until Image object is thrown away ( default). - -#### Resolution of conflicting policies - - If the same image is created more than once with conflicting policies, ReleasePolicy "Never" overrides "Unused". - - ### The hierarchy of Image is: - {{#crossLink "image"}}Image base class {{/crossLink}} provides basic functionality - {{#crossLink "ResourceImage"}}ResourceImage {{/crossLink}} used for loading image files and nine-patch files - - {{#crossLink "NinePatchImage"}}NinePatch {{/crossLink}} used just for nine patch files - {{#crossLink "BufferImage"}}BufferImage {{/crossLink}} used for generating your own image - {{#crossLink "FrameBufferImage"}}FrameBufferImage {{/crossLink}} contains the result of an 'off screen' render pass of a RenderTask. - - {{#crossLink "NativeImage"}}NativeImage {{/crossLink}} Its data is provided by native resources, such as shared bitmap memory or pixmap from X11 or ECORE-X11, etc. ### Example: ``` +// Create a resource image with a given URL var image = new dali.ResourceImage( {url: "background.png"} ); -var imageActor1 = new dali.ImageActor( image ); -var imageActor2 = new dali.ImageActor( image ); +// Create materials that specifie the visual properties of the renderer. +var material1 = new dali.Material(); +var material2 = new dali.Material(); -shaderEffect.setEffectImage( image ); - +// Add images as texture to be used by the materials +material1.addTexture( image, "sTexture" ); +material2.addTexture( image, "sTexture" ); ``` The API supports functionality such as: @@ -52,10 +43,8 @@ The API supports functionality such as: The Image class also has support for loading 9 patch Images if the filename contains .9. e.g. ``` -var blackFrame = new dali.ResourceImage( url:"black-frame.9.png"}); +var blackFrame = new dali.ResourceImage( {url:"black-frame.9.png"} ); var borderNinePatch = new dali.ResourceImage( {url:"border.9.png"} ); -// or if the image doesn't have a .9 filename, you can use the NinePatchImage class -var image = new dali.NinePatchImage( {url:"my_image.png"}) ``` The nine patch image will scale automatically with the size of the actor.