CImage:TableToRect
The TableToRect method pastes (imbeds) a 2-dimensional array into a rectangular region of the CImage object. The array is imbedded at the specified integer-valued (column, row) offsets. This method is similar to the Imbed method, except that it imbeds a 2-dimensional array rather than another CImage. The colum and row dimensions of the table determines the extent of the rectangle in the CImage object. The inverse operation, copying a rectangle CImage region to a 2-dimensional array, uses the RectToTable method.
nResult = CImage:TableToRect( tbl, nColMin, nRowMin ) |
tbl is the array to be imbedded into the CImage.
nColMin and nRowMin are the integral (column, row) offsets to the corner where tbl is imbedded.
On success, this method returns nResult = 1.
On failure, nResult contains the following error codes:
-1: The array tbl is not valid.
-2: Not enough parameters were passed.
-3: Invalid CImage object.
-4: Internal error.
-5: The column coordinate is invalid.
-6: The row coordinate is invalid.
This method replaces pixels in a rectangle of the CImage with the values from an array. The imbedding is opaque, meaning that the pixels replace those in the CImage.
Suppose that a CImage I exists. The following script shows how to imbed a table of values into the image. The imbedding corner is set to coordinates (100,250):
|
-- position the corner of tbl at these offsets in I |
|
-- create a table (this will be a 2-D table) |
|
-- create the table for row 1 |
|
-- assign the first column in row 1 |
|
-- assign the second column in row 1 |
-- complete row 1... |
|
|
-- create the table for row 2 |
|
-- assign the first column in row 2 |
|
-- assign the second column in row 2 |
-- complete row 2... |
|
-- complete all rows |
|
|
-- imbed tbl into I at corner (100,250) |
|
-- an error occured |
CImage class, Imbed, TableToCol, TableToRow, RectToTable, arraytoimage
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.