[id] = ImageRequest(id[, type, t])
id. If you specify Nil in the id argument,
ImageRequest() will automatically choose an identifier for the brush and return
the identifier to you. Alternatively, you can also force this function to return the content
URI to the image instead of a brush by setting the FileMode tag to True (see below).
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:
#REQ_CAMERA:
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.
Starting with Hollywood 11, this function accepts an optional table argument that can be used to specify the following additional options:
FileMode:True, ImageRequest() will return the path to a file instead of
a brush. Note that if you use #REQ_CAMERA, the file will be a temporary file that you
should delete when you're done with it. Note that the returned path will usually be
a special content URI. See Working with Android URIs for details.
#REQ_GALLERY
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.
uri$ = ImageRequest(0, #REQ_CAMERA, {FileMode = True})
If uri$ <> ""
LoadBrush(1, uri$)
DisplayBrush(1, 0, 0)
DeleteFile(uri$) ; delete temporary file
Else
NPrint("Requester cancelled!")
EndIf
The code above does the same as the first example but now uses an external file
instead of a Hollywood brush.