PA_GetPictureHandleParameter

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

version 2003


PA_GetPictureHandleParameter (params; index; info) PA_Handle

ParameterTypeDescription
paramsPA_PluginParametersParameters received in PluginMain
indexshortIndex of the parameter in params
infoPA_PictureInfo *Picture info
Function resultPA_HandleHandle 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.


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