Wikitude SDK API Reference

API Docs for: 9.13.0
Show:

ImageResource Class

Extends ARchitectObject
Module: AR

ImageRessource encapsulates an image file. An ImageResource is represented via a URI pointing to the image file. An Image has a width and a height, in pixels.

Immediately after object creation, the system will start downloading the image file onto the device.

Example:

var imageres = new AR.ImageResource("http://path.to.my/image/resource.png");

Constructor

ImageResource

(
  • uri
  • options
)

Parameters:

  • uri String

    The uri to the image file.

  • options Object optional

    Setup-Parameters to customize additional object properties.

    Accepted options-properties are

Item Index

Properties

Events

Methods

destroy

()

Inherited from ARchitectObject

Destroys the object.

getHeight

() Number

Returns the height of the original image, in pixels. In case the image is not yet loaded (see ImageResource.onLoaded(), -1 will be returned.

Returns:

Number:

the height of the image represented through the URI, in pixels.

getUri

() String

Returns the uri to the ImageResource.

Returns:

String:

the uri to the ImageResource.

getWidth

() Number

Returns the width of the original image, in pixels. In case the image is not yet loaded (see ImageResource.onLoaded(), -1 will be returned.

Returns:

Number:

the width of the image represented through the URI, in pixels.

isLoaded

() Boolean

Allows checking if the ImageResource has already been loaded successfully.

Returns:

Boolean:

true if the ImageResource is already loaded, false if the ImageResource is not yet loaded.

Properties

destroyed

Boolean

Inherited from ARchitectObject

Indicates if the object has already been destroyed.

Events

onError

The trigger will fire when the Image file could not be loaded.

The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onError.

onLoaded

The trigger will fire when the Image file was loaded.

The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onLoaded.

Event Payload:

  • width Number

    the width of the ImageResource, in pixels.

  • height Number

    the height of the ImageResource, in pixels.