PA_PictureEditor

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

version 2003


PA_PictureEditor (windowTitle; picture; pictSize) PA_Handle

ParameterTypeDescription
windowTitlechar *Title of the editor window
picturevoid *Pointer the picture data
pictSizelongSize of aPicture
Function resultPA_HandleHandle to the user-modified picture

Description

The routine PA_PictureEditor displays the Picture Editor (available in the Design environment) in a new window.

Pass the title you want to give to the window in windowTitle (C or Pascal strings, depending on the platform or on the previous call to PA_UseP/CStrings). It will usually be the a picture name, or a document name.

Pass a pointer to the picture in Picture, and its size (in bytes) in pictSize.

The user can then customize the picture with the same tools available to the designer in the Design environment.

Once the user has closed the window, the routine returns a handle to the picture. This handle belongs to the plug-in. You should dispose of it once you have finished working with it, except if you give this handle to 4th Dimension using the PA_ReturnPictureHandle routine

Example

Modify a picture. The routine given to the 4D programmer has the following syntax:

newPicture:=superplug_EditPicture(oldPicture)

PluginMain simply calls this routine, passing it the PluginParameters:

   void EditPicture( PA_PluginParameters params )
   {
      PA_Handle h;
      PA_PictureInfo info;
      char* pt;
      long len;
   // Get the picture size
      len = PA_GetPictureParameter( params, 1, 0, 0 );
   // Make room for the new picture
      pt = malloc( len );
      if ( pt )
      {
   // get the picture parameter
         PA_GetPictureParameter( params, 1, pt, &info );
   // edit it
         h = PA_PictureEditor("Nice Picture", pt, len );
   // free memory
         free( pt );
   // return the new picture. We need to lock the handle to avoid fool pointer
         PA_ReturnPicture( params, PA_LockHandle( h ), PA_GetHandleSize( h ), info );
   // Unlock the handle
         PA_UnlockHandle( h );
   // Free memory
         PA_DisposeHandle( h );
      }
   }

See Also

No reference.

Error Handling

PA_GetLastError always returns eER_NoErr


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