mirror of https://github.com/GNOME/gimp.git
Moved the guide PDB functions into a more sensible place, made them
* app/gimage_cmds.c app/gimage_cmds.h app/gimpimage.c app/gimpimage.h libgimp/gimp.h libgimp/gimpenums.h libgimp/gimpimage.c: Moved the guide PDB functions into a more sensible place, made them accessible to plugins through libgimp.
This commit is contained in:
parent
5f1dbcb079
commit
976f803c44
|
@ -1,3 +1,11 @@
|
|||
Tue Sep 1 19:19:57 BST 1998 Adam D. Moss <adam@gimp.org>
|
||||
|
||||
* app/gimage_cmds.c app/gimage_cmds.h app/gimpimage.c
|
||||
app/gimpimage.h libgimp/gimp.h libgimp/gimpenums.h
|
||||
libgimp/gimpimage.c: Moved the guide PDB functions into
|
||||
a more sensible place, made them accessible to plugins
|
||||
through libgimp.
|
||||
|
||||
Tue Sep 1 01:15:06 CDT 1998 Larry Ewing <lewing@gimp.org>
|
||||
|
||||
* app/layers_dialog.c (paint_mode_menu_get_position): added this
|
||||
|
|
|
@ -33,14 +33,6 @@
|
|||
#include "drawable_pvt.h" /* ick ick. */
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
static Argument* gimp_image_add_hguide_invoker (Argument*);
|
||||
static Argument* gimp_image_add_vguide_invoker (Argument*);
|
||||
static Argument* gimp_image_delete_guide_invoker (Argument*);/*fixme:refcount*/
|
||||
static Argument* gimp_image_findnext_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_position_invoker (Argument*);
|
||||
|
||||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_free_projection (GimpImage *);
|
||||
|
@ -789,623 +781,6 @@ gimp_image_transform_color (GimpImage *gimage, GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
|
||||
/* The gimp_image_add_hguide procedure definition */
|
||||
ProcArg gimp_image_add_hguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"yposition",
|
||||
"The guide's y-offset from top of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_hguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_hguide_proc =
|
||||
{
|
||||
"gimp_image_add_hguide",
|
||||
"Add a horizontal Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the y-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_hguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_hguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_hguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_hguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_hguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_hguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_add_vguide procedure definition */
|
||||
ProcArg gimp_image_add_vguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"xposition",
|
||||
"The guide's x-offset from left of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_vguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_vguide_proc =
|
||||
{
|
||||
"gimp_image_add_vguide",
|
||||
"Add a vertical Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the x-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_vguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_vguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_vguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_vguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_vguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_vguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_delete_guide procedure definition */
|
||||
ProcArg gimp_image_delete_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of the Guide to be removed"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_delete_guide_proc =
|
||||
{
|
||||
"gimp_image_delete_guide",
|
||||
"Deletes a Guide from an image",
|
||||
"This procedure takes an image and a guide_id as input and removes the specified Guide from the specified image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_delete_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_delete_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_delete_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
success = FALSE;
|
||||
guides = gimage->guides;
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position >= 0) )
|
||||
{
|
||||
GList *tmp_next;
|
||||
|
||||
/* printf("Gotcha at %p\n", ((Guide*)guides->data)); */
|
||||
success = TRUE;
|
||||
|
||||
tmp_next = g_list_next(guides);
|
||||
|
||||
((Guide*)guides->data)->position = -1;
|
||||
undo_push_guide (gimage, ((Guide*)guides->data));
|
||||
/*gimp_image_remove_guide (gimage, ((Guide*)guides->data));*/
|
||||
|
||||
guides = tmp_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_delete_guide_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_findnext_guide procedure definition */
|
||||
ProcArg gimp_image_findnext_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of current Guide (0 if first invocation)"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_findnext_guide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The next guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_findnext_guide_proc =
|
||||
{
|
||||
"gimp_image_findnext_guide",
|
||||
"Find next Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and finds the guide_id of the successor of the given guide_id in the image's Guide list. If the supplied guide_id is 0, the procedure will return the first Guide. The procedure will return 0 if given the final guide_id as an argument or the image has no guides.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_findnext_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_findnext_guide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_findnext_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_findnext_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
rtn_guide_id = 0;
|
||||
|
||||
if (guides == NULL) /* No guides */
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (guide_id == 0) /* init - Return first guide_ID in list */
|
||||
{
|
||||
while (guides != NULL &&
|
||||
((Guide*)guides->data)->position < 0)
|
||||
guides = g_list_next(guides);
|
||||
|
||||
if (guides)
|
||||
rtn_guide_id = ((Guide*)guides->data)->guide_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
/*printf("Gotcha at %p: %d, %d, %d\n",
|
||||
((Guide*)guides->data),
|
||||
((Guide*)guides->data)->position,
|
||||
((Guide*)guides->data)->orientation,
|
||||
((Guide*)guides->data)->guide_ID
|
||||
);*/
|
||||
|
||||
success = TRUE;
|
||||
if (g_list_next(guides) == NULL)
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList* tmplist;
|
||||
tmplist = g_list_next(guides);
|
||||
|
||||
rtn_guide_id = ((Guide*)tmplist->data)->guide_ID;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args (&gimp_image_findnext_guide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_guide_id;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_orientation procedure definition */
|
||||
ProcArg gimp_image_get_guide_orientation_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_orientation_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"orientation",
|
||||
"The guide's orientation - vert=0, horiz=1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_orientation_proc =
|
||||
{
|
||||
"gimp_image_get_guide_orientation",
|
||||
"Get orientation of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the orientations of the guide, where 0=vertical and 1=horizontal.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_orientation_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_orientation_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_orientation_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_orientation_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_orientation;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
switch (((Guide*)guides->data)->orientation)
|
||||
{
|
||||
case VERTICAL_GUIDE: rtn_orientation = 0; break;
|
||||
case HORIZONTAL_GUIDE: rtn_orientation = 1; break;
|
||||
default:
|
||||
{
|
||||
rtn_orientation = 0;
|
||||
g_warning("Guide has bad orientation.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_orientation_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_orientation;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_position procedure definition */
|
||||
ProcArg gimp_image_get_guide_position_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_position_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"position",
|
||||
"The guide's position relative to top or left of image"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_position_proc =
|
||||
{
|
||||
"gimp_image_get_guide_position",
|
||||
"Get position of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the position of the guide relative to the top or left of the image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_position_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_position_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_position_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_position_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_position;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
rtn_position = ((Guide*)guides->data)->position;
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_position_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_position;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -199,13 +199,4 @@ void gimp_image_invalidate_preview (GimpImage *);
|
|||
|
||||
void gimp_image_invalidate_previews (void);
|
||||
|
||||
|
||||
/* Exported for PDB */
|
||||
extern ProcRecord gimp_image_add_hguide_proc;
|
||||
extern ProcRecord gimp_image_add_vguide_proc;
|
||||
extern ProcRecord gimp_image_delete_guide_proc;
|
||||
extern ProcRecord gimp_image_findnext_guide_proc;
|
||||
extern ProcRecord gimp_image_get_guide_orientation_proc;
|
||||
extern ProcRecord gimp_image_get_guide_position_proc;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,14 +33,6 @@
|
|||
#include "drawable_pvt.h" /* ick ick. */
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
static Argument* gimp_image_add_hguide_invoker (Argument*);
|
||||
static Argument* gimp_image_add_vguide_invoker (Argument*);
|
||||
static Argument* gimp_image_delete_guide_invoker (Argument*);/*fixme:refcount*/
|
||||
static Argument* gimp_image_findnext_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_position_invoker (Argument*);
|
||||
|
||||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_free_projection (GimpImage *);
|
||||
|
@ -789,623 +781,6 @@ gimp_image_transform_color (GimpImage *gimage, GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
|
||||
/* The gimp_image_add_hguide procedure definition */
|
||||
ProcArg gimp_image_add_hguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"yposition",
|
||||
"The guide's y-offset from top of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_hguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_hguide_proc =
|
||||
{
|
||||
"gimp_image_add_hguide",
|
||||
"Add a horizontal Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the y-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_hguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_hguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_hguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_hguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_hguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_hguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_add_vguide procedure definition */
|
||||
ProcArg gimp_image_add_vguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"xposition",
|
||||
"The guide's x-offset from left of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_vguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_vguide_proc =
|
||||
{
|
||||
"gimp_image_add_vguide",
|
||||
"Add a vertical Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the x-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_vguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_vguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_vguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_vguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_vguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_vguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_delete_guide procedure definition */
|
||||
ProcArg gimp_image_delete_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of the Guide to be removed"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_delete_guide_proc =
|
||||
{
|
||||
"gimp_image_delete_guide",
|
||||
"Deletes a Guide from an image",
|
||||
"This procedure takes an image and a guide_id as input and removes the specified Guide from the specified image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_delete_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_delete_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_delete_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
success = FALSE;
|
||||
guides = gimage->guides;
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position >= 0) )
|
||||
{
|
||||
GList *tmp_next;
|
||||
|
||||
/* printf("Gotcha at %p\n", ((Guide*)guides->data)); */
|
||||
success = TRUE;
|
||||
|
||||
tmp_next = g_list_next(guides);
|
||||
|
||||
((Guide*)guides->data)->position = -1;
|
||||
undo_push_guide (gimage, ((Guide*)guides->data));
|
||||
/*gimp_image_remove_guide (gimage, ((Guide*)guides->data));*/
|
||||
|
||||
guides = tmp_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_delete_guide_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_findnext_guide procedure definition */
|
||||
ProcArg gimp_image_findnext_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of current Guide (0 if first invocation)"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_findnext_guide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The next guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_findnext_guide_proc =
|
||||
{
|
||||
"gimp_image_findnext_guide",
|
||||
"Find next Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and finds the guide_id of the successor of the given guide_id in the image's Guide list. If the supplied guide_id is 0, the procedure will return the first Guide. The procedure will return 0 if given the final guide_id as an argument or the image has no guides.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_findnext_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_findnext_guide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_findnext_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_findnext_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
rtn_guide_id = 0;
|
||||
|
||||
if (guides == NULL) /* No guides */
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (guide_id == 0) /* init - Return first guide_ID in list */
|
||||
{
|
||||
while (guides != NULL &&
|
||||
((Guide*)guides->data)->position < 0)
|
||||
guides = g_list_next(guides);
|
||||
|
||||
if (guides)
|
||||
rtn_guide_id = ((Guide*)guides->data)->guide_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
/*printf("Gotcha at %p: %d, %d, %d\n",
|
||||
((Guide*)guides->data),
|
||||
((Guide*)guides->data)->position,
|
||||
((Guide*)guides->data)->orientation,
|
||||
((Guide*)guides->data)->guide_ID
|
||||
);*/
|
||||
|
||||
success = TRUE;
|
||||
if (g_list_next(guides) == NULL)
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList* tmplist;
|
||||
tmplist = g_list_next(guides);
|
||||
|
||||
rtn_guide_id = ((Guide*)tmplist->data)->guide_ID;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args (&gimp_image_findnext_guide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_guide_id;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_orientation procedure definition */
|
||||
ProcArg gimp_image_get_guide_orientation_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_orientation_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"orientation",
|
||||
"The guide's orientation - vert=0, horiz=1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_orientation_proc =
|
||||
{
|
||||
"gimp_image_get_guide_orientation",
|
||||
"Get orientation of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the orientations of the guide, where 0=vertical and 1=horizontal.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_orientation_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_orientation_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_orientation_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_orientation_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_orientation;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
switch (((Guide*)guides->data)->orientation)
|
||||
{
|
||||
case VERTICAL_GUIDE: rtn_orientation = 0; break;
|
||||
case HORIZONTAL_GUIDE: rtn_orientation = 1; break;
|
||||
default:
|
||||
{
|
||||
rtn_orientation = 0;
|
||||
g_warning("Guide has bad orientation.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_orientation_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_orientation;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_position procedure definition */
|
||||
ProcArg gimp_image_get_guide_position_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_position_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"position",
|
||||
"The guide's position relative to top or left of image"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_position_proc =
|
||||
{
|
||||
"gimp_image_get_guide_position",
|
||||
"Get position of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the position of the guide relative to the top or left of the image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_position_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_position_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_position_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_position_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_position;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
rtn_position = ((Guide*)guides->data)->position;
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_position_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_position;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -199,13 +199,4 @@ void gimp_image_invalidate_preview (GimpImage *);
|
|||
|
||||
void gimp_image_invalidate_previews (void);
|
||||
|
||||
|
||||
/* Exported for PDB */
|
||||
extern ProcRecord gimp_image_add_hguide_proc;
|
||||
extern ProcRecord gimp_image_add_vguide_proc;
|
||||
extern ProcRecord gimp_image_delete_guide_proc;
|
||||
extern ProcRecord gimp_image_findnext_guide_proc;
|
||||
extern ProcRecord gimp_image_get_guide_orientation_proc;
|
||||
extern ProcRecord gimp_image_get_guide_position_proc;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,14 +33,6 @@
|
|||
#include "drawable_pvt.h" /* ick ick. */
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
static Argument* gimp_image_add_hguide_invoker (Argument*);
|
||||
static Argument* gimp_image_add_vguide_invoker (Argument*);
|
||||
static Argument* gimp_image_delete_guide_invoker (Argument*);/*fixme:refcount*/
|
||||
static Argument* gimp_image_findnext_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_position_invoker (Argument*);
|
||||
|
||||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_free_projection (GimpImage *);
|
||||
|
@ -789,623 +781,6 @@ gimp_image_transform_color (GimpImage *gimage, GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
|
||||
/* The gimp_image_add_hguide procedure definition */
|
||||
ProcArg gimp_image_add_hguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"yposition",
|
||||
"The guide's y-offset from top of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_hguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_hguide_proc =
|
||||
{
|
||||
"gimp_image_add_hguide",
|
||||
"Add a horizontal Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the y-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_hguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_hguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_hguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_hguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_hguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_hguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_add_vguide procedure definition */
|
||||
ProcArg gimp_image_add_vguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"xposition",
|
||||
"The guide's x-offset from left of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_vguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_vguide_proc =
|
||||
{
|
||||
"gimp_image_add_vguide",
|
||||
"Add a vertical Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the x-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_vguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_vguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_vguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_vguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_vguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_vguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_delete_guide procedure definition */
|
||||
ProcArg gimp_image_delete_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of the Guide to be removed"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_delete_guide_proc =
|
||||
{
|
||||
"gimp_image_delete_guide",
|
||||
"Deletes a Guide from an image",
|
||||
"This procedure takes an image and a guide_id as input and removes the specified Guide from the specified image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_delete_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_delete_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_delete_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
success = FALSE;
|
||||
guides = gimage->guides;
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position >= 0) )
|
||||
{
|
||||
GList *tmp_next;
|
||||
|
||||
/* printf("Gotcha at %p\n", ((Guide*)guides->data)); */
|
||||
success = TRUE;
|
||||
|
||||
tmp_next = g_list_next(guides);
|
||||
|
||||
((Guide*)guides->data)->position = -1;
|
||||
undo_push_guide (gimage, ((Guide*)guides->data));
|
||||
/*gimp_image_remove_guide (gimage, ((Guide*)guides->data));*/
|
||||
|
||||
guides = tmp_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_delete_guide_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_findnext_guide procedure definition */
|
||||
ProcArg gimp_image_findnext_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of current Guide (0 if first invocation)"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_findnext_guide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The next guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_findnext_guide_proc =
|
||||
{
|
||||
"gimp_image_findnext_guide",
|
||||
"Find next Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and finds the guide_id of the successor of the given guide_id in the image's Guide list. If the supplied guide_id is 0, the procedure will return the first Guide. The procedure will return 0 if given the final guide_id as an argument or the image has no guides.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_findnext_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_findnext_guide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_findnext_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_findnext_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
rtn_guide_id = 0;
|
||||
|
||||
if (guides == NULL) /* No guides */
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (guide_id == 0) /* init - Return first guide_ID in list */
|
||||
{
|
||||
while (guides != NULL &&
|
||||
((Guide*)guides->data)->position < 0)
|
||||
guides = g_list_next(guides);
|
||||
|
||||
if (guides)
|
||||
rtn_guide_id = ((Guide*)guides->data)->guide_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
/*printf("Gotcha at %p: %d, %d, %d\n",
|
||||
((Guide*)guides->data),
|
||||
((Guide*)guides->data)->position,
|
||||
((Guide*)guides->data)->orientation,
|
||||
((Guide*)guides->data)->guide_ID
|
||||
);*/
|
||||
|
||||
success = TRUE;
|
||||
if (g_list_next(guides) == NULL)
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList* tmplist;
|
||||
tmplist = g_list_next(guides);
|
||||
|
||||
rtn_guide_id = ((Guide*)tmplist->data)->guide_ID;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args (&gimp_image_findnext_guide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_guide_id;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_orientation procedure definition */
|
||||
ProcArg gimp_image_get_guide_orientation_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_orientation_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"orientation",
|
||||
"The guide's orientation - vert=0, horiz=1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_orientation_proc =
|
||||
{
|
||||
"gimp_image_get_guide_orientation",
|
||||
"Get orientation of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the orientations of the guide, where 0=vertical and 1=horizontal.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_orientation_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_orientation_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_orientation_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_orientation_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_orientation;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
switch (((Guide*)guides->data)->orientation)
|
||||
{
|
||||
case VERTICAL_GUIDE: rtn_orientation = 0; break;
|
||||
case HORIZONTAL_GUIDE: rtn_orientation = 1; break;
|
||||
default:
|
||||
{
|
||||
rtn_orientation = 0;
|
||||
g_warning("Guide has bad orientation.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_orientation_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_orientation;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_position procedure definition */
|
||||
ProcArg gimp_image_get_guide_position_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_position_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"position",
|
||||
"The guide's position relative to top or left of image"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_position_proc =
|
||||
{
|
||||
"gimp_image_get_guide_position",
|
||||
"Get position of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the position of the guide relative to the top or left of the image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_position_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_position_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_position_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_position_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_position;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
rtn_position = ((Guide*)guides->data)->position;
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_position_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_position;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -199,13 +199,4 @@ void gimp_image_invalidate_preview (GimpImage *);
|
|||
|
||||
void gimp_image_invalidate_previews (void);
|
||||
|
||||
|
||||
/* Exported for PDB */
|
||||
extern ProcRecord gimp_image_add_hguide_proc;
|
||||
extern ProcRecord gimp_image_add_vguide_proc;
|
||||
extern ProcRecord gimp_image_delete_guide_proc;
|
||||
extern ProcRecord gimp_image_findnext_guide_proc;
|
||||
extern ProcRecord gimp_image_get_guide_orientation_proc;
|
||||
extern ProcRecord gimp_image_get_guide_position_proc;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,14 +33,6 @@
|
|||
#include "drawable_pvt.h" /* ick ick. */
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
static Argument* gimp_image_add_hguide_invoker (Argument*);
|
||||
static Argument* gimp_image_add_vguide_invoker (Argument*);
|
||||
static Argument* gimp_image_delete_guide_invoker (Argument*);/*fixme:refcount*/
|
||||
static Argument* gimp_image_findnext_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_position_invoker (Argument*);
|
||||
|
||||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_free_projection (GimpImage *);
|
||||
|
@ -789,623 +781,6 @@ gimp_image_transform_color (GimpImage *gimage, GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
|
||||
/* The gimp_image_add_hguide procedure definition */
|
||||
ProcArg gimp_image_add_hguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"yposition",
|
||||
"The guide's y-offset from top of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_hguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_hguide_proc =
|
||||
{
|
||||
"gimp_image_add_hguide",
|
||||
"Add a horizontal Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the y-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_hguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_hguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_hguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_hguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_hguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_hguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_add_vguide procedure definition */
|
||||
ProcArg gimp_image_add_vguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"xposition",
|
||||
"The guide's x-offset from left of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_vguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_vguide_proc =
|
||||
{
|
||||
"gimp_image_add_vguide",
|
||||
"Add a vertical Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the x-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_vguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_vguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_vguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_vguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_vguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_vguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_delete_guide procedure definition */
|
||||
ProcArg gimp_image_delete_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of the Guide to be removed"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_delete_guide_proc =
|
||||
{
|
||||
"gimp_image_delete_guide",
|
||||
"Deletes a Guide from an image",
|
||||
"This procedure takes an image and a guide_id as input and removes the specified Guide from the specified image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_delete_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_delete_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_delete_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
success = FALSE;
|
||||
guides = gimage->guides;
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position >= 0) )
|
||||
{
|
||||
GList *tmp_next;
|
||||
|
||||
/* printf("Gotcha at %p\n", ((Guide*)guides->data)); */
|
||||
success = TRUE;
|
||||
|
||||
tmp_next = g_list_next(guides);
|
||||
|
||||
((Guide*)guides->data)->position = -1;
|
||||
undo_push_guide (gimage, ((Guide*)guides->data));
|
||||
/*gimp_image_remove_guide (gimage, ((Guide*)guides->data));*/
|
||||
|
||||
guides = tmp_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_delete_guide_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_findnext_guide procedure definition */
|
||||
ProcArg gimp_image_findnext_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of current Guide (0 if first invocation)"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_findnext_guide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The next guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_findnext_guide_proc =
|
||||
{
|
||||
"gimp_image_findnext_guide",
|
||||
"Find next Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and finds the guide_id of the successor of the given guide_id in the image's Guide list. If the supplied guide_id is 0, the procedure will return the first Guide. The procedure will return 0 if given the final guide_id as an argument or the image has no guides.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_findnext_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_findnext_guide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_findnext_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_findnext_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
rtn_guide_id = 0;
|
||||
|
||||
if (guides == NULL) /* No guides */
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (guide_id == 0) /* init - Return first guide_ID in list */
|
||||
{
|
||||
while (guides != NULL &&
|
||||
((Guide*)guides->data)->position < 0)
|
||||
guides = g_list_next(guides);
|
||||
|
||||
if (guides)
|
||||
rtn_guide_id = ((Guide*)guides->data)->guide_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
/*printf("Gotcha at %p: %d, %d, %d\n",
|
||||
((Guide*)guides->data),
|
||||
((Guide*)guides->data)->position,
|
||||
((Guide*)guides->data)->orientation,
|
||||
((Guide*)guides->data)->guide_ID
|
||||
);*/
|
||||
|
||||
success = TRUE;
|
||||
if (g_list_next(guides) == NULL)
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList* tmplist;
|
||||
tmplist = g_list_next(guides);
|
||||
|
||||
rtn_guide_id = ((Guide*)tmplist->data)->guide_ID;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args (&gimp_image_findnext_guide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_guide_id;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_orientation procedure definition */
|
||||
ProcArg gimp_image_get_guide_orientation_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_orientation_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"orientation",
|
||||
"The guide's orientation - vert=0, horiz=1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_orientation_proc =
|
||||
{
|
||||
"gimp_image_get_guide_orientation",
|
||||
"Get orientation of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the orientations of the guide, where 0=vertical and 1=horizontal.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_orientation_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_orientation_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_orientation_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_orientation_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_orientation;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
switch (((Guide*)guides->data)->orientation)
|
||||
{
|
||||
case VERTICAL_GUIDE: rtn_orientation = 0; break;
|
||||
case HORIZONTAL_GUIDE: rtn_orientation = 1; break;
|
||||
default:
|
||||
{
|
||||
rtn_orientation = 0;
|
||||
g_warning("Guide has bad orientation.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_orientation_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_orientation;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_position procedure definition */
|
||||
ProcArg gimp_image_get_guide_position_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_position_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"position",
|
||||
"The guide's position relative to top or left of image"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_position_proc =
|
||||
{
|
||||
"gimp_image_get_guide_position",
|
||||
"Get position of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the position of the guide relative to the top or left of the image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_position_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_position_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_position_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_position_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_position;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
rtn_position = ((Guide*)guides->data)->position;
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_position_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_position;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -199,13 +199,4 @@ void gimp_image_invalidate_preview (GimpImage *);
|
|||
|
||||
void gimp_image_invalidate_previews (void);
|
||||
|
||||
|
||||
/* Exported for PDB */
|
||||
extern ProcRecord gimp_image_add_hguide_proc;
|
||||
extern ProcRecord gimp_image_add_vguide_proc;
|
||||
extern ProcRecord gimp_image_delete_guide_proc;
|
||||
extern ProcRecord gimp_image_findnext_guide_proc;
|
||||
extern ProcRecord gimp_image_get_guide_orientation_proc;
|
||||
extern ProcRecord gimp_image_get_guide_position_proc;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,14 +33,6 @@
|
|||
#include "drawable_pvt.h" /* ick ick. */
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
static Argument* gimp_image_add_hguide_invoker (Argument*);
|
||||
static Argument* gimp_image_add_vguide_invoker (Argument*);
|
||||
static Argument* gimp_image_delete_guide_invoker (Argument*);/*fixme:refcount*/
|
||||
static Argument* gimp_image_findnext_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_position_invoker (Argument*);
|
||||
|
||||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_free_projection (GimpImage *);
|
||||
|
@ -789,623 +781,6 @@ gimp_image_transform_color (GimpImage *gimage, GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
|
||||
/* The gimp_image_add_hguide procedure definition */
|
||||
ProcArg gimp_image_add_hguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"yposition",
|
||||
"The guide's y-offset from top of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_hguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_hguide_proc =
|
||||
{
|
||||
"gimp_image_add_hguide",
|
||||
"Add a horizontal Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the y-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_hguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_hguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_hguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_hguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_hguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_hguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_add_vguide procedure definition */
|
||||
ProcArg gimp_image_add_vguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"xposition",
|
||||
"The guide's x-offset from left of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_vguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_vguide_proc =
|
||||
{
|
||||
"gimp_image_add_vguide",
|
||||
"Add a vertical Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the x-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_vguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_vguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_vguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_vguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_vguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_vguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_delete_guide procedure definition */
|
||||
ProcArg gimp_image_delete_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of the Guide to be removed"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_delete_guide_proc =
|
||||
{
|
||||
"gimp_image_delete_guide",
|
||||
"Deletes a Guide from an image",
|
||||
"This procedure takes an image and a guide_id as input and removes the specified Guide from the specified image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_delete_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_delete_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_delete_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
success = FALSE;
|
||||
guides = gimage->guides;
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position >= 0) )
|
||||
{
|
||||
GList *tmp_next;
|
||||
|
||||
/* printf("Gotcha at %p\n", ((Guide*)guides->data)); */
|
||||
success = TRUE;
|
||||
|
||||
tmp_next = g_list_next(guides);
|
||||
|
||||
((Guide*)guides->data)->position = -1;
|
||||
undo_push_guide (gimage, ((Guide*)guides->data));
|
||||
/*gimp_image_remove_guide (gimage, ((Guide*)guides->data));*/
|
||||
|
||||
guides = tmp_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_delete_guide_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_findnext_guide procedure definition */
|
||||
ProcArg gimp_image_findnext_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of current Guide (0 if first invocation)"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_findnext_guide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The next guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_findnext_guide_proc =
|
||||
{
|
||||
"gimp_image_findnext_guide",
|
||||
"Find next Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and finds the guide_id of the successor of the given guide_id in the image's Guide list. If the supplied guide_id is 0, the procedure will return the first Guide. The procedure will return 0 if given the final guide_id as an argument or the image has no guides.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_findnext_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_findnext_guide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_findnext_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_findnext_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
rtn_guide_id = 0;
|
||||
|
||||
if (guides == NULL) /* No guides */
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (guide_id == 0) /* init - Return first guide_ID in list */
|
||||
{
|
||||
while (guides != NULL &&
|
||||
((Guide*)guides->data)->position < 0)
|
||||
guides = g_list_next(guides);
|
||||
|
||||
if (guides)
|
||||
rtn_guide_id = ((Guide*)guides->data)->guide_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
/*printf("Gotcha at %p: %d, %d, %d\n",
|
||||
((Guide*)guides->data),
|
||||
((Guide*)guides->data)->position,
|
||||
((Guide*)guides->data)->orientation,
|
||||
((Guide*)guides->data)->guide_ID
|
||||
);*/
|
||||
|
||||
success = TRUE;
|
||||
if (g_list_next(guides) == NULL)
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList* tmplist;
|
||||
tmplist = g_list_next(guides);
|
||||
|
||||
rtn_guide_id = ((Guide*)tmplist->data)->guide_ID;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args (&gimp_image_findnext_guide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_guide_id;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_orientation procedure definition */
|
||||
ProcArg gimp_image_get_guide_orientation_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_orientation_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"orientation",
|
||||
"The guide's orientation - vert=0, horiz=1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_orientation_proc =
|
||||
{
|
||||
"gimp_image_get_guide_orientation",
|
||||
"Get orientation of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the orientations of the guide, where 0=vertical and 1=horizontal.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_orientation_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_orientation_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_orientation_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_orientation_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_orientation;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
switch (((Guide*)guides->data)->orientation)
|
||||
{
|
||||
case VERTICAL_GUIDE: rtn_orientation = 0; break;
|
||||
case HORIZONTAL_GUIDE: rtn_orientation = 1; break;
|
||||
default:
|
||||
{
|
||||
rtn_orientation = 0;
|
||||
g_warning("Guide has bad orientation.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_orientation_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_orientation;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_position procedure definition */
|
||||
ProcArg gimp_image_get_guide_position_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_position_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"position",
|
||||
"The guide's position relative to top or left of image"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_position_proc =
|
||||
{
|
||||
"gimp_image_get_guide_position",
|
||||
"Get position of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the position of the guide relative to the top or left of the image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_position_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_position_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_position_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_position_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_position;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
rtn_position = ((Guide*)guides->data)->position;
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_position_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_position;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -199,13 +199,4 @@ void gimp_image_invalidate_preview (GimpImage *);
|
|||
|
||||
void gimp_image_invalidate_previews (void);
|
||||
|
||||
|
||||
/* Exported for PDB */
|
||||
extern ProcRecord gimp_image_add_hguide_proc;
|
||||
extern ProcRecord gimp_image_add_vguide_proc;
|
||||
extern ProcRecord gimp_image_delete_guide_proc;
|
||||
extern ProcRecord gimp_image_findnext_guide_proc;
|
||||
extern ProcRecord gimp_image_get_guide_orientation_proc;
|
||||
extern ProcRecord gimp_image_get_guide_position_proc;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,14 +33,6 @@
|
|||
#include "drawable_pvt.h" /* ick ick. */
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
static Argument* gimp_image_add_hguide_invoker (Argument*);
|
||||
static Argument* gimp_image_add_vguide_invoker (Argument*);
|
||||
static Argument* gimp_image_delete_guide_invoker (Argument*);/*fixme:refcount*/
|
||||
static Argument* gimp_image_findnext_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_position_invoker (Argument*);
|
||||
|
||||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_free_projection (GimpImage *);
|
||||
|
@ -789,623 +781,6 @@ gimp_image_transform_color (GimpImage *gimage, GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
|
||||
/* The gimp_image_add_hguide procedure definition */
|
||||
ProcArg gimp_image_add_hguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"yposition",
|
||||
"The guide's y-offset from top of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_hguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_hguide_proc =
|
||||
{
|
||||
"gimp_image_add_hguide",
|
||||
"Add a horizontal Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the y-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_hguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_hguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_hguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_hguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_hguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_hguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_add_vguide procedure definition */
|
||||
ProcArg gimp_image_add_vguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"xposition",
|
||||
"The guide's x-offset from left of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_vguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_vguide_proc =
|
||||
{
|
||||
"gimp_image_add_vguide",
|
||||
"Add a vertical Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the x-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_vguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_vguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_vguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_vguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_vguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_vguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_delete_guide procedure definition */
|
||||
ProcArg gimp_image_delete_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of the Guide to be removed"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_delete_guide_proc =
|
||||
{
|
||||
"gimp_image_delete_guide",
|
||||
"Deletes a Guide from an image",
|
||||
"This procedure takes an image and a guide_id as input and removes the specified Guide from the specified image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_delete_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_delete_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_delete_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
success = FALSE;
|
||||
guides = gimage->guides;
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position >= 0) )
|
||||
{
|
||||
GList *tmp_next;
|
||||
|
||||
/* printf("Gotcha at %p\n", ((Guide*)guides->data)); */
|
||||
success = TRUE;
|
||||
|
||||
tmp_next = g_list_next(guides);
|
||||
|
||||
((Guide*)guides->data)->position = -1;
|
||||
undo_push_guide (gimage, ((Guide*)guides->data));
|
||||
/*gimp_image_remove_guide (gimage, ((Guide*)guides->data));*/
|
||||
|
||||
guides = tmp_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_delete_guide_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_findnext_guide procedure definition */
|
||||
ProcArg gimp_image_findnext_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of current Guide (0 if first invocation)"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_findnext_guide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The next guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_findnext_guide_proc =
|
||||
{
|
||||
"gimp_image_findnext_guide",
|
||||
"Find next Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and finds the guide_id of the successor of the given guide_id in the image's Guide list. If the supplied guide_id is 0, the procedure will return the first Guide. The procedure will return 0 if given the final guide_id as an argument or the image has no guides.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_findnext_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_findnext_guide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_findnext_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_findnext_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
rtn_guide_id = 0;
|
||||
|
||||
if (guides == NULL) /* No guides */
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (guide_id == 0) /* init - Return first guide_ID in list */
|
||||
{
|
||||
while (guides != NULL &&
|
||||
((Guide*)guides->data)->position < 0)
|
||||
guides = g_list_next(guides);
|
||||
|
||||
if (guides)
|
||||
rtn_guide_id = ((Guide*)guides->data)->guide_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
/*printf("Gotcha at %p: %d, %d, %d\n",
|
||||
((Guide*)guides->data),
|
||||
((Guide*)guides->data)->position,
|
||||
((Guide*)guides->data)->orientation,
|
||||
((Guide*)guides->data)->guide_ID
|
||||
);*/
|
||||
|
||||
success = TRUE;
|
||||
if (g_list_next(guides) == NULL)
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList* tmplist;
|
||||
tmplist = g_list_next(guides);
|
||||
|
||||
rtn_guide_id = ((Guide*)tmplist->data)->guide_ID;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args (&gimp_image_findnext_guide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_guide_id;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_orientation procedure definition */
|
||||
ProcArg gimp_image_get_guide_orientation_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_orientation_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"orientation",
|
||||
"The guide's orientation - vert=0, horiz=1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_orientation_proc =
|
||||
{
|
||||
"gimp_image_get_guide_orientation",
|
||||
"Get orientation of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the orientations of the guide, where 0=vertical and 1=horizontal.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_orientation_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_orientation_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_orientation_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_orientation_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_orientation;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
switch (((Guide*)guides->data)->orientation)
|
||||
{
|
||||
case VERTICAL_GUIDE: rtn_orientation = 0; break;
|
||||
case HORIZONTAL_GUIDE: rtn_orientation = 1; break;
|
||||
default:
|
||||
{
|
||||
rtn_orientation = 0;
|
||||
g_warning("Guide has bad orientation.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_orientation_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_orientation;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_position procedure definition */
|
||||
ProcArg gimp_image_get_guide_position_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_position_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"position",
|
||||
"The guide's position relative to top or left of image"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_position_proc =
|
||||
{
|
||||
"gimp_image_get_guide_position",
|
||||
"Get position of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the position of the guide relative to the top or left of the image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_position_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_position_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_position_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_position_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_position;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
rtn_position = ((Guide*)guides->data)->position;
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_position_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_position;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -199,13 +199,4 @@ void gimp_image_invalidate_preview (GimpImage *);
|
|||
|
||||
void gimp_image_invalidate_previews (void);
|
||||
|
||||
|
||||
/* Exported for PDB */
|
||||
extern ProcRecord gimp_image_add_hguide_proc;
|
||||
extern ProcRecord gimp_image_add_vguide_proc;
|
||||
extern ProcRecord gimp_image_delete_guide_proc;
|
||||
extern ProcRecord gimp_image_findnext_guide_proc;
|
||||
extern ProcRecord gimp_image_get_guide_orientation_proc;
|
||||
extern ProcRecord gimp_image_get_guide_position_proc;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,14 +33,6 @@
|
|||
#include "drawable_pvt.h" /* ick ick. */
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
static Argument* gimp_image_add_hguide_invoker (Argument*);
|
||||
static Argument* gimp_image_add_vguide_invoker (Argument*);
|
||||
static Argument* gimp_image_delete_guide_invoker (Argument*);/*fixme:refcount*/
|
||||
static Argument* gimp_image_findnext_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_position_invoker (Argument*);
|
||||
|
||||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_free_projection (GimpImage *);
|
||||
|
@ -789,623 +781,6 @@ gimp_image_transform_color (GimpImage *gimage, GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
|
||||
/* The gimp_image_add_hguide procedure definition */
|
||||
ProcArg gimp_image_add_hguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"yposition",
|
||||
"The guide's y-offset from top of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_hguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_hguide_proc =
|
||||
{
|
||||
"gimp_image_add_hguide",
|
||||
"Add a horizontal Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the y-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_hguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_hguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_hguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_hguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_hguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_hguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_add_vguide procedure definition */
|
||||
ProcArg gimp_image_add_vguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"xposition",
|
||||
"The guide's x-offset from left of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_vguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_vguide_proc =
|
||||
{
|
||||
"gimp_image_add_vguide",
|
||||
"Add a vertical Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the x-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_vguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_vguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_vguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_vguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_vguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_vguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_delete_guide procedure definition */
|
||||
ProcArg gimp_image_delete_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of the Guide to be removed"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_delete_guide_proc =
|
||||
{
|
||||
"gimp_image_delete_guide",
|
||||
"Deletes a Guide from an image",
|
||||
"This procedure takes an image and a guide_id as input and removes the specified Guide from the specified image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_delete_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_delete_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_delete_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
success = FALSE;
|
||||
guides = gimage->guides;
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position >= 0) )
|
||||
{
|
||||
GList *tmp_next;
|
||||
|
||||
/* printf("Gotcha at %p\n", ((Guide*)guides->data)); */
|
||||
success = TRUE;
|
||||
|
||||
tmp_next = g_list_next(guides);
|
||||
|
||||
((Guide*)guides->data)->position = -1;
|
||||
undo_push_guide (gimage, ((Guide*)guides->data));
|
||||
/*gimp_image_remove_guide (gimage, ((Guide*)guides->data));*/
|
||||
|
||||
guides = tmp_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_delete_guide_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_findnext_guide procedure definition */
|
||||
ProcArg gimp_image_findnext_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of current Guide (0 if first invocation)"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_findnext_guide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The next guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_findnext_guide_proc =
|
||||
{
|
||||
"gimp_image_findnext_guide",
|
||||
"Find next Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and finds the guide_id of the successor of the given guide_id in the image's Guide list. If the supplied guide_id is 0, the procedure will return the first Guide. The procedure will return 0 if given the final guide_id as an argument or the image has no guides.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_findnext_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_findnext_guide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_findnext_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_findnext_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
rtn_guide_id = 0;
|
||||
|
||||
if (guides == NULL) /* No guides */
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (guide_id == 0) /* init - Return first guide_ID in list */
|
||||
{
|
||||
while (guides != NULL &&
|
||||
((Guide*)guides->data)->position < 0)
|
||||
guides = g_list_next(guides);
|
||||
|
||||
if (guides)
|
||||
rtn_guide_id = ((Guide*)guides->data)->guide_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
/*printf("Gotcha at %p: %d, %d, %d\n",
|
||||
((Guide*)guides->data),
|
||||
((Guide*)guides->data)->position,
|
||||
((Guide*)guides->data)->orientation,
|
||||
((Guide*)guides->data)->guide_ID
|
||||
);*/
|
||||
|
||||
success = TRUE;
|
||||
if (g_list_next(guides) == NULL)
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList* tmplist;
|
||||
tmplist = g_list_next(guides);
|
||||
|
||||
rtn_guide_id = ((Guide*)tmplist->data)->guide_ID;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args (&gimp_image_findnext_guide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_guide_id;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_orientation procedure definition */
|
||||
ProcArg gimp_image_get_guide_orientation_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_orientation_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"orientation",
|
||||
"The guide's orientation - vert=0, horiz=1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_orientation_proc =
|
||||
{
|
||||
"gimp_image_get_guide_orientation",
|
||||
"Get orientation of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the orientations of the guide, where 0=vertical and 1=horizontal.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_orientation_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_orientation_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_orientation_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_orientation_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_orientation;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
switch (((Guide*)guides->data)->orientation)
|
||||
{
|
||||
case VERTICAL_GUIDE: rtn_orientation = 0; break;
|
||||
case HORIZONTAL_GUIDE: rtn_orientation = 1; break;
|
||||
default:
|
||||
{
|
||||
rtn_orientation = 0;
|
||||
g_warning("Guide has bad orientation.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_orientation_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_orientation;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_position procedure definition */
|
||||
ProcArg gimp_image_get_guide_position_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_position_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"position",
|
||||
"The guide's position relative to top or left of image"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_position_proc =
|
||||
{
|
||||
"gimp_image_get_guide_position",
|
||||
"Get position of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the position of the guide relative to the top or left of the image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_position_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_position_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_position_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_position_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_position;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
rtn_position = ((Guide*)guides->data)->position;
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_position_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_position;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -199,13 +199,4 @@ void gimp_image_invalidate_preview (GimpImage *);
|
|||
|
||||
void gimp_image_invalidate_previews (void);
|
||||
|
||||
|
||||
/* Exported for PDB */
|
||||
extern ProcRecord gimp_image_add_hguide_proc;
|
||||
extern ProcRecord gimp_image_add_vguide_proc;
|
||||
extern ProcRecord gimp_image_delete_guide_proc;
|
||||
extern ProcRecord gimp_image_findnext_guide_proc;
|
||||
extern ProcRecord gimp_image_get_guide_orientation_proc;
|
||||
extern ProcRecord gimp_image_get_guide_position_proc;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "gimage.h"
|
||||
#include "gimage_cmds.h"
|
||||
#include "floating_sel.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "layer_pvt.h" /* ick. */
|
||||
#include "drawable_pvt.h" /* ick ick. */
|
||||
|
@ -34,6 +35,16 @@ static int success;
|
|||
static Argument *return_args;
|
||||
|
||||
|
||||
/* The Guides procs prototypes */
|
||||
static Argument* gimp_image_add_hguide_invoker (Argument*);
|
||||
static Argument* gimp_image_add_vguide_invoker (Argument*);
|
||||
static Argument* gimp_image_delete_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_findnext_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_position_invoker (Argument*);
|
||||
|
||||
|
||||
|
||||
static GImage * duplicate (GImage *gimage);
|
||||
|
||||
static Argument * channel_ops_duplicate_invoker (Argument *args);
|
||||
|
@ -3522,3 +3533,624 @@ channel_ops_duplicate (void *gimage_ptr)
|
|||
gdisplay_new (new_gimage, 0x0101);
|
||||
}
|
||||
|
||||
|
||||
/* GUIDES STUFF */
|
||||
|
||||
|
||||
/* The gimp_image_add_hguide procedure definition */
|
||||
ProcArg gimp_image_add_hguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"yposition",
|
||||
"The guide's y-offset from top of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_hguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_hguide_proc =
|
||||
{
|
||||
"gimp_image_add_hguide",
|
||||
"Add a horizontal Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the y-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_hguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_hguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_hguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_hguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide = NULL;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_hguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_hguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_add_vguide procedure definition */
|
||||
ProcArg gimp_image_add_vguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"xposition",
|
||||
"The guide's x-offset from left of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_vguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_vguide_proc =
|
||||
{
|
||||
"gimp_image_add_vguide",
|
||||
"Add a vertical Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the x-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_vguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_vguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_vguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_vguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide = NULL;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_vguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_vguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_delete_guide procedure definition */
|
||||
ProcArg gimp_image_delete_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of the Guide to be removed"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_delete_guide_proc =
|
||||
{
|
||||
"gimp_image_delete_guide",
|
||||
"Deletes a Guide from an image",
|
||||
"This procedure takes an image and a guide_id as input and removes the specified Guide from the specified image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_delete_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_delete_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_delete_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
success = FALSE;
|
||||
guides = gimage->guides;
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position >= 0) )
|
||||
{
|
||||
GList *tmp_next;
|
||||
|
||||
/* printf("Gotcha at %p\n", ((Guide*)guides->data)); */
|
||||
success = TRUE;
|
||||
|
||||
tmp_next = g_list_next(guides);
|
||||
|
||||
((Guide*)guides->data)->position = -1;
|
||||
undo_push_guide (gimage, ((Guide*)guides->data));
|
||||
/*gimp_image_remove_guide (gimage, ((Guide*)guides->data));*/
|
||||
|
||||
guides = tmp_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_delete_guide_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_findnext_guide procedure definition */
|
||||
ProcArg gimp_image_findnext_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of current Guide (0 if first invocation)"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_findnext_guide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The next guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_findnext_guide_proc =
|
||||
{
|
||||
"gimp_image_findnext_guide",
|
||||
"Find next Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and finds the guide_id of the successor of the given guide_id in the image's Guide list. If the supplied guide_id is 0, the procedure will return the first Guide. The procedure will return 0 if given the final guide_id as an argument or the image has no guides.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_findnext_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_findnext_guide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_findnext_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_findnext_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
rtn_guide_id = 0;
|
||||
|
||||
if (guides == NULL) /* No guides */
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (guide_id == 0) /* init - Return first guide_ID in list */
|
||||
{
|
||||
while (guides != NULL &&
|
||||
((Guide*)guides->data)->position < 0)
|
||||
guides = g_list_next(guides);
|
||||
|
||||
if (guides)
|
||||
rtn_guide_id = ((Guide*)guides->data)->guide_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
/*printf("Gotcha at %p: %d, %d, %d\n",
|
||||
((Guide*)guides->data),
|
||||
((Guide*)guides->data)->position,
|
||||
((Guide*)guides->data)->orientation,
|
||||
((Guide*)guides->data)->guide_ID
|
||||
);*/
|
||||
|
||||
success = TRUE;
|
||||
if (g_list_next(guides) == NULL)
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList* tmplist;
|
||||
tmplist = g_list_next(guides);
|
||||
|
||||
rtn_guide_id = ((Guide*)tmplist->data)->guide_ID;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args (&gimp_image_findnext_guide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_guide_id;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_orientation procedure definition */
|
||||
ProcArg gimp_image_get_guide_orientation_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_orientation_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"orientation",
|
||||
"The guide's orientation - vert=0, horiz=1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_orientation_proc =
|
||||
{
|
||||
"gimp_image_get_guide_orientation",
|
||||
"Get orientation of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the orientations of the guide, where 0=vertical and 1=horizontal.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_orientation_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_orientation_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_orientation_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_orientation_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_orientation;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
switch (((Guide*)guides->data)->orientation)
|
||||
{
|
||||
case VERTICAL_GUIDE: rtn_orientation = 0; break;
|
||||
case HORIZONTAL_GUIDE: rtn_orientation = 1; break;
|
||||
default:
|
||||
{
|
||||
rtn_orientation = 0;
|
||||
g_warning("Guide has bad orientation.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_orientation_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_orientation;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_position procedure definition */
|
||||
ProcArg gimp_image_get_guide_position_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_position_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"position",
|
||||
"The guide's position relative to top or left of image"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_position_proc =
|
||||
{
|
||||
"gimp_image_get_guide_position",
|
||||
"Get position of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the position of the guide relative to the top or left of the image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_position_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_position_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_position_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_position_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_position;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
rtn_position = ((Guide*)guides->data)->position;
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_position_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_position;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
|
|
@ -68,4 +68,11 @@ extern ProcRecord gimage_clean_all_proc;
|
|||
extern ProcRecord gimage_floating_sel_proc;
|
||||
extern ProcRecord channel_ops_duplicate_proc;
|
||||
|
||||
extern ProcRecord gimp_image_add_hguide_proc;
|
||||
extern ProcRecord gimp_image_add_vguide_proc;
|
||||
extern ProcRecord gimp_image_delete_guide_proc;
|
||||
extern ProcRecord gimp_image_findnext_guide_proc;
|
||||
extern ProcRecord gimp_image_get_guide_orientation_proc;
|
||||
extern ProcRecord gimp_image_get_guide_position_proc;
|
||||
|
||||
#endif /* __GIMAGE_CMDS_H__ */
|
||||
|
|
625
app/gimpimage.c
625
app/gimpimage.c
|
@ -33,14 +33,6 @@
|
|||
#include "drawable_pvt.h" /* ick ick. */
|
||||
|
||||
|
||||
/* Exported functions */
|
||||
static Argument* gimp_image_add_hguide_invoker (Argument*);
|
||||
static Argument* gimp_image_add_vguide_invoker (Argument*);
|
||||
static Argument* gimp_image_delete_guide_invoker (Argument*);/*fixme:refcount*/
|
||||
static Argument* gimp_image_findnext_guide_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_orientation_invoker (Argument*);
|
||||
static Argument* gimp_image_get_guide_position_invoker (Argument*);
|
||||
|
||||
|
||||
/* Local function declarations */
|
||||
static void gimp_image_free_projection (GimpImage *);
|
||||
|
@ -789,623 +781,6 @@ gimp_image_transform_color (GimpImage *gimage, GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
|
||||
/* The gimp_image_add_hguide procedure definition */
|
||||
ProcArg gimp_image_add_hguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"yposition",
|
||||
"The guide's y-offset from top of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_hguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_hguide_proc =
|
||||
{
|
||||
"gimp_image_add_hguide",
|
||||
"Add a horizontal Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the y-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_hguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_hguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_hguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_hguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_hguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_hguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_add_vguide procedure definition */
|
||||
ProcArg gimp_image_add_vguide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"the input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"xposition",
|
||||
"The guide's x-offset from left of image"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_add_vguide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The new guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_add_vguide_proc =
|
||||
{
|
||||
"gimp_image_add_vguide",
|
||||
"Add a vertical Guide to an image",
|
||||
"This procedure adds a horizontal Guide to an image. It takes the input image and the x-position of the new Guide as parameters. It returns the guide_id of the new Guide.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_add_vguide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_add_vguide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_add_vguide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_add_vguide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int offset;
|
||||
GImage *gimage;
|
||||
Guide *guide;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
offset = args[1].value.pdb_int;
|
||||
guide = gimp_image_add_vguide ((void *) gimage);
|
||||
guide->position = offset;
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_add_vguide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = guide->guide_ID;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_delete_guide procedure definition */
|
||||
ProcArg gimp_image_delete_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of the Guide to be removed"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_delete_guide_proc =
|
||||
{
|
||||
"gimp_image_delete_guide",
|
||||
"Deletes a Guide from an image",
|
||||
"This procedure takes an image and a guide_id as input and removes the specified Guide from the specified image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_delete_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_delete_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_delete_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
success = FALSE;
|
||||
guides = gimage->guides;
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position >= 0) )
|
||||
{
|
||||
GList *tmp_next;
|
||||
|
||||
/* printf("Gotcha at %p\n", ((Guide*)guides->data)); */
|
||||
success = TRUE;
|
||||
|
||||
tmp_next = g_list_next(guides);
|
||||
|
||||
((Guide*)guides->data)->position = -1;
|
||||
undo_push_guide (gimage, ((Guide*)guides->data));
|
||||
/*gimp_image_remove_guide (gimage, ((Guide*)guides->data));*/
|
||||
|
||||
guides = tmp_next;
|
||||
}
|
||||
else
|
||||
{
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return_args = procedural_db_return_args (&gimp_image_delete_guide_proc,
|
||||
success);
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_findnext_guide procedure definition */
|
||||
ProcArg gimp_image_findnext_guide_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID of current Guide (0 if first invocation)"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_findnext_guide_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"guide_id",
|
||||
"The next guide's guide_id"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_findnext_guide_proc =
|
||||
{
|
||||
"gimp_image_findnext_guide",
|
||||
"Find next Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and finds the guide_id of the successor of the given guide_id in the image's Guide list. If the supplied guide_id is 0, the procedure will return the first Guide. The procedure will return 0 if given the final guide_id as an argument or the image has no guides.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_findnext_guide_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_findnext_guide_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_findnext_guide_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_findnext_guide_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_guide_id;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
rtn_guide_id = 0;
|
||||
|
||||
if (guides == NULL) /* No guides */
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (guide_id == 0) /* init - Return first guide_ID in list */
|
||||
{
|
||||
while (guides != NULL &&
|
||||
((Guide*)guides->data)->position < 0)
|
||||
guides = g_list_next(guides);
|
||||
|
||||
if (guides)
|
||||
rtn_guide_id = ((Guide*)guides->data)->guide_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
/*printf("Gotcha at %p: %d, %d, %d\n",
|
||||
((Guide*)guides->data),
|
||||
((Guide*)guides->data)->position,
|
||||
((Guide*)guides->data)->orientation,
|
||||
((Guide*)guides->data)->guide_ID
|
||||
);*/
|
||||
|
||||
success = TRUE;
|
||||
if (g_list_next(guides) == NULL)
|
||||
{
|
||||
rtn_guide_id = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GList* tmplist;
|
||||
tmplist = g_list_next(guides);
|
||||
|
||||
rtn_guide_id = ((Guide*)tmplist->data)->guide_ID;
|
||||
goto got_it;
|
||||
}
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args (&gimp_image_findnext_guide_proc,
|
||||
success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_guide_id;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_orientation procedure definition */
|
||||
ProcArg gimp_image_get_guide_orientation_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_orientation_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"orientation",
|
||||
"The guide's orientation - vert=0, horiz=1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_orientation_proc =
|
||||
{
|
||||
"gimp_image_get_guide_orientation",
|
||||
"Get orientation of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the orientations of the guide, where 0=vertical and 1=horizontal.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_orientation_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_orientation_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_orientation_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_orientation_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_orientation;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
switch (((Guide*)guides->data)->orientation)
|
||||
{
|
||||
case VERTICAL_GUIDE: rtn_orientation = 0; break;
|
||||
case HORIZONTAL_GUIDE: rtn_orientation = 1; break;
|
||||
default:
|
||||
{
|
||||
rtn_orientation = 0;
|
||||
g_warning("Guide has bad orientation.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_orientation_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_orientation;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The gimp_image_get_guide_position procedure definition */
|
||||
ProcArg gimp_image_get_guide_position_args[] =
|
||||
{
|
||||
{ PDB_IMAGE,
|
||||
"image",
|
||||
"The input image"
|
||||
},
|
||||
{ PDB_INT32,
|
||||
"guide_ID",
|
||||
"The guide_ID"
|
||||
}
|
||||
};
|
||||
|
||||
ProcArg gimp_image_get_guide_position_out_args[] =
|
||||
{
|
||||
{ PDB_INT32,
|
||||
"position",
|
||||
"The guide's position relative to top or left of image"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProcRecord gimp_image_get_guide_position_proc =
|
||||
{
|
||||
"gimp_image_get_guide_position",
|
||||
"Get position of a Guide on an image",
|
||||
"This procedure takes an image and a guide_id as input and returns the position of the guide relative to the top or left of the image.",
|
||||
"Adam D. Moss",
|
||||
"Adam D. Moss",
|
||||
"1998",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
2,
|
||||
gimp_image_get_guide_position_args,
|
||||
|
||||
/* Output arguments */
|
||||
1,
|
||||
gimp_image_get_guide_position_out_args,
|
||||
|
||||
/* Exec method */
|
||||
{ { gimp_image_get_guide_position_invoker } },
|
||||
};
|
||||
|
||||
|
||||
static Argument *
|
||||
gimp_image_get_guide_position_invoker (Argument *args)
|
||||
{
|
||||
int success = TRUE;
|
||||
int int_value;
|
||||
int guide_id;
|
||||
int rtn_position;
|
||||
GImage *gimage;
|
||||
GList *guides;
|
||||
Argument *return_args;
|
||||
|
||||
|
||||
/* the gimage */
|
||||
if (success)
|
||||
{
|
||||
int_value = args[0].value.pdb_int;
|
||||
if (! (gimage = gimage_get_ID (int_value)))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
guide_id = args[1].value.pdb_int;
|
||||
guides = gimage->guides;
|
||||
|
||||
success = FALSE;
|
||||
|
||||
while (guides)
|
||||
{
|
||||
if ((((Guide*)guides->data)->guide_ID == guide_id) &&
|
||||
(((Guide*)guides->data)->position>=0) )
|
||||
{
|
||||
success = TRUE;
|
||||
rtn_position = ((Guide*)guides->data)->position;
|
||||
goto got_it;
|
||||
}
|
||||
|
||||
guides = g_list_next(guides);
|
||||
}
|
||||
}
|
||||
|
||||
got_it:
|
||||
return_args = procedural_db_return_args
|
||||
(&gimp_image_get_guide_position_proc, success);
|
||||
|
||||
if (success)
|
||||
return_args[1].value.pdb_int = rtn_position;
|
||||
|
||||
return return_args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -199,13 +199,4 @@ void gimp_image_invalidate_preview (GimpImage *);
|
|||
|
||||
void gimp_image_invalidate_previews (void);
|
||||
|
||||
|
||||
/* Exported for PDB */
|
||||
extern ProcRecord gimp_image_add_hguide_proc;
|
||||
extern ProcRecord gimp_image_add_vguide_proc;
|
||||
extern ProcRecord gimp_image_delete_guide_proc;
|
||||
extern ProcRecord gimp_image_findnext_guide_proc;
|
||||
extern ProcRecord gimp_image_get_guide_orientation_proc;
|
||||
extern ProcRecord gimp_image_get_guide_position_proc;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -427,6 +427,24 @@ void gimp_image_set_filename (gint32 image_ID,
|
|||
char *name);
|
||||
|
||||
|
||||
/****************************************
|
||||
* Guides *
|
||||
****************************************/
|
||||
|
||||
gint32 gimp_image_add_hguide (gint32 image_ID,
|
||||
gint32 yposition);
|
||||
gint32 gimp_image_add_vguide (gint32 image_ID,
|
||||
gint32 yposition);
|
||||
void gimp_image_delete_guide (gint32 image_ID,
|
||||
gint32 guide_ID);
|
||||
gint32 gimp_image_findnext_guide (gint32 image_ID,
|
||||
gint32 guide_ID);
|
||||
GOrientation gimp_image_get_guide_orientation (gint32 image_ID,
|
||||
gint32 guide_ID);
|
||||
gint32 gimp_image_get_guide_position (gint32 image_ID,
|
||||
gint32 guide_ID);
|
||||
|
||||
|
||||
/****************************************
|
||||
* Displays *
|
||||
****************************************/
|
||||
|
|
|
@ -27,6 +27,13 @@ typedef enum
|
|||
INDEXED = 2
|
||||
} GImageType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ORIENTATION_UNKNOWN = -1,
|
||||
ORIENTATION_VERTICAL = 0,
|
||||
ORIENTATION_HORIZONTAL = 1
|
||||
} GOrientation;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RGB_IMAGE = 0,
|
||||
|
|
|
@ -20,6 +20,154 @@
|
|||
#include "gimp.h"
|
||||
|
||||
|
||||
gint32
|
||||
gimp_image_add_hguide (gint32 image_id,
|
||||
gint32 yposition)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 guide_id;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_add_hguide",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, yposition,
|
||||
PARAM_END);
|
||||
|
||||
guide_id = -1;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
guide_id = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return guide_id;
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_add_vguide (gint32 image_id,
|
||||
gint32 xposition)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 guide_id;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_add_vguide",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, xposition,
|
||||
PARAM_END);
|
||||
|
||||
guide_id = -1;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
guide_id = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return guide_id;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_delete_guide (gint32 image_id,
|
||||
gint32 guide_id)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_delete_guide",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, guide_id,
|
||||
PARAM_END);
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_findnext_guide (gint32 image_id,
|
||||
gint32 guide_id)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 rtn_guide_id;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_findnext_guide",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, guide_id,
|
||||
PARAM_END);
|
||||
|
||||
rtn_guide_id = -1;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
rtn_guide_id = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return rtn_guide_id;
|
||||
}
|
||||
|
||||
GOrientation
|
||||
gimp_image_get_guide_orientation (gint32 image_id,
|
||||
gint32 guide_id)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
GOrientation rtn_guide_orientation;
|
||||
gint32 pdb_orientation;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_guide_orientation",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, guide_id,
|
||||
PARAM_END);
|
||||
|
||||
rtn_guide_orientation = ORIENTATION_UNKNOWN;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
{
|
||||
pdb_orientation = return_vals[1].data.d_int32;
|
||||
switch (pdb_orientation)
|
||||
{
|
||||
case 0:
|
||||
rtn_guide_orientation = ORIENTATION_VERTICAL;
|
||||
break;
|
||||
case 1:
|
||||
rtn_guide_orientation = ORIENTATION_HORIZONTAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return rtn_guide_orientation;
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_get_guide_position (gint32 image_id,
|
||||
gint32 guide_id)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 rtn_guide_position;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_guide_position",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, guide_id,
|
||||
PARAM_END);
|
||||
|
||||
rtn_guide_position = -1;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
rtn_guide_position = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return rtn_guide_position;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint32
|
||||
gimp_image_new (guint width,
|
||||
guint height,
|
||||
|
|
|
@ -20,6 +20,154 @@
|
|||
#include "gimp.h"
|
||||
|
||||
|
||||
gint32
|
||||
gimp_image_add_hguide (gint32 image_id,
|
||||
gint32 yposition)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 guide_id;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_add_hguide",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, yposition,
|
||||
PARAM_END);
|
||||
|
||||
guide_id = -1;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
guide_id = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return guide_id;
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_add_vguide (gint32 image_id,
|
||||
gint32 xposition)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 guide_id;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_add_vguide",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, xposition,
|
||||
PARAM_END);
|
||||
|
||||
guide_id = -1;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
guide_id = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return guide_id;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_delete_guide (gint32 image_id,
|
||||
gint32 guide_id)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_delete_guide",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, guide_id,
|
||||
PARAM_END);
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_findnext_guide (gint32 image_id,
|
||||
gint32 guide_id)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 rtn_guide_id;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_findnext_guide",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, guide_id,
|
||||
PARAM_END);
|
||||
|
||||
rtn_guide_id = -1;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
rtn_guide_id = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return rtn_guide_id;
|
||||
}
|
||||
|
||||
GOrientation
|
||||
gimp_image_get_guide_orientation (gint32 image_id,
|
||||
gint32 guide_id)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
GOrientation rtn_guide_orientation;
|
||||
gint32 pdb_orientation;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_guide_orientation",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, guide_id,
|
||||
PARAM_END);
|
||||
|
||||
rtn_guide_orientation = ORIENTATION_UNKNOWN;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
{
|
||||
pdb_orientation = return_vals[1].data.d_int32;
|
||||
switch (pdb_orientation)
|
||||
{
|
||||
case 0:
|
||||
rtn_guide_orientation = ORIENTATION_VERTICAL;
|
||||
break;
|
||||
case 1:
|
||||
rtn_guide_orientation = ORIENTATION_HORIZONTAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return rtn_guide_orientation;
|
||||
}
|
||||
|
||||
gint32
|
||||
gimp_image_get_guide_position (gint32 image_id,
|
||||
gint32 guide_id)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint32 rtn_guide_position;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_guide_position",
|
||||
&nreturn_vals,
|
||||
PARAM_IMAGE, image_id,
|
||||
PARAM_INT32, guide_id,
|
||||
PARAM_END);
|
||||
|
||||
rtn_guide_position = -1;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
rtn_guide_position = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return rtn_guide_position;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint32
|
||||
gimp_image_new (guint width,
|
||||
guint height,
|
||||
|
|
Loading…
Reference in New Issue