Name
ImageRequest -- prompt the user to select an image (V8.0)
Synopsis
[id] = ImageRequest(id[, type])
Platforms
Android only

Function
This function can be used to prompt the user to select an image. The image will then be stored as the brush specified in id. If you specify Nil in the id argument, ImageRequest() will automatically choose an identifier for the brush and return the identifier to you.

The optional type argument allows you to specify the image source to use when prompting the user for an image. This can currently be set to one of the following predefined constants:

#REQ_GALLERY:
Open the device's gallery and prompt the user to select an image that will then be returned as a Hollywood brush to your script.

#REQ_CAMERA:
Open the device's camera and prompt the user to take a picture that will then be returned as a Hollywood brush to your script.

The default mode is #REQ_GALLERY, i.e. ImageRequest() will prompt the user to select an image from the device's gallery.

To find out if this function has failed because the user cancelled the image requester, just use HaveObject() to see if the brush object exists after ImageRequest() returns. If it doesn't exist, the user has cancelled the image requester. See HaveObject for details.

Inputs
id
id for the brush or Nil for auto id selection
type
optional: image source to use; see above for possible modes; defaults to #REQ_GALLERY
Results
id
optional: identifier of the brush; will only be returned when you pass Nil as argument 1 (see above)
Example
ImageRequest(1, #REQ_CAMERA)
If HaveObject(#BRUSH, 1)
   DisplayBrush(1, #CENTER, #CENTER)
Else
   NPrint("Requester cancelled!")
EndIf
The code above prompts the user to take a picture with the camera and then displays this picture. It also checks if the requester has been cancelled.

Show TOC