Hi

I am currently porting the plug-ins/gap to gimp-1.3.
The 1.st step (gimp-1.3.4a_pre09) was to get the code
compileclean again.

In the 2.nd step i want to clean up some old hacks
in the basic funtionality of the code.

But therefore i need new Interfaces to the gimp-core 
and the help of the gimp developers to implement
the API. (-- see BUG #74485)

In step 3 i'll take a closer look on the 'Filter All Layers'
functions and replace all the iter_ALT procedures by a common
Iterartor.



And here are my API-wishes for new PDB-Procedures (and libgimp wrappers):
   
  - gimp_displays_reconnect
  - gimp_image_is_clean
  - gimp_layer_new_copy
  - gimp_layer_new_move
 
1) - gimp_displays_reconnect

       gboolean gimp_displays_reconnect (gint32 old_image_ID,
                                         gint32 new_image_ID);
       /* This procedure connects all displays of the old_image to the new_image
        * and returns TRUE if the reconnect was successful.
        * If the new_image already has a display the reconnect is not performed
        * and the procedure returns FALSE.
        *  old_image_ID : The old image should have at least one display
        *  new_image_ID : The new image must not have a display
        */

       GIMP-1.3 should provide a PDB Interface
       to the already existing internal procedure
         app/display/gimpdisplay-foreach.c:gdisplays_reconnect

       With the help of gimp_displays_reconnect the excange of frames
       can be very simple and has no longer to deal with all
       the internal stuff of an image.
       Changing frames then will be compareable with a revert file operation
       where the revert sourcefile is another frame.
       
       This will be more performant then the old 'layer_stealing' Hack
       (as it was implemented in gimp-1.2/plug-ins/gap)
      
2) - gimp_image_is_clean
 
       gboolean gimp_image_is_clean (gint32              image_ID);
         /* returns TRUE if the specified image's dirty count is 0,
          * FALSE if not.
          */

       With the help of the procedure gimp_image_is_clean
       GAP could check if the image is "CLEAN"
       and can skip saving the current frame to disk if TRUE
       (currently GAP saves unconditional,
        before each frame exchange)
       
       I'm not sure a dirty count 0 is really an indicator
       for unsaved changes in the image. But if this is
       reliable and available via PBD, GAP could be faster.
       
 
  - gimp_drawable_set_image (is Obsolete now?)

    This procedure is currently available in the PDB without
    a PDB-wrapper and seems to be an undocumented feature of gimp-1.2

    If it is now obsolete and should not be used outside of the
    gimp-1.3 core
    I need a substitute for the following scenarios 3) and 4):
    
3)  - copy a layer from src_image to dst_image
    
       /* checks if src and dst image are same type */
       a) new_layer_id = gimp_layer_copy(src_layer_id);
       b) gimp_drawable_set_image(new_layer_id, dst_image_id);
       c) gimp_image_add_layer (dest_image_id, new_layer_id, 0);
              
       One way could be a new API that combines steps a+b
       and could look like this:

       gint32  gimp_layer_new_copy(gint32 dst_image_ID,
                                   gint32 src_layer_ID);
                                   
       /* dst_image_ID  : the destination image
        * src_layer_ID  : the source layer (can be in another image,
        *             but type must be same as dst_image_ID)
        * This procedure creates a new layer with the same
        * width,heigth,type,name,opacity mode
        * as the specified src_layer_ID and copies the CONTENT
        * from src_layer_ID into the new created layer.
        * The id of the new created layer is returned on success,
        * otherwise -1 is returned.
        * The new layer still needs to be added to the dst_image,
        * as this is not automatic. Add the new layer with the
        * 'gimp_image_add_layer' command. Other attributes
        * such as layer mask modes, and offsets should
        * be set with explicit procedure calls.
        */
       
        Another way is to use already existing procedures 
          gimp_edit_copy 
          gimp_layer_new
          gimp_edit_paste
          gimp_edit_clear
        with the side effect that GAP fills (or clears) the edit_paste
        buffer at some operations where the user might not expect.

4)  - move a layer from src_image to dst_image

    - In the animated Preview of MovePath
      GAP builds a Multilayer Image from many frames on disc
      by 'Moving' layers from a temp image to dest_image
      in the same way as the layer stealing hack.
      (this does not crash in GIMP-1.3 because
       the tmp_image' s life was short and never had a display)
  
      for (frame_nr = first_fame to last_frame)
      {
          tmp_image_id = load_image(from discfile with frame_nr);
          layer_id = gimp_image_flatten(tmp_img_id);

          gimp_image_remove_layer(tmp_image_id, layer_id);
          gimp_drawable_set_image(layer_id, dest_image_id);
          gimp_image_add_layer (dest_image_id, layer_id, 0); 
          gimp_image_delete(tmp_image_id);   
      }
      

     A new API that combines the steps  
        gimp_image_remove_layer + 
        gimp_drawable_set_image
     could look like this:

        gboolean  gimp_layer_new_move(gint32 dst_image_ID,
                                      gint32 src_layer_ID);
                                   
       /* dst_image_ID  : the destination image
        * src_layer_ID  : the source layer (must be in another image,
        *             but type must be same as dst_image_ID)
        * This procedure removes the src_layer from it's image and
        * prepares theis layer to be added to the specified
        * destination image.
        * TRUE is returned on success, FALSE otherwise.
        * The new layer still needs to be added to the dst_image,
        * as this is not automatic. Add the new layer with the
        * 'gimp_image_add_layer' command. Other attributes
        * such as layer mask modes, and offsets should
        * be set with explicit procedure calls.
        */

             

Yours Wolfgang Hofer.


PS: Other ideas and tips how to port GAP to GIMP-1.3 are welcome.




2,000,000,000 Web Pages--you only need 1. Save time with My Lycos.
http://my.lycos.com
_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer

Reply via email to