version 2003
PA_GetPictureParameter (params; index; picture; pictInfo) long
Parameter | Type | Description | |
params | PA_PluginParameters | Parameters received in PluginMain | |
index | short | Index of the parameter in params | |
picture | void * | Value (picture) of the indexth parameter (a picture) | |
pictInfo | PA_PictureInfo * | Picture information | |
Function result | long | Picture size |
Description
The routine PA_GetPictureParameter fills picture with the picture received in the index parameter in params, and the PA_PictureInfo which is attached to the picture. It returns the size of the picture (not the size of both picture + pictInfo).
First call the routine with picture as 0L to retreive the size of the buffer you should allocate. Then, allocate the buffer and call the routine again with the allocated buffer.
After using picture, you can dispose of it as you want as it does not belong to 4th Dimension, it is a copy of the parameter. As usual, it is a good habit to dispose of memory that is no longer needed.
If you don't want to receive a copy of picture (for memory optimization), you can use the PA_GetPictureHandleParameter routine, which returns a handle to picture. In this case, remember that the Handle belongs to 4th Dimension and you must not dispose of it.
See Create a new plugin for a description of parameter accessors.
NOTE:
The first parameter starts at index 1.
Example
Drawing the picture for Macintosh/Windows+Altura
void PluginMain( long selector, PA_PluginParameters params) { switch ( selector ) { . . .kInitPlugin, kDeinitPlugin ... case kMyRoutine : // declared as DrawMyPict(&P) in the STR# resource DoDrawMyPict(prams); break; } } void DrawPicture (PA_PluginParameters params) { PicHandle pict; long size; PA_PictureInfo info; Rect r = {0, 0, 100, 100}; pict = 0L; size = PA_GetPictureParameter(params, 1, 0L, &info); pict = (PicHandle) NewHandle(size); if( pict && !MemError() ) { size = PA_GetPictureParameter(params, 1, *pict, &info); DrawPicture(pict, &r); DisposeHandle((Handle) pict); } }
See Also
Create a new plugin, PA_GetPictureHandleParameter, PA_Picture, PA_PictureInfo.
Error Handling
PA_GetLastError keeps the last error that occurred before calling the routine.