applied patches from Wolfgang: clean up PDB_wrappers

--Sven
This commit is contained in:
Sven Neumann
2000-01-26 12:30:38 +00:00
parent 60c950446c
commit 3bf7c3440f
5 changed files with 429 additions and 753 deletions

View File

@ -1,3 +1,10 @@
Thu Jan 27 11:24:05 CET 2000 Sven Neumann <sven@gimp.org>
* plug-ins/gap/gap_exchange_image.c
* plug-ins/gap/gap_mov_dialog.c
* plug-ins/gap/gap_pdb_calls.[ch]:
applied patches from Wolfgang Hofer <hof@hotbot.com>
2000-01-26 Michael Natterer <mitch@gimp.org> 2000-01-26 Michael Natterer <mitch@gimp.org>
* app/preferences_dialog.c: forgot to correctly set the * app/preferences_dialog.c: forgot to correctly set the

View File

@ -6,7 +6,7 @@
* basic anim functions: * basic anim functions:
* This Plugin drops the content of the destination * This Plugin drops the content of the destination
* image (all layers,channels & guides) * image (all layers,channels & guides)
* and then copies the content of a source image to dst. image * and then moves (steal) the content of a source image to dst. image
* *
*/ */
/* The GIMP -- an image manipulation program /* The GIMP -- an image manipulation program
@ -28,6 +28,8 @@
*/ */
/* revision history: /* revision history:
* 1.1.15a 2000/01/25 hof: stopped gimp 1.0.x support (removed p_copy_content)
* handle pathes
* 0.98.00; 1998/11/30 hof: 1.st release * 0.98.00; 1998/11/30 hof: 1.st release
* (substitute for the procedure "gimp_duplicate_into" * (substitute for the procedure "gimp_duplicate_into"
* that was never part of the GIMP core) * that was never part of the GIMP core)
@ -56,7 +58,12 @@ extern int gap_debug; /* ==0 ... dont print debug infos */
/* ============================================================================ /* ============================================================================
* p_steal_content * p_steal_content
* *
* steal all elements (layers, channels, selections, guides, colormap) * steal or copy all elements
* - layers,
* - channels, selections,
* - pathes,
* - guides,
* - colormap
* from src_image and add them to dst_image. * from src_image and add them to dst_image.
* ============================================================================ * ============================================================================
*/ */
@ -85,6 +92,13 @@ p_steal_content(gint32 dst_image_id, gint32 src_image_id)
gint32 l_x1, l_x2, l_y1, l_y2; gint32 l_x1, l_x2, l_y1, l_y2;
guchar *l_cmap; guchar *l_cmap;
gint l_ncolors; gint l_ncolors;
char **l_path_names;
char *l_current_pathname;
gint32 l_num_paths;
gdouble *l_path_points;
gint32 l_path_type;
gint32 l_path_closed;
gint32 l_num_points;
l_rc = -1; /* init retcode to Errorstate */ l_rc = -1; /* init retcode to Errorstate */
l_layers_list = NULL; l_layers_list = NULL;
@ -211,7 +225,7 @@ p_steal_content(gint32 dst_image_id, gint32 src_image_id)
if(gap_debug) printf("GAP-DEBUG: START p_steal_content selection_channel_id=%d\n", (int)l_channel_id); if(gap_debug) printf("GAP-DEBUG: START p_steal_content selection_channel_id=%d\n", (int)l_channel_id);
p_gimp_drawable_set_image(l_channel_id, dst_image_id); p_gimp_drawable_set_image(l_channel_id, dst_image_id);
p_gimp_selection_load (dst_image_id, l_channel_id); p_gimp_selection_load (l_channel_id);
} }
@ -269,6 +283,33 @@ p_steal_content(gint32 dst_image_id, gint32 src_image_id)
l_guide_id = p_gimp_image_findnext_guide(src_image_id, l_guide_id); l_guide_id = p_gimp_image_findnext_guide(src_image_id, l_guide_id);
} }
/* copy paths */
l_path_names = p_gimp_path_list(src_image_id, &l_num_paths);
if((l_path_names != NULL) && (l_num_paths > 0))
{
l_current_pathname = p_gimp_path_get_current(src_image_id);
for(l_idx=l_num_paths-1; l_idx >= 0; l_idx--)
{
l_path_points = p_gimp_path_get_points(src_image_id, l_path_names[l_idx],
&l_path_type, &l_path_closed, &l_num_points);
if((l_path_points != NULL) && (l_num_points > 0))
{
p_gimp_path_set_points(dst_image_id, l_path_names[l_idx],
l_path_type, l_num_points, l_path_points);
}
if(l_path_points) g_free(l_path_points);
g_free(l_path_names[l_idx]);
}
if(l_current_pathname)
{
p_gimp_path_set_current(dst_image_id, l_current_pathname);
g_free(l_current_pathname);
}
}
if(l_path_names) g_free(l_path_names);
l_rc = 0; l_rc = 0;
cleanup: cleanup:
@ -284,253 +325,6 @@ cleanup:
/* ============================================================================
* p_copy_content
*
* copy all elements (layers, channels, selections, guides, colormap) from src_image
* to dst_image.
* ============================================================================
*/
static int
p_copy_content(gint32 dst_image_id, gint32 src_image_id)
{
int l_rc;
int l_idx;
gint l_nlayers;
gint l_nchannels;
gint32 *l_layers_list;
gint32 *l_channels_list;
gint32 l_layer_id;
gint32 l_channel_id;
gint32 l_new_layer_id;
gint32 l_new_channel_id;
gint32 l_layer_mask_id;
gint32 l_new_layer_mask_id;
gint32 l_guide_id;
gint32 l_src_fsel_id; /* floating selection (in the src_image) */
gint32 l_src_fsel_attached_to_id; /* the drawable where floating selection is attached to (in the src_image) */
gint32 l_fsel_attached_to_id; /* the drawable id where to attach the floating selection (dst) */
gint32 l_fsel_id; /* the drawable id of the floating selection itself (dst) */
gint32 l_active_layer_id;
gint32 l_active_channel_id;
gint l_offset_x;
gint l_offset_y;
gint32 l_x1, l_x2, l_y1, l_y2;
guchar *l_cmap;
gint l_ncolors;
l_rc = -1; /* init retcode to Errorstate */
l_layers_list = NULL;
l_channels_list = NULL;
l_active_layer_id = -1;
l_active_channel_id = -1;
l_fsel_attached_to_id = -1; /* -1 assume fsel is not available (and not attached to any drawable) */
l_fsel_id = -1; /* -1 assume there is no floating selection */
if(gap_debug) printf("GAP-DEBUG: START p_copy_content dst_id=%d src_id=%d\n", (int)dst_image_id, (int)src_image_id);
/* check for floating selection */
l_src_fsel_attached_to_id = -1;
l_src_fsel_id = gimp_image_floating_selection(src_image_id);
if(l_src_fsel_id >= 0)
{
if(gap_debug) printf("GAP-DEBUG: call floating_sel_relax fsel_id=%d\n",
(int)l_src_fsel_id);
p_gimp_floating_sel_relax (l_src_fsel_id, FALSE);
l_src_fsel_attached_to_id = p_gimp_image_floating_sel_attached_to(src_image_id);
}
/* copy all layers */
l_layers_list = gimp_image_get_layers(src_image_id, &l_nlayers);
/* foreach layer do */
for(l_idx = l_nlayers -1; l_idx >= 0; l_idx--)
{
l_layer_id = l_layers_list[l_idx];
if(gap_debug) printf("GAP-DEBUG: START p_copy_content layer_id=%d\n", (int)l_layer_id);
/* copy the layer (including its layermask) */
l_new_layer_id = p_my_layer_copy(dst_image_id, l_layer_id,
gimp_layer_get_opacity(l_layer_id),
gimp_layer_get_mode(l_layer_id),
&l_offset_x,
&l_offset_y
);
if (l_new_layer_id < 0) { goto cleanup; }
if(l_layer_id == l_src_fsel_id)
{
l_fsel_id = l_new_layer_id; /* this layer is the floating selection */
}
else
{
if(gap_debug) printf("GAP-DEBUG: START p_copy_content add_layer_id=%d\n", (int)l_new_layer_id);
/* add the layer on top of the images layerstak */
gimp_image_add_layer (dst_image_id, l_new_layer_id, 0);
if(l_layer_id == l_src_fsel_attached_to_id)
{
l_fsel_attached_to_id = l_new_layer_id; /* the floating selection is attached to this layer */
}
}
/* adjust offsets and other layerproperties */
gimp_layer_set_offsets(l_new_layer_id, l_offset_x, l_offset_y);
gimp_layer_set_visible (l_new_layer_id, gimp_layer_get_visible(l_layer_id));
p_layer_set_linked (l_new_layer_id, p_layer_get_linked(l_layer_id));
gimp_layer_set_preserve_transparency (l_new_layer_id, gimp_layer_get_preserve_transparency(l_layer_id));
if(l_layer_id == gimp_image_get_active_layer(src_image_id))
{
l_active_layer_id = l_new_layer_id;
}
l_layer_mask_id = gimp_layer_get_mask_id(l_layer_id);
if(l_layer_mask_id >= 0)
{
/* layer has layermask */
l_new_layer_mask_id = gimp_layer_get_mask_id(l_new_layer_id);
if(gap_debug) printf("GAP-DEBUG: START p_copy_content layer_mask_id=%d\n", (int)l_layer_mask_id);
/* check for floating selection */
if(l_layer_mask_id == l_src_fsel_attached_to_id)
{
l_fsel_attached_to_id = l_new_layer_mask_id; /* the floating selection is attached to this layer_mask */
}
gimp_layer_set_apply_mask (l_new_layer_id, gimp_layer_get_apply_mask(l_layer_id));
gimp_layer_set_edit_mask (l_new_layer_id, gimp_layer_get_edit_mask(l_layer_id));
gimp_layer_set_show_mask (l_new_layer_id, gimp_layer_get_show_mask(l_layer_id));
}
} /* end foreach layer */
/* copy all channels */
l_channels_list = gimp_image_get_channels(src_image_id, &l_nchannels);
/* foreach channel do */
for(l_idx = l_nchannels -1; l_idx >= 0; l_idx--)
{
l_channel_id = l_channels_list[l_idx];
if(gap_debug) printf("GAP-DEBUG: START p_copy_content channel_id=%d\n", (int)l_channel_id);
l_new_channel_id = p_my_channel_copy(dst_image_id, l_channel_id);
if (l_new_channel_id < 0) { goto cleanup; }
/* add channel on top of the channelstack */
gimp_image_add_channel (dst_image_id, l_new_channel_id, 0);
/* adjust channelproperties */
gimp_channel_set_visible (l_new_channel_id, gimp_channel_get_visible(l_channel_id));
gimp_channel_set_show_masked (l_new_channel_id, gimp_channel_get_show_masked(l_channel_id));
if(l_channel_id == l_src_fsel_attached_to_id)
{
l_fsel_attached_to_id = l_new_channel_id; /* the floating_selection is attached to this channel */
}
if(l_channel_id == gimp_image_get_active_channel(src_image_id))
{
l_active_channel_id = l_new_channel_id;
}
} /* end foreach channel */
/* check and see if we have to copy the selection */
l_channel_id = gimp_image_get_selection(src_image_id);
if((p_get_gimp_selection_bounds(src_image_id, &l_x1, &l_y1, &l_x2, &l_y2))
&& (l_channel_id >= 0))
{
if(gap_debug) printf("GAP-DEBUG: START p_copy_content selection_channel_id=%d\n", (int)l_channel_id);
l_new_channel_id = p_my_channel_copy(dst_image_id, l_channel_id);
if (l_new_channel_id < 0) { goto cleanup; }
p_gimp_selection_load (dst_image_id, l_new_channel_id);
/* delete the channel after load into selection */
gimp_channel_delete(l_new_channel_id);
}
/* attach the floating selection... */
if((l_fsel_id >= 0) && (l_fsel_attached_to_id >= 0))
{
if(gap_debug) printf("GAP-DEBUG: attaching floating_selection id=%d to id %d\n",
(int)l_fsel_id, (int)l_fsel_attached_to_id);
if(p_gimp_floating_sel_attach (l_fsel_id, l_fsel_attached_to_id) < 0)
{
/* in case of error add floating_selection like an ordinary layer
* (if patches are not installed you'll get the error for sure)
*/
printf("GAP: floating_selection is added as top-layer (attach failed)\n");
gimp_image_add_layer (dst_image_id, l_fsel_id, 0);
}
}
/* set active layer/channel */
if(l_active_channel_id >= 0)
{
if(gap_debug) printf("GAP-DEBUG: SET active channel %d\n", (int)l_active_channel_id);
gimp_image_set_active_channel(dst_image_id, l_active_channel_id);
}
if(l_active_layer_id >= 0)
{
if(gap_debug) printf("GAP-DEBUG: SET active layer %d\n", (int)l_active_layer_id);
gimp_image_set_active_layer(dst_image_id, l_active_layer_id);
}
/* Copy the colormap if necessary */
if(gimp_image_base_type(src_image_id) == INDEXED)
{
l_cmap = gimp_image_get_cmap (src_image_id, &l_ncolors);
if(gap_debug) printf("GAP-DEBUG: copy colormap ncolors %d\n", (int)l_ncolors);
gimp_image_set_cmap(dst_image_id, l_cmap, l_ncolors);
}
/* copy guides
* You need GIMP 1.1 or higher for that feature
* (in GIMP 1.0.2 there is no interface for that job
* and guides will be ignored.)
*/
l_guide_id = p_gimp_image_findnext_guide(src_image_id, 0); /* get 1.st guide */
while(l_guide_id > 0)
{
/* get position and orientation for the current guide ID */
p_gimp_image_add_guide(dst_image_id,
p_gimp_image_get_guide_position(src_image_id, l_guide_id),
p_gimp_image_get_guide_orientation(src_image_id, l_guide_id)
);
l_guide_id = p_gimp_image_findnext_guide(src_image_id, l_guide_id);
}
l_rc = 0;
cleanup:
if(l_layers_list) g_free (l_layers_list);
if(l_channels_list) g_free (l_channels_list);
if(gap_debug) printf("GAP-DEBUG: END p_copy_content dst_id=%d src_id=%d rc=%d\n",
(int)dst_image_id, (int)src_image_id, l_rc);
return (l_rc); /* 0 .. OK, or -1 on error */
} /* end p_copy_content */
/* ============================================================================ /* ============================================================================
* p_replace_img * p_replace_img
* *
@ -554,6 +348,8 @@ p_replace_img(gint32 image_id, gint32 src_image_id)
gint32 l_channel_id; gint32 l_channel_id;
gint32 l_guide_id; gint32 l_guide_id;
gint32 l_old_bg_layer_id; gint32 l_old_bg_layer_id;
char **l_path_names;
gint32 l_num_paths;
if(gap_debug) printf("\nGAP-DEBUG: START p_replace_img img_id=%d \n", (int)image_id); if(gap_debug) printf("\nGAP-DEBUG: START p_replace_img img_id=%d \n", (int)image_id);
@ -587,6 +383,18 @@ p_replace_img(gint32 image_id, gint32 src_image_id)
l_guide_id = p_gimp_image_findnext_guide(image_id, 0); l_guide_id = p_gimp_image_findnext_guide(image_id, 0);
} }
/* delete paths */
l_path_names = p_gimp_path_list(image_id, &l_num_paths);
if((l_path_names != NULL) && (l_num_paths > 0))
{
for(l_idx=0; l_idx < l_num_paths; l_idx++)
{
p_gimp_path_delete(image_id, l_path_names[l_idx]);
g_free(l_path_names[l_idx]);
}
}
if(l_path_names) g_free(l_path_names);
/* get list of all (old) dst_layers to delete */ /* get list of all (old) dst_layers to delete */
l_layers_list = gimp_image_get_layers(image_id, &l_nlayers); l_layers_list = gimp_image_get_layers(image_id, &l_nlayers);
@ -617,19 +425,8 @@ p_replace_img(gint32 image_id, gint32 src_image_id)
} }
/* copy (or steal) all layers, channels and guides from src_image */ /* steal all layers, channels and guides from src_image */
if (p_pdb_procedure_available("gimp_drawable_set_image") >= 0)
{
/* if the Procedure "gimp_drawable_set_image" is available
* we can steal the layers and channels instead of copying them
* (that gives faster performance)
*/
l_rc = p_steal_content(image_id, src_image_id); l_rc = p_steal_content(image_id, src_image_id);
}
else
{
l_rc = p_copy_content(image_id, src_image_id);
}
if(l_old_bg_layer_id >= 0) if(l_old_bg_layer_id >= 0)
{ {

View File

@ -30,6 +30,7 @@
*/ */
/* revision history: /* revision history:
* gimp 1.1.15a; 2000/01/26 hof: removed gimp 1.0.x support
* gimp 1.1.13b; 1999/12/04 hof: some cosmetic gtk fixes * gimp 1.1.13b; 1999/12/04 hof: some cosmetic gtk fixes
* changed border_width spacing and Buttons in action area * changed border_width spacing and Buttons in action area
* to same style as used in dialogs of the gimp 1.1.13 main dialogs * to same style as used in dialogs of the gimp 1.1.13 main dialogs
@ -2267,7 +2268,7 @@ int p_mov_render(gint32 image_id, t_mov_values *val_ptr, t_mov_current *cur_ptr)
l_interpolation = 1; /* rotate always with smoothing option turned on */ l_interpolation = 1; /* rotate always with smoothing option turned on */
/* have to rotate the layer (rotation also changes size as needed) */ /* have to rotate the layer (rotation also changes size as needed) */
p_gimp_rotate(image_id, l_cp_layer_id, l_interpolation, cur_ptr->currRotation); p_gimp_rotate(l_cp_layer_id, l_interpolation, cur_ptr->currRotation);
l_new_width = gimp_layer_width(l_cp_layer_id); l_new_width = gimp_layer_width(l_cp_layer_id);

View File

@ -1,21 +1,7 @@
/* gap_pdb_calls.c /* gap_pdb_calls.c
* *
* this module contains calls of procedures in the GIMPs Procedural Database * this module contains wraper calls of procedures in the GIMPs Procedural Database
* *
* IMPORTANT Notes:
* some Procedures have changed their Interface from GIMP 1.0.2 to GIMP 1.1
* in that cases the procedure parameters are checked and the call is done
* in 1.0.2 or 1.1 style respectivly.
*
* some of these procedures are not available in the official GIMP 1.0.2 releases
* (and prior releases)
*
* The missing procedures (except guides) are available as patches to the gimp core.
* If you dont install the patches GAP will NOT work on GIMP 1.0.2 and older versions.
*
* GIMP 1.1 will provide all the procedures to run GAP at full fuctionality.
* There are no Patches required to run GAP in the latest GIMP 1.1
* development version
*/ */
/* The GIMP -- an image manipulation program /* The GIMP -- an image manipulation program
@ -37,6 +23,8 @@
*/ */
/* revision history: /* revision history:
* version 1.1.15a; 2000/01/26 hof: pathes
* removed old gimp 1.0.x PDB Interfaces
* version 1.1.14a; 2000/01/09 hof: thumbnail save/load, * version 1.1.14a; 2000/01/09 hof: thumbnail save/load,
* Procedures for video_info file * Procedures for video_info file
* version 0.98.00; 1998/11/28 hof: 1.st (pre) release (GAP port to GIMP 1.1) * version 0.98.00; 1998/11/28 hof: 1.st (pre) release (GAP port to GIMP 1.1)
@ -122,8 +110,6 @@ p_get_gimp_selection_bounds (gint32 image_id, gint32 *x1, gint32 *y1, gint32 *x2
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_get_sel_bounds_proc) >= 0)
{
return_vals = gimp_run_procedure (l_get_sel_bounds_proc, return_vals = gimp_run_procedure (l_get_sel_bounds_proc,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -139,11 +125,6 @@ p_get_gimp_selection_bounds (gint32 image_id, gint32 *x1, gint32 *y1, gint32 *x2
} }
printf("GAP: Error: PDB call of %s failed staus=%d\n", printf("GAP: Error: PDB call of %s failed staus=%d\n",
l_get_sel_bounds_proc, (int)return_vals[0].data.d_status); l_get_sel_bounds_proc, (int)return_vals[0].data.d_status);
}
else
{
printf("GAP: Error: Procedure %s not found.\n",l_get_sel_bounds_proc);
}
return(FALSE); return(FALSE);
} /* end p_get_gimp_selection_bounds */ } /* end p_get_gimp_selection_bounds */
@ -153,36 +134,16 @@ p_get_gimp_selection_bounds (gint32 image_id, gint32 *x1, gint32 *y1, gint32 *x2
* ============================================================================ * ============================================================================
*/ */
gint gint
p_gimp_selection_load (gint32 image_id, gint32 channel_id) p_gimp_selection_load (gint32 channel_id)
{ {
static char *l_sel_load = "gimp_selection_load"; static char *l_sel_load = "gimp_selection_load";
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
int l_nparams;
l_nparams = p_pdb_procedure_available(l_sel_load);
if (l_nparams >= 0)
{
/* check if it can take exactly one channel_id as input (gimp1.1) */
if(l_nparams == 1)
{
/* use the new Interface (Gimp 1.1 style)
* (1.1 knows the image_id where the channel belongs to)
*/
return_vals = gimp_run_procedure (l_sel_load, return_vals = gimp_run_procedure (l_sel_load,
&nreturn_vals, &nreturn_vals,
PARAM_CHANNEL, channel_id, PARAM_CHANNEL, channel_id,
PARAM_END); PARAM_END);
}
else
{
/* use the old Interface (Gimp 1.0.2 style) */
return_vals = gimp_run_procedure (l_sel_load,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_CHANNEL, channel_id,
PARAM_END);
}
if (return_vals[0].data.d_status == STATUS_SUCCESS) if (return_vals[0].data.d_status == STATUS_SUCCESS)
{ {
@ -190,11 +151,6 @@ p_gimp_selection_load (gint32 image_id, gint32 channel_id)
} }
printf("GAP: Error: PDB call of %s failed status=%d\n", printf("GAP: Error: PDB call of %s failed status=%d\n",
l_sel_load, (int)return_vals[0].data.d_status); l_sel_load, (int)return_vals[0].data.d_status);
}
else
{
printf("GAP: Error: Procedure %s not found.\n",l_sel_load);
}
return(FALSE); return(FALSE);
} /* end p_gimp_selection_load */ } /* end p_gimp_selection_load */
@ -211,8 +167,6 @@ p_layer_set_linked (gint32 layer_id, gint32 new_state)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_set_linked_proc) >= 0)
{
return_vals = gimp_run_procedure (l_set_linked_proc, return_vals = gimp_run_procedure (l_set_linked_proc,
&nreturn_vals, &nreturn_vals,
PARAM_LAYER, layer_id, PARAM_LAYER, layer_id,
@ -224,11 +178,6 @@ p_layer_set_linked (gint32 layer_id, gint32 new_state)
return (0); return (0);
} }
printf("GAP: Error: p_layer_set_linked to state %d failed\n",(int)new_state); printf("GAP: Error: p_layer_set_linked to state %d failed\n",(int)new_state);
}
else
{
printf("GAP: Warning: Procedure %s not found. (Layer Can not be set to linked)\n",l_set_linked_proc);
}
return(-1); return(-1);
} /* end p_layer_set_linked */ } /* end p_layer_set_linked */
@ -240,83 +189,12 @@ p_layer_set_linked (gint32 layer_id, gint32 new_state)
gint p_layer_get_linked(gint32 layer_id) gint p_layer_get_linked(gint32 layer_id)
{ {
/* Note: The Procedure "gimp_layer_get_linked" is part of GIMP 1.1
* but there is not such an Interface in gimp 1.0.2
*/
static char *l_get_linked_proc = "gimp_layer_get_linked"; static char *l_get_linked_proc = "gimp_layer_get_linked";
int l_nparams;
int l_nreturn_vals;
int l_proc_type;
char *l_proc_blurb;
char *l_proc_help;
char *l_proc_author;
char *l_proc_copyright;
char *l_proc_date;
GParamDef *l_params;
GParamDef *l_return_vals;
gint l_rc;
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
gint32 is_linked; gint32 is_linked;
l_rc = 0;
/* Query the gimp application's procedural database
* regarding a particular procedure.
*/
if(gimp_query_procedure (l_get_linked_proc,
&l_proc_blurb,
&l_proc_help,
&l_proc_author,
&l_proc_copyright,
&l_proc_date,
&l_proc_type,
&l_nparams,
&l_nreturn_vals,
&l_params,
&l_return_vals))
{
/* procedure found in PDB */
/* check if it can take exactly one layerid as input
* and give one result int32 parameter (TRUE/FALSE)
*/
if (l_nparams != 1) { l_rc = -1; }
if (l_params[0].type != PARAM_LAYER) { l_rc = -1; }
if (l_nreturn_vals != 1) { l_rc = -1; }
if (l_return_vals[0].type != PARAM_INT32) { l_rc = -1; }
/* free the query information */
g_free (l_proc_blurb);
g_free (l_proc_help);
g_free (l_proc_author);
g_free (l_proc_copyright);
g_free (l_proc_date);
g_free (l_params);
g_free (l_return_vals);
if(l_rc != 0)
{
printf("Warning: Procedure %s has unexpected Interface. (Can not operate on linked layers)\n",l_get_linked_proc);
printf("expected: 1, 1, PARAM_LAYER = %d PARAM_INT32 = %d\n", (int)PARAM_LAYER, (int)PARAM_INT32);
printf("l_nparams = %d\n", (int)l_nparams);
printf("l_nreturn_vals = %d\n", (int)l_nreturn_vals);
printf("l_params[0].type = %d\n", (int)l_params[0].type);
printf("l_return_vals[0].type = %d\n", (int)l_return_vals[0].type);
return FALSE;
}
}
else
{
printf("Warning: Procedure %s not found. (Can not operate on linked layers)\n",l_get_linked_proc);
return FALSE;
}
/* run the procedure */
is_linked = FALSE; is_linked = FALSE;
return_vals = gimp_run_procedure (l_get_linked_proc, return_vals = gimp_run_procedure (l_get_linked_proc,
&nreturn_vals, &nreturn_vals,
PARAM_LAYER, layer_id, PARAM_LAYER, layer_id,
@ -343,8 +221,6 @@ gint32 p_gimp_image_floating_sel_attached_to(gint32 image_id)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_fsel_attached_to_proc) >= 0)
{
return_vals = gimp_run_procedure (l_fsel_attached_to_proc, return_vals = gimp_run_procedure (l_fsel_attached_to_proc,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -355,13 +231,6 @@ gint32 p_gimp_image_floating_sel_attached_to(gint32 image_id)
return(return_vals[1].data.d_drawable); return(return_vals[1].data.d_drawable);
} }
printf("GAP: Error: PDB call of %s failed\n", l_fsel_attached_to_proc); printf("GAP: Error: PDB call of %s failed\n", l_fsel_attached_to_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_fsel_attached_to_proc,
"(cant find out drawable where f-sel is attached to)");
}
return(-1); return(-1);
} /* end p_gimp_image_floating_sel_attached_to */ } /* end p_gimp_image_floating_sel_attached_to */
@ -377,8 +246,6 @@ gint p_gimp_floating_sel_attach(gint32 layer_id, gint32 drawable_id)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_fsel_attach_proc) >= 0)
{
return_vals = gimp_run_procedure (l_fsel_attach_proc, return_vals = gimp_run_procedure (l_fsel_attach_proc,
&nreturn_vals, &nreturn_vals,
PARAM_LAYER, layer_id, PARAM_LAYER, layer_id,
@ -390,13 +257,6 @@ gint p_gimp_floating_sel_attach(gint32 layer_id, gint32 drawable_id)
return (0); return (0);
} }
printf("GAP: Error: PDB call of %s failed\n", l_fsel_attach_proc); printf("GAP: Error: PDB call of %s failed\n", l_fsel_attach_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_fsel_attach_proc,
"(cannot attach floating selection)");
}
return(-1); return(-1);
} /* end p_gimp_floating_sel_attach */ } /* end p_gimp_floating_sel_attach */
@ -412,8 +272,6 @@ gint p_gimp_floating_sel_rigor(gint32 layer_id, gint32 undo)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_fsel_rigor_proc) >= 0)
{
return_vals = gimp_run_procedure (l_fsel_rigor_proc, return_vals = gimp_run_procedure (l_fsel_rigor_proc,
&nreturn_vals, &nreturn_vals,
PARAM_LAYER, layer_id, PARAM_LAYER, layer_id,
@ -425,13 +283,6 @@ gint p_gimp_floating_sel_rigor(gint32 layer_id, gint32 undo)
return (0); return (0);
} }
printf("GAP: Error: PDB call of %s failed\n", l_fsel_rigor_proc); printf("GAP: Error: PDB call of %s failed\n", l_fsel_rigor_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_fsel_rigor_proc,
"(cannot attach floating selection)");
}
return(-1); return(-1);
} /* end p_gimp_floating_sel_rigor */ } /* end p_gimp_floating_sel_rigor */
@ -447,8 +298,6 @@ gint p_gimp_floating_sel_relax(gint32 layer_id, gint32 undo)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_fsel_relax_proc) >= 0)
{
return_vals = gimp_run_procedure (l_fsel_relax_proc, return_vals = gimp_run_procedure (l_fsel_relax_proc,
&nreturn_vals, &nreturn_vals,
PARAM_LAYER, layer_id, PARAM_LAYER, layer_id,
@ -460,13 +309,6 @@ gint p_gimp_floating_sel_relax(gint32 layer_id, gint32 undo)
return (0); return (0);
} }
printf("GAP: Error: PDB call of %s failed\n", l_fsel_relax_proc); printf("GAP: Error: PDB call of %s failed\n", l_fsel_relax_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_fsel_relax_proc,
"(cannot attach floating selection)");
}
return(-1); return(-1);
} /* end p_gimp_floating_sel_relax */ } /* end p_gimp_floating_sel_relax */
@ -494,8 +336,6 @@ gint32 p_gimp_image_add_guide(gint32 image_id, gint32 position, gint32 orienta
l_add_guide_proc = "gimp_image_add_hguide"; l_add_guide_proc = "gimp_image_add_hguide";
} }
if (p_pdb_procedure_available(l_add_guide_proc) >= 0)
{
return_vals = gimp_run_procedure (l_add_guide_proc, return_vals = gimp_run_procedure (l_add_guide_proc,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -507,13 +347,6 @@ gint32 p_gimp_image_add_guide(gint32 image_id, gint32 position, gint32 orienta
return(return_vals[1].data.d_int32); /* return the guide ID */ return(return_vals[1].data.d_int32); /* return the guide ID */
} }
printf("GAP: Error: PDB call of %s failed\n", l_add_guide_proc); printf("GAP: Error: PDB call of %s failed\n", l_add_guide_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_add_guide_proc,
"(cannot add guide)");
}
return(-1); return(-1);
} /* end p_gimp_image_add_guide */ } /* end p_gimp_image_add_guide */
@ -535,8 +368,6 @@ gint32 p_gimp_image_findnext_guide(gint32 image_id, gint32 guide_id)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_findnext_guide_proc) >= 0)
{
return_vals = gimp_run_procedure (l_findnext_guide_proc, return_vals = gimp_run_procedure (l_findnext_guide_proc,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -548,13 +379,6 @@ gint32 p_gimp_image_findnext_guide(gint32 image_id, gint32 guide_id)
return(return_vals[1].data.d_int32); /* return the next guide ID */ return(return_vals[1].data.d_int32); /* return the next guide ID */
} }
printf("GAP: Error: PDB call of %s failed\n", l_findnext_guide_proc); printf("GAP: Error: PDB call of %s failed\n", l_findnext_guide_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_findnext_guide_proc,
"(if image has guides they are not saved)");
}
return(-1); return(-1);
} /* end p_gimp_image_findnext_guide */ } /* end p_gimp_image_findnext_guide */
@ -572,8 +396,6 @@ gint32 p_gimp_image_get_guide_position(gint32 image_id, gint32 guide_id)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_get_guide_pos_proc) >= 0)
{
return_vals = gimp_run_procedure (l_get_guide_pos_proc, return_vals = gimp_run_procedure (l_get_guide_pos_proc,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -585,13 +407,6 @@ gint32 p_gimp_image_get_guide_position(gint32 image_id, gint32 guide_id)
return(return_vals[1].data.d_int32); /* return the guide position */ return(return_vals[1].data.d_int32); /* return the guide position */
} }
printf("GAP: Error: PDB call of %s failed\n", l_get_guide_pos_proc); printf("GAP: Error: PDB call of %s failed\n", l_get_guide_pos_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_get_guide_pos_proc,
"(cannot save guides)");
}
return(-1); return(-1);
} /* end p_gimp_image_get_guide_position */ } /* end p_gimp_image_get_guide_position */
@ -608,8 +423,6 @@ gint32 p_gimp_image_get_guide_orientation(gint32 image_id, gint32 guide_id)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_get_guide_pos_orient) >= 0)
{
return_vals = gimp_run_procedure (l_get_guide_pos_orient, return_vals = gimp_run_procedure (l_get_guide_pos_orient,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -621,13 +434,6 @@ gint32 p_gimp_image_get_guide_orientation(gint32 image_id, gint32 guide_id)
return(return_vals[1].data.d_int32); /* return the guide orientation */ return(return_vals[1].data.d_int32); /* return the guide orientation */
} }
printf("GAP: Error: PDB call of %s failed\n", l_get_guide_pos_orient); printf("GAP: Error: PDB call of %s failed\n", l_get_guide_pos_orient);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_get_guide_pos_orient,
"(cannot save guides)");
}
return(-1); return(-1);
} /* end p_gimp_image_get_guide_orientation */ } /* end p_gimp_image_get_guide_orientation */
@ -644,8 +450,6 @@ gint32 p_gimp_image_delete_guide(gint32 image_id, gint32 guide_id)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_delete_guide_proc) >= 0)
{
return_vals = gimp_run_procedure (l_delete_guide_proc, return_vals = gimp_run_procedure (l_delete_guide_proc,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -657,13 +461,6 @@ gint32 p_gimp_image_delete_guide(gint32 image_id, gint32 guide_id)
return(return_vals[1].data.d_int32); /* return the next guide ID */ return(return_vals[1].data.d_int32); /* return the next guide ID */
} }
printf("GAP: Error: PDB call of %s failed\n", l_delete_guide_proc); printf("GAP: Error: PDB call of %s failed\n", l_delete_guide_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_delete_guide_proc,
"(cant remove old guides)");
}
return(-1); return(-1);
} /* end p_gimp_image_delete_guide */ } /* end p_gimp_image_delete_guide */
@ -680,8 +477,6 @@ gint p_gimp_selection_none(gint32 image_id)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_sel_none_proc) >= 0)
{
return_vals = gimp_run_procedure (l_sel_none_proc, return_vals = gimp_run_procedure (l_sel_none_proc,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -692,86 +487,42 @@ gint p_gimp_selection_none(gint32 image_id)
return (0); return (0);
} }
printf("GAP: Error: PDB call of %s failed\n", l_sel_none_proc); printf("GAP: Error: PDB call of %s failed\n", l_sel_none_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_sel_none_proc,
"(cannot remove selection)");
}
return(-1); return(-1);
} /* end p_gimp_selection_none */ } /* end p_gimp_selection_none */
/* ============================================================================ /* ============================================================================
* p_gimp_rotate * p_gimp_rotate
* PDB call of 'gimp_rotate' * PDB call of 'gimp_rotate'
* ============================================================================ * ============================================================================
*/ */
gint p_gimp_rotate(gint32 image_id, gint32 drawable_id, gint32 interpolation, gdouble angle_deg) gint p_gimp_rotate(gint32 drawable_id, gint32 interpolation, gdouble angle_deg)
{ {
static char *l_rotate_proc = "gimp_rotate"; static char *l_rotate_proc = "gimp_rotate";
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
gdouble l_angle_rad; gdouble l_angle_rad;
int l_nparams;
int l_rc;
l_rc = -1;
l_angle_rad = (angle_deg * 3.14159) / 180.0; l_angle_rad = (angle_deg * 3.14159) / 180.0;
l_nparams = p_pdb_procedure_available(l_rotate_proc);
if (l_nparams >= 0)
{
if (l_nparams == 3)
{
/* use the new Interface (Gimp 1.1 style)
* (1.1 knows the image_id where the drawable belongs to)
*/
return_vals = gimp_run_procedure (l_rotate_proc, return_vals = gimp_run_procedure (l_rotate_proc,
&nreturn_vals, &nreturn_vals,
PARAM_DRAWABLE, drawable_id, PARAM_DRAWABLE, drawable_id,
PARAM_INT32, interpolation, PARAM_INT32, interpolation,
PARAM_FLOAT, l_angle_rad, PARAM_FLOAT, l_angle_rad,
PARAM_END); PARAM_END);
}
else
{
/* use the old Interface (Gimp 1.0.2 style) */
return_vals = gimp_run_procedure (l_rotate_proc,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_DRAWABLE, drawable_id,
PARAM_INT32, interpolation,
PARAM_FLOAT, l_angle_rad,
PARAM_END);
}
if (return_vals[0].data.d_status == STATUS_SUCCESS) if (return_vals[0].data.d_status == STATUS_SUCCESS)
{ {
l_rc = 0; return(0);
} }
else return (-1);
{
printf("gap: %s call failed %d\n", l_rotate_proc, (int)return_vals[0].data.d_status);
}
gimp_destroy_params (return_vals, nreturn_vals);
}
else
{
printf("GAP: Error: Procedure %s not found.\n",l_rotate_proc);
}
return (l_rc);
} /* end p_gimp_rotate */ } /* end p_gimp_rotate */
/* ============================================================================ /* ============================================================================
* p_gimp_channel_ops_duplicate * p_gimp_channel_ops_duplicate
* call gimp_channel_ops_duplicate via procedural database
* (i could not find a direct call interface in gimp0.99.15)
* ============================================================================ * ============================================================================
*/ */
gint32 p_gimp_channel_ops_duplicate (gint32 image_ID) gint32 p_gimp_channel_ops_duplicate (gint32 image_ID)
@ -787,17 +538,15 @@ gint32 p_gimp_channel_ops_duplicate (gint32 image_ID)
new_image_ID = -1; new_image_ID = -1;
if (return_vals[0].data.d_status == STATUS_SUCCESS) if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
new_image_ID = return_vals[1].data.d_image; new_image_ID = return_vals[1].data.d_image;
}
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
return new_image_ID; return new_image_ID;
} /* end p_gimp_channel_ops_duplicate */ } /* end p_gimp_channel_ops_duplicate */
/* ============================================================================ /* ============================================================================
* p_gimp_drawable_set_image * p_gimp_drawable_set_image
* *
@ -810,8 +559,6 @@ gint p_gimp_drawable_set_image(gint32 drawable_id, gint32 image_id)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_drawable_set_img_proc) >= 0)
{
return_vals = gimp_run_procedure (l_drawable_set_img_proc, return_vals = gimp_run_procedure (l_drawable_set_img_proc,
&nreturn_vals, &nreturn_vals,
PARAM_DRAWABLE, drawable_id, PARAM_DRAWABLE, drawable_id,
@ -823,13 +570,6 @@ gint p_gimp_drawable_set_image(gint32 drawable_id, gint32 image_id)
return (0); return (0);
} }
printf("GAP: Error: PDB call of %s failed\n", l_drawable_set_img_proc); printf("GAP: Error: PDB call of %s failed\n", l_drawable_set_img_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_drawable_set_img_proc,
"(cannot attach floating selection)");
}
return(-1); return(-1);
} /* end p_gimp_drawable_set_image */ } /* end p_gimp_drawable_set_image */
@ -877,8 +617,6 @@ p_gimp_file_save_thumbnail(gint32 image_id, char* filename)
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
if (p_pdb_procedure_available(l_called_proc) >= 0)
{
return_vals = gimp_run_procedure (l_called_proc, return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -890,13 +628,6 @@ p_gimp_file_save_thumbnail(gint32 image_id, char* filename)
return (0); return (0);
} }
printf("GAP: Error: PDB call of %s failed\n", l_called_proc); printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_called_proc,
"(cannot save thumbnails)");
}
return(-1); return(-1);
} /* end p_gimp_file_save_thumbnail */ } /* end p_gimp_file_save_thumbnail */
@ -912,12 +643,8 @@ p_gimp_file_load_thumbnail(char* filename, gint32 *th_width, gint32 *th_height,
static char *l_called_proc = "gimp_file_load_thumbnail"; static char *l_called_proc = "gimp_file_load_thumbnail";
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
int bytesize;
unsigned char *l_ptr;
*th_data = NULL; *th_data = NULL;
if (p_pdb_procedure_available(l_called_proc) >= 0)
{
return_vals = gimp_run_procedure (l_called_proc, return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals, &nreturn_vals,
PARAM_STRING, filename, PARAM_STRING, filename,
@ -927,34 +654,10 @@ p_gimp_file_load_thumbnail(char* filename, gint32 *th_width, gint32 *th_height,
{ {
*th_width = return_vals[1].data.d_int32; *th_width = return_vals[1].data.d_int32;
*th_height = return_vals[2].data.d_int32; *th_height = return_vals[2].data.d_int32;
l_ptr = return_vals[3].data.d_int8array; *th_data = (unsigned char *)return_vals[3].data.d_int8array;
return (0); /* OK */
bytesize = 3 * (*th_width) * (*th_height);
*th_data = g_malloc(bytesize);
if((*th_data != NULL) && (l_ptr != NULL))
{
/* BUG in the PDB Interface in gimp.1.1.14
* the return_vals[3].data.d_int8array does NOT really point
* to the thumbnail data (as it should)
* and we retrieve only NONSENSE DATA here.
*
* (maybe we need an additional data length parameter
* as it is usual for array parameter passing ?)
*/
memcpy(*th_data, l_ptr, bytesize);
return (0);
}
} }
printf("GAP: Error: PDB call of %s failed\n", l_called_proc); printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_called_proc,
"(cannot load thumbnails)");
}
return(-1); return(-1);
} /* end p_gimp_file_load_thumbnail */ } /* end p_gimp_file_load_thumbnail */
@ -967,12 +670,8 @@ gint p_gimp_image_thumbnail(gint32 image_id, gint32 width, gint32 height,
static char *l_called_proc = "gimp_image_thumbnail"; static char *l_called_proc = "gimp_image_thumbnail";
GParam *return_vals; GParam *return_vals;
int nreturn_vals; int nreturn_vals;
unsigned char *l_ptr;
gint32 *l_ptr32;
*th_data = NULL; *th_data = NULL;
if (p_pdb_procedure_available(l_called_proc) >= 0)
{
return_vals = gimp_run_procedure (l_called_proc, return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals, &nreturn_vals,
PARAM_IMAGE, image_id, PARAM_IMAGE, image_id,
@ -986,27 +685,187 @@ gint p_gimp_image_thumbnail(gint32 image_id, gint32 width, gint32 height,
*th_height = return_vals[2].data.d_int32; *th_height = return_vals[2].data.d_int32;
*th_bpp = return_vals[3].data.d_int32; *th_bpp = return_vals[3].data.d_int32;
*th_data_count = return_vals[4].data.d_int32; *th_data_count = return_vals[4].data.d_int32;
l_ptr = return_vals[5].data.d_int8array; *th_data = (unsigned char *)return_vals[5].data.d_int8array;
return(0); /* OK */
*th_data = g_malloc(*th_data_count);
if((*th_data != NULL) && (l_ptr != NULL))
{
memcpy(*th_data, l_ptr, *th_data_count);
return (0);
}
} }
printf("GAP: Error: PDB call of %s failed\n", l_called_proc); printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_called_proc,
"(cannot get image thumbnail)");
}
return(-1); return(-1);
} /* end p_gimp_image_thumbnail */ } /* end p_gimp_image_thumbnail */
/* ============================================================================
* p_gimp_path_set_points
*
* ============================================================================
*/
gint
p_gimp_path_set_points(gint32 image_id, char *name,
gint32 path_type, gint32 num_points, gdouble *path_points)
{
static char *l_called_proc = "gimp_path_set_points";
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_STRING, name,
PARAM_INT32, path_type,
PARAM_INT32, num_points,
PARAM_FLOATARRAY, path_points,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
return(0); /* OK */
}
printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
return(-1);
} /* end p_gimp_path_set_points */
/* ============================================================================
* p_gimp_path_get_points
*
* ============================================================================
*/
gdouble *
p_gimp_path_get_points(gint32 image_id, char *name,
gint32 *path_type, gint32 *path_closed, gint32 *num_points)
{
static char *l_called_proc = "gimp_path_get_points";
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_STRING, name,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
*path_type = return_vals[1].data.d_int32;
*path_closed = return_vals[2].data.d_int32;
*num_points = return_vals[3].data.d_int32;
return(return_vals[4].data.d_floatarray); /* OK return path points */
}
printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
*num_points = 0;
return(NULL);
} /* end p_gimp_path_get_points */
/* ============================================================================
* p_gimp_path_delete
*
* ============================================================================
*/
gint
p_gimp_path_delete(gint32 image_id, char *name)
{
static char *l_called_proc = "gimp_path_delete";
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_STRING, name,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
return (0);
}
printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
return(-1);
} /* end p_gimp_path_delete */
/* ============================================================================
* p_gimp_path_list
*
* ============================================================================
*/
char **
p_gimp_path_list(gint32 image_id, gint32 *num_paths)
{
static char *l_called_proc = "gimp_path_list";
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
*num_paths = return_vals[1].data.d_int32;
return(return_vals[2].data.d_stringarray); /* OK, return path names */
}
printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
*num_paths = 0;
return(NULL);
} /* end p_gimp_path_list */
/* ============================================================================
* p_gimp_path_get_current
*
* ============================================================================
*/
char *
p_gimp_path_get_current(gint32 image_id)
{
static char *l_called_proc = "gimp_path_get_current";
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
return(g_strdup(return_vals[1].data.d_string)); /* OK */
}
printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
return(NULL);
} /* end p_gimp_path_get_current */
/* ============================================================================
* p_gimp_path_set_current
*
* ============================================================================
*/
gint
p_gimp_path_set_current(gint32 image_id, char *name)
{
static char *l_called_proc = "gimp_path_set_current";
GParam *return_vals;
int nreturn_vals;
return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_STRING, name,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
return(0); /* OK */
}
printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
return(-1);
} /* end p_gimp_path_set_current */
/* ============================================================================ /* ============================================================================
* Procedures to get/set the video_info_file * Procedures to get/set the video_info_file
* ============================================================================ * ============================================================================

View File

@ -21,6 +21,7 @@
*/ */
/* revision history: /* revision history:
* version 1.1.15a; 2000/01/26 hof: pathes, removed gimp 1.0.x support
* version 1.1.14a; 2000/01/06 hof: thumbnail save/load, * version 1.1.14a; 2000/01/06 hof: thumbnail save/load,
* Procedures for video_info file * Procedures for video_info file
* version 0.98.00; 1998/11/30 hof: all PDB-calls of GIMP PDB-Procedures * version 0.98.00; 1998/11/30 hof: all PDB-calls of GIMP PDB-Procedures
@ -39,7 +40,7 @@ typedef struct t_video_info {
gint p_pdb_procedure_available(char *proc_name); gint p_pdb_procedure_available(char *proc_name);
gint p_get_gimp_selection_bounds (gint32 image_id, gint32 *x1, gint32 *y1, gint32 *x2, gint32 *y2); gint p_get_gimp_selection_bounds (gint32 image_id, gint32 *x1, gint32 *y1, gint32 *x2, gint32 *y2);
gint p_gimp_selection_load (gint32 image_id, gint32 channel_id); gint p_gimp_selection_load (gint32 channel_id);
int p_layer_set_linked (gint32 layer_id, gint32 new_state); int p_layer_set_linked (gint32 layer_id, gint32 new_state);
gint p_layer_get_linked(gint32 layer_id); gint p_layer_get_linked(gint32 layer_id);
@ -55,7 +56,7 @@ gint32 p_gimp_image_get_guide_orientation(gint32 image_id, gint32 guide_id);
gint32 p_gimp_image_delete_guide(gint32 image_id, gint32 guide_id); gint32 p_gimp_image_delete_guide(gint32 image_id, gint32 guide_id);
gint p_gimp_selection_none(gint32 image_id); gint p_gimp_selection_none(gint32 image_id);
gint p_gimp_rotate(gint32 image_id, gint32 drawable_id, gint32 interpolation, gdouble angle_deg); gint p_gimp_rotate(gint32 drawable_id, gint32 interpolation, gdouble angle_deg);
gint32 p_gimp_channel_ops_duplicate (gint32 image_ID); gint32 p_gimp_channel_ops_duplicate (gint32 image_ID);
@ -71,6 +72,17 @@ gint p_gimp_image_thumbnail(gint32 image_id, gint32 width, gint32 height,
gint32 *th_data_count, unsigned char **th_data); gint32 *th_data_count, unsigned char **th_data);
gint p_gimp_path_set_points(gint32 image_id, char *name,
gint32 path_type, gint32 num_points,
gdouble *path_points);
gdouble *p_gimp_path_get_points(gint32 image_id, char *name,
gint32 *path_type, gint32 *path_closed,
gint32 *num_points);
gint p_gimp_path_delete(gint32 image_id, char *name);
char **p_gimp_path_list(gint32 image_id, gint32 *num_paths);
gint p_gimp_path_set_current(gint32 image_id, char *name);
char *p_gimp_path_get_current(gint32 image_id);
char *p_alloc_video_info_name(char *basename); char *p_alloc_video_info_name(char *basename);