|
![]() |
![]() |
version 2003
PA_GetPictureHandleInArray (array; index; info) → PA_Handle
Parameter | Type | Description | |
array | PA_Variable | → | Array to access |
index | long | → | Index of the element to access |
info | PA_PictureInfo* | ← | Pointer to the picture information |
Function result | PA_Handle | ← | Handle to the picture data |
Description
The routine
PA_GetPictureHandleInArray
returns the handle to a Macintosh Picture handle of the
index
element of the picture array
array
. In addition, it fills
*info
with the picture information (used when the picture is in the background).
This function is useful in memory optimization if you need the picture as read-only (save it to disk, draw it in a window, etc.), since the actual picture data is not duplicated, as it is with
PA_GetPictureInArray
.
Note that the
PA_PictureInfo
are stored in 4th Dimension at the end of the picture handle. The function returns them so as to give you an easy way to access them, but they are NOT removed from the end of the picture handle because the picture still belongs to the array variable requiring that information.
A Macintosh Picture starts with 5 short values that gives the size and the rectangle of the picture respectively. Under Windows, these 5 short values are byte swapped to Windows byte order. All Mac2Win commands that accept a Macintosh Picture expect these values to be on the Windows byte order. You need not be concerned about this point, for example, if you only call the DrawPicture command. But you must be aware of this if you write the picture to the disk, or if you send the picture to a Macintosh. In those cases you need to byte swap those values back to the Macintosh byte order.
If the array is not a
eVK_ArrayPicture
or if
index
is out of range, the routine returns 0 and leaves *
info
unchanged.
Example
Draw a picture using MacOS or Mac2Win under Windows.
void MyDrawAPictureArray( PA_Variable pArr, long index )
{
PicHandle h;
Rect r = {0, 0, 100, 100};
h = (PicHandle) PA_GetPictureHandleInArray( pArr, index, 0L );
if ( h )
{
DrawPicture( h, &r );
// Do NOT dispose handle, it belongs to the variable !
}
}
See Also
Error Handling
None.