PA_GetPictureVariable


version 2003


PA_GetPictureVariable (aVariable; thePicture; pictInfo) → long

Parameter Type Description
aVariable PA_Variable Variable to access
thePicture void * Data of the picture variable
pictInfo PA_PictureInfo * Picture info
Function result long Picture size in bytes

Description

The routine PA_GetPictureVariable puts the content of the variable aVariable in the data pointed to by thePicture and returns its size in bytes. In addition, it returns the picture info in pictInfo .

If aVariable has not the kind eVK_Picture , the routine returns 0 and thePicture and pictInfo are returned unchanged.

If the picture size is unknown, call the function a first time with thePicture equal to zero. The returned value will be the size of the needed buffer. Allocate the buffer and call the function again with the correct buffer.

thePicture

is a copy of the original. You can get just a handle to the picture by calling PA_GetPictureHandleVariable .

Example

Get a picture variable.

   char            *thePict;
   PA_PictureInfo   theInfo;
   long            pictSize;
 
   // First call the routine with a nil pointer to get the blob size
      pictSize = PA_GetBlobVariable(aVariable, 0L, 0L);
   // Then allocate the buffer
      thePict = malloc(pictSize);
   // If it is ok, get the picture (duplicate it, in fact)
      pictSize = PA_GetBlobVariable(aVariable, thePict, &theInfo);
   // Work with it
      /* . . . */
   // Cleanup
      free(thePict);

See Also

PA_GetPictureHandleVariable , PA_PictureInfo .

Error Handling

PA_GetLastError

keeps the last error that occurred before calling the routine.