Nui Tutorial

Dynamic Animation Library

Home Page

Image View Tutorial

The tutorial describes the NUI ImageView control in detail.

Overview

The ImageView is a control which displays an image.

Basic creation and usage

An instance of an ImageView is created with a file path:

imageView = new ImageView("./images/gallery-3.jpg");

or by the Url property:

imageView = new ImageView();
imageView.ResourceUrl = "./images/gallery-3.jpg";

To subsequently change an image use the SetImage method:

imageView.SetImage("./images/house.png");

This figure is displayed via an ImageView:

Image View Properties

ImageView has the following properties:

Property Type Description
ResourceUrl string path to image file.
ImageMap Map map of properties associated with a given image.
PreMultipliedAlpha bool opacity adjusted image.
PixelArea Vector4 sub area of image.
Border Rectangle The border of the image in the order:left, right, bottom, top. For N-Patch images only.
BorderOnly bool Gets/sets whether to draws the borders only(If true). For N-Patch images only.
SynchronousLoading bool Gets/Sets whether the image is synchronous. For N-Patch images only.

Note:

e.g on a 200 x 200 pixel image [0.25, 0.5, 0.5, 0.5] would represent a sub area of that image with the following co-ordinates: Top left : 50,100 Top right : 150,100 Bottom left : 50,200 Bottom right : 150,200