lcdui.image — Creates an image.
lcdui.image
[
-file filename
]
[
-rms recordstore
]
[
-resource resourcename
]
[
-image image
]
[
-data data
]
$imagecmd
[cget
-optname
]
[configure
-optname
optval
]
[thumbnail
[thumbwidth
[thumbwidth]
]
]
[graphics]
The lcdui.image command creates an image, from some data, either by indicating a filename, record store, or a resource name. It returns an object/command that can be utilized to manipulate the image. Mutable images are those loaded from existing data, generally. Immutable images are created as a "blank slate", with white pixels. For an in-depth look at the Java code that this command is based on, see: javax.microedition.lcdui.Image
The options available for the lcdui.image command are described below:
-file
: Load the image from the given file name.
-rms
: Load the image from the given record store.
-resource
: Load the image from the given resource. By
"resource", we mean a file included in the .jar.
-image
: Create a new image from an existing image.
-data
: Create a new image from binary data.
The subcommands available to an $imagecmd
are listed below:
thumbnail: Creates a thumbnail from the image.
graphics: Unless the image is immutable, creates and returns a new graphics object associated with the image.
There are two ways to include images in Hecl applications. One is to add the image to the .jar file itself. The second is to include it directly in the script, as a base64 included string. Here's how to do so on a Linux machine:
Create an image. For example, with "The Gimp", an image manipulation program on
Linux, you might create a PNG, x.png
.
Now you need to turn the binary PNG file into a string that can be included in a script:
base64 < x.png > x.txt
Now copy and paste x.txt into your script, like in the script below
# base64 encoded PNG set data {iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A /wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gKGBQIB6A2RzQAAAAZdEVYdENv bW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAG40lEQVR42u2dW0hUXRTH98w4Upk145gylRb1 YOhMNyIigkC65/2WYCARhgS9RXTDCHqyIiF66e7dHiywIBB66cHoQhko9DAP0zTpjIo4WJTp+O/J j+/rM/caZ85tXH84b+fsvdb6edaZfc5aWxMACJZuZOYQMBAWA2EgLAbCQFgMhIGwGAgDYTEQFgNh ICwGwkBYDISBsBgIA2EtKCDl5eXCZDLNe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dui.image -resource /hecl_logo.png] set ximg [lcdui.image -data [base64::decode $data]] set form [lcdui.form -title "Show Image"] $form append $logo $form append $ximg $form setcurrent
Live example: http://www.heclbuilder.com/scripts/show/150