Difference between revisions of "ImageFromHex"
(Created page with "''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 a...") |
m (Changed category to image and canvas functions) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Image and canvas functions]] | ||
+ | |||
''new to [[Analytica 5.0]]'' | ''new to [[Analytica 5.0]]'' | ||
− | == ImageFromHex( hex ) == | + | == 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. | 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. | ||
Line 11: | Line 13: | ||
== Example == | == Example == | ||
− | :Index suit := | + | :<code>Index suit := ['H', 'D', 'C', 'S']</code> |
− | :Index num := | + | :<code>Index num := ['A', '2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K']</code> |
; | ; | ||
Variable CardImages | Variable CardImages | ||
:Button ReadCardImages | :Button ReadCardImages | ||
− | :::'''OnClick''' : <code>CardImages := ReadImageFile( "card" & suit & num & ".png" )</code> | + | :::'''OnClick''' : <code>CardImages := ReadImageFile("card" & suit & num & ".png")</code> |
Pressing the button causes the images for the cards to be read in from the files and stored in <code>CardImages</code>. 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. | Pressing the button causes the images for the cards to be read in from the files and stored in <code>CardImages</code>. 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 == | == See Also == | ||
− | * [[Assignment_Operator_%3A%3D|Assignment operator | + | * [[Assignment_Operator_%3A%3D|Assignment operator :=]] |
* [[ReadFromURL]] | * [[ReadFromURL]] | ||
* [[ReadImageFile]] | * [[ReadImageFile]] | ||
* [[Pict]] attribute | * [[Pict]] attribute |
Latest revision as of 21:42, 31 May 2017
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")
- OnClick :
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
- Assignment operator :=
- ReadFromURL
- ReadImageFile
- Pict attribute
Enable comment auto-refresher