ImageFromHex


new to Analytica 5.0

ImageFromHex(hex)

This function is used to hold the raw bits of an image in a Definition. The result of evaluating the function is an image object, which can then be displayed within table cells, or copied to the Pict attribute of a node.

You would never type out the hex parameter of this function manually, because images are big and the hex encoding is always an extremely long series of cryptic digits. Instead, this function gets automatically generated in a Definition when you assign a value to a global variable, and the value is itself an image or an array that contains an image. Because it is something you would never type yourself, it does not show up on the Definition menu and is not suggested by Expression assist.

By using this function, the full image can be copied to the target so that it can be saved with the model. The image itself might have originated in your model from a call to ReadImageFile, ReadFromURL or from a Pict attribute of an object, where the Picture might have come from a copy-paste of an image to the diagram.

Example

Index suit := ['H', 'D', 'C', 'S']
Index num := ['A', '2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K']

Variable CardImages

Button ReadCardImages
OnClick : CardImages := ReadImageFile("card" & suit & num & ".png")

Pressing the button causes the images for the cards to be read in from the files and stored in CardImages. When the model is saved, the images are in that array, and the 52 separate image files don't need to be distributed with the model.

See Also

Comments


You are not allowed to post comments.