PA_GetPictureVariable

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_GetPictureVariable (aVariable; thePicture; pictInfo) long

ParameterTypeDescription
aVariablePA_VariableVariable to access
thePicturevoid *Data of the picture variable
pictInfoPA_PictureInfo *Picture info
Function resultlongPicture 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.


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next