PA_GetPictureHandleParameter


version 2003


PA_GetPictureHandleParameter (params; index; info) → PA_Handle

Parameter Type Description
params PA_PluginParameters Parameters received in PluginMain
index short Index of the parameter in params
info PA_PictureInfo * Picture info
Function result PA_Handle Handle to the picture

Description

The command PA_GetPictureHandleParameter returns a handle to the picture of the index parameter in params , and its information ( background drawing) in info .

WARNING

The handle belongs to 4D. Never dispose of it.

This may be very useful, especially when the plug-in wants to read the picture but not modify it. On the other hand, PA_GetPictureParameter gets a copy of the picture and can manipulate it, but this may lead to memory problems for "large" pictures.

Example

Drawing the Picture for Macintosh/Windows+Altura

This is the same sample as in PA_GetPictureParameter , but it uses less memory

   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;
      PA_PictureInfo   info;
      Rect      r = {0, 0, 100, 100};
 
      pict = PA_GetPicturehandleParameter(params, 1, &info);
      if(pict)
         DrawPicture(pict, &r);
      // NEVER CALL DisposeHandle((Handle) pict) : pict belongs to 4D.
   }

See Also

Create a new plugin , PA_GetPictureParameter .