applied patches to GAP provided by Wolfgang Hofer

--Sven
This commit is contained in:
Sven Neumann 2000-12-03 13:11:34 +00:00
parent 86b0bd74b5
commit 81a758dd81
21 changed files with 1966 additions and 815 deletions

View File

@ -1,3 +1,40 @@
2000-12-03 Sven Neumann <sven@gimp.org>
* PLUGIN_MAINTAINERS: changed email address of Wolfgang Hofer
* plug-ins/gap/README
* plug-ins/gap/gap_decode_mpeg_main.c
* plug-ins/gap/gap_decode_xanim.c
* plug-ins/gap/gap_filter_codegen.c
* plug-ins/gap/gap_filter_foreach.c
* plug-ins/gap/gap_filter_main.c
* plug-ins/gap/gap_frontends_main.c
* plug-ins/gap/gap_lib.c
* plug-ins/gap/gap_lib.h
* plug-ins/gap/gap_main.c
* plug-ins/gap/gap_match.c
* plug-ins/gap/gap_mod_layer.c
* plug-ins/gap/gap_mov_dialog.c
* plug-ins/gap/gap_mov_dialog.h
* plug-ins/gap/gap_mov_exec.c
* plug-ins/gap/gap_mov_exec.h
* plug-ins/gap/gap_navigator_dialog.c
* plug-ins/gap/resize.c
* plug-ins/gap/sel-to-anim-img.scm:
applied patches provided by Wolfgang Hofer <hof@gimp.org>
- Bugfix: replaced MovePath's intern Algorithm for calculating
Values between controlpoints (the old Algorithm fails sometimes
especially if only 1 controlpoint is used, or if you have n
frames and n-1 controlpoints)
- new e-mail adress
- replaced sprintf (used g_strdup_printf g_snprintf)
- procedures for gap locks, check for locking processes pid
- NONINTERACTIVE PDB Interface(s) for MovePath
plug_in_gap_get_animinfo, plug_in_gap_set_framerate
- FRAME based Stepmodes for MovePath
- increased controlpoint limit GAP_MOV_MAX_POINT (256 -> 1024)
2000-12-02 Michael Natterer <mitch@gimp.org>
* plug-ins/print/README

View File

@ -195,8 +195,8 @@ SIZE : 19.6 kB in 1 file (only C files counted)
COMMENT :
-----------
NAME : curve_bend
AUTHOR : Wolfgang Hofer <hof@hotbot.com>
MAINTAINER : Wolfgang Hofer <hof@hotbot.com>
AUTHOR : Wolfgang Hofer <hof@gimp.org>
MAINTAINER : Wolfgang Hofer <hof@gimp.org>
SIZE : 105.0 kB in 1 file (only C files counted)
COMMENT :
-----------
@ -315,8 +315,8 @@ SIZE : 21.5 kB in 1 file (only C files counted)
COMMENT :
-----------
NAME : gap
AUTHOR : Wolfgang Hofer <hof@hotbot.com>
MAINTAINER : Wolfgang Hofer <hof@hotbot.com>
AUTHOR : Wolfgang Hofer <hof@gimp.org>
MAINTAINER : Wolfgang Hofer <hof@gimp.org>
SIZE : 813.5 kB in 25 files (only C files counted)
COMMENT :
-----------
@ -724,7 +724,7 @@ COMMENT :
-----------
NAME : sample_colorize
AUTHOR : Wolfgang Hofer
MAINTAINER : Wolfgang Hofer <hof@hotbot.com>
MAINTAINER : Wolfgang Hofer <hof@gimp.org>
SIZE : 92.6 kB in 1 file (only C files counted)
COMMENT :
-----------
@ -976,7 +976,7 @@ COMMENT :
-----------
NAME : xjt
AUTHOR : Wolfgang Hofer
MAINTAINER : Wolfgang Hofer <hof@hotbot.com>
MAINTAINER : Wolfgang Hofer <hof@gimp.org>
SIZE : 169.6 kB in 3 files (only C files counted)
COMMENT :
-----------

View File

@ -1,4 +1,4 @@
Project gap "Gimp Animation Package" 04. June 2000 release 1.1.23a
Project gap "Gimp Animation Package" 25. Nov 2000 release 1.1.29b
--------------------------------------------------------------------
Introduction
@ -130,6 +130,10 @@ Write (encode)
--------------------------------------------------------------------
Change Log
--------------------------------------------------------------------
- 1.1.29b - Frame Based Stepmodes in MovePath
- NONINTERACTIVE interface for Move Path
- Inform about Locks in Dialog Window,
(clear lock if locking process does not exist --UNIX only)
- 1.1.20a - MovePath
- AnimPreview
- Keyframes
@ -477,6 +481,24 @@ WebTip: My GIMP-page http://pages.hotbot.com/arts/hof/index.html
the Layers of the SourceImage are stepped through,
and the next handled frame recieves the next
Layer from the Source_images Layerstack.
For the Frame based Stepmodes ("Frame Loop", "Frame PingPong" ...)
the selected Source(Layer) should be a Layer of another AnimFrame.
In the Frame based Stepmodes the Source Object is considered
as AnimFrames and stepping is done from frame to frame
(and not from layer to layer)
The inserted Layer is always a copy of one Frame of the
source object Animation (no matter which Src Layer was selected)
where all the visible source Layers are merged.
The FrameBased Modes can be used to mix Videos with many frames,
because there is no need to convert one of the videos to
a multilayer image.
If you use a normal Image (that is not an AnimFrame) as Source
for the FrameBased Stepmodes it acts like an Animation with
only one frame.
The copies of the SourceLayer(s) were modified by transitions
with varying Parameters.

View File

@ -58,7 +58,8 @@
/*
* Changelog:
*
* 2000/02/07 v1.1.16a: hof: replaced sprintf by g_strdup_printf
* 2000/11/30 v1.1.29b: hof: new e-mail adress
* 2000/02/07 v1.1.16a: hof: used g_strdup_printf
* 2000/01/06 v1.1.14a: hof: save thumbnails .xvpics p_gimp_file_save_thumbnail
* store framerate in video_info file
* 1999/11/25 v1.1.11.b: Initial release. [hof]
@ -172,9 +173,9 @@ query ()
gimp_install_procedure ("plug_in_gap_decode_mpeg",
"Split MPEG1 movies into animframes and load 1st frame",
"Split MPEG1 movies into single frames (image files on disk) and load 1st frame. audio tracks are ignored",
"Wolfgang Hofer (hof@hotbot.com)",
"Wolfgang Hofer (hof@gimp.org)",
"Wolfgang Hofer",
"2000/01/01",
"2000/11/30",
N_("<Image>/Video/Split Video to Frames/MPEG1"),
NULL,
GIMP_PLUGIN,
@ -184,9 +185,9 @@ query ()
gimp_install_procedure ("extension_gap_decode_mpeg",
"Split MPEG1 movies into animframes and load 1st frame",
"Split MPEG1 movies into single frames (image files on disk) and load 1st frame. audio tracks are ignored",
"Wolfgang Hofer (hof@hotbot.com)",
"Wolfgang Hofer (hof@gimp.org)",
"Wolfgang Hofer",
"2000/01/01",
"2000/11/30",
N_("<Toolbox>/Xtns/Split Video to Frames/MPEG1"),
NULL,
GIMP_EXTENSION,

View File

@ -48,6 +48,7 @@
*/
/* revision history
* 1.1.29b; 2000/11/30 hof: used g_snprintf
* 1.1.17b; 2000/02/26 hof: bugfixes
* 1.1.14a; 1999/11/22 hof: fixed gcc warning (too many arguments for format)
* 1.1.13a; 1999/11/22 hof: first release
@ -356,18 +357,18 @@ p_overwrite_dialog(char *filename, gint overwrite_mode)
static void
p_build_xanim_framename(char *framename, gint32 frame_nr, char *ext)
p_build_xanim_framename(char *framename, gint32 sizeof_framename, gint32 frame_nr, char *ext)
{
sprintf(framename, "%s/frame%d.%s",
g_snprintf(framename, sizeof_framename, "%s/frame%d.%s",
global_xanim_input_dir,
(int)frame_nr,
ext);
}
static void
p_build_gap_framename(char *framename, gint32 frame_nr, char *basename, char *ext)
p_build_gap_framename(char *framename, gint32 sizeof_framename, gint32 frame_nr, char *basename, char *ext)
{
sprintf(framename, "%s%04d.%s", basename, (int)frame_nr, ext);
g_snprintf(framename, sizeof_framename, "%s%04d.%s", basename, (int)frame_nr, ext);
}
int
@ -432,7 +433,7 @@ p_convert_frames(gint32 frame_from, gint32 frame_to, char *basename, char *ext,
char l_first_xa_frame[200];
/* load 1st one of those frames generated by xanim */
p_build_xanim_framename(l_first_xa_frame, frame_from, ext);
p_build_xanim_framename(l_first_xa_frame, sizeof(l_first_xa_frame), frame_from, ext);
l_tmp_image_id = p_load_image(l_first_xa_frame);
/* convert the xanim frames (from ppm) to xcf fileformat
@ -485,7 +486,7 @@ p_find_max_xanim_frame(gint32 from_nr, char *ext)
while(1 == 1)
{
p_build_xanim_framename(l_frame, l_nr, ext);
p_build_xanim_framename(l_frame, sizeof(l_frame), l_nr, ext);
if(gap_debug) printf("DEBUG find_MAX :%s\n", l_frame);
@ -546,8 +547,8 @@ p_rename_frames(gint32 frame_from, gint32 frame_to, char *basename, char *ext)
while (l_frame_nr <= frame_to)
{
p_build_xanim_framename(l_src_frame, l_frame_nr, ext);
p_build_gap_framename(l_dst_frame, l_frame_nr, basename, ext);
p_build_xanim_framename(l_src_frame, sizeof(l_src_frame), l_frame_nr, ext);
p_build_gap_framename(l_dst_frame, sizeof(l_dst_frame), l_frame_nr, basename, ext);
if(!p_file_exists(l_src_frame))
{
@ -622,14 +623,14 @@ p_delete_frames(gint32 max_tries, gint32 frame_from, gint32 frame_to, char *ext)
while ((global_delete_number < frame_from) && (l_tries < max_tries))
{
l_next_number = global_delete_number + 1;
p_build_xanim_framename(l_framename, l_next_number, ext);
p_build_xanim_framename(l_framename, sizeof(l_framename), l_next_number, ext);
if (p_file_exists(l_framename))
{
/* if xanim has already written the next frame
* we can delete the previous (unwanted) frame now
*/
p_build_xanim_framename(l_framename, global_delete_number, ext);
p_build_xanim_framename(l_framename, sizeof(l_framename), global_delete_number, ext);
if(gap_debug) printf("delete frame: %s\n", l_framename);
remove(l_framename);
@ -786,7 +787,7 @@ p_start_xanim_process(gint32 first_frame, gint32 last_frame,
l_xanim_pid = -1;
/* allocate and prepare args for the xanim call */
sprintf(l_cmd, "%s +f ", global_xanim_prog); /* programname */
g_snprintf(l_cmd, sizeof(l_cmd), "%s +f ", global_xanim_prog); /* programname */
if (extract_audio)
{
@ -803,7 +804,7 @@ p_start_xanim_process(gint32 first_frame, gint32 last_frame,
strcat(l_cmd, "+Ee ");
break;
case XAENC_JPEG:
sprintf(l_buf, "+Eq%d ", (int)jpeg_quality);
g_snprintf(l_buf, sizeof(l_buf), "+Eq%d ", (int)jpeg_quality);
strcat(l_cmd, l_buf);
break;
default:
@ -816,7 +817,7 @@ p_start_xanim_process(gint32 first_frame, gint32 last_frame,
*/
if (run_xanim_asynchron)
{
sprintf(l_buf, "+Zp%d ", (int)(last_frame +1));
g_snprintf(l_buf, sizeof(l_buf), "+Zp%d ", (int)(last_frame +1));
strcat(l_cmd, l_buf);
}
@ -923,7 +924,7 @@ p_start_xanim_process_exec(gint32 first_frame, gint32 last_frame,
args[l_idx] = g_strdup("+Ee");
break;
case XAENC_JPEG:
sprintf(l_buf, "+Eq%d", (int)jpeg_quality);
g_snprintf(l_buf, sizeof(l_buf), "+Eq%d", (int)jpeg_quality);
args[l_idx] = g_strdup(l_buf);
break;
default:
@ -935,7 +936,7 @@ p_start_xanim_process_exec(gint32 first_frame, gint32 last_frame,
* to stop xanim exporting frames beyond the requested limit
*/
l_idx++;
sprintf(l_buf, "+Zp%d", (int)(last_frame +1));
g_snprintf(l_buf, sizeof(l_buf), "+Zp%d", (int)(last_frame +1));
args[l_idx] = g_strdup(l_buf);
}
@ -1049,7 +1050,7 @@ gap_xanim_decode(GimpRunModeType run_mode)
break;
}
p_build_xanim_framename(l_one_past_last_frame, last_frame +1 , extension);
p_build_xanim_framename(l_one_past_last_frame, sizeof(l_one_past_last_frame), last_frame +1 , extension);
if (extract_video)
{
@ -1059,7 +1060,7 @@ gap_xanim_decode(GimpRunModeType run_mode)
/* the input directory already exists,
* remove frames
*/
sprintf(l_cmd, "rm -f %s/*.%s", global_xanim_input_dir, extension);
g_snprintf(l_cmd, sizeof(l_cmd), "rm -f %s/*.%s", global_xanim_input_dir, extension);
system(l_cmd);
}
else
@ -1164,7 +1165,7 @@ gap_xanim_decode(GimpRunModeType run_mode)
if (strcmp(l_dst_dir, global_xanim_input_dir) != 0)
{
/* remove input dir with all files */
sprintf(l_cmd, "rm -rf \"%s\"", global_xanim_input_dir);
g_snprintf(l_cmd, sizeof(l_cmd), "rm -rf \"%s\"", global_xanim_input_dir);
system(l_cmd);
}
}
@ -1191,7 +1192,7 @@ gap_xanim_decode(GimpRunModeType run_mode)
if(autoload)
{
/* load first frame and add a display */
p_build_gap_framename(l_first_to_laod, first_frame, basename, &extension2[1]);
p_build_gap_framename(l_first_to_laod, sizeof(l_first_to_laod), first_frame, basename, &extension2[1]);
l_rc = p_load_image(l_first_to_laod);
if(l_rc >= 0) gimp_display_new(l_rc);

View File

@ -11,6 +11,7 @@
*/
/* revision history:
* 1.1.29b; 2000/11/30 hof: used g_snprintf
* version 0.99.00 1999.03.14 hof: Codegeneration of File ./gen_filter_iter_code.c
* splittet into single Files XX_iter_ALT.inc
* bugfixes in code generation
@ -84,14 +85,14 @@ p_type_to_string(GimpPDBArgType t)
}
static void p_get_gendate(char *gendate)
static void p_get_gendate(char *gendate, gint32 sizeof_gendate)
{
struct tm *l_t;
long l_ti;
l_ti = time(0L); /* Get UNIX time */
l_t = localtime(&l_ti); /* konvert time to tm struct */
sprintf(gendate, "%02d.%02d.%02d %02d:%02d"
g_snprintf(gendate, sizeof_gendate, "%02d.%02d.%02d %02d:%02d"
, l_t->tm_mday
, l_t->tm_mon + 1
, l_t->tm_year
@ -170,7 +171,7 @@ gint p_gen_code_iter_ALT(char *proc_name)
l_rc = 0;
p_get_gendate(&l_gendate[0]);
p_get_gendate(&l_gendate[0], sizeof(l_gendate));
/* Query the gimp application's procedural database
* regarding a particular procedure.
@ -199,7 +200,7 @@ gint p_gen_code_iter_ALT(char *proc_name)
if (l_params[1].type != GIMP_PDB_IMAGE) { l_rc = -1; }
if (l_params[2].type != GIMP_PDB_DRAWABLE) { l_rc = -1; }
sprintf(l_filename, "%s_iter_ALT.inc", l_clean_proc_name);
g_snprintf(l_filename, sizeof(l_filename), "%s_iter_ALT.inc", l_clean_proc_name);
l_fp = fopen(l_filename, "w");
if(l_fp != NULL)
{
@ -362,7 +363,7 @@ gint p_gen_code_iter(char *proc_name)
gchar l_clean_par_name[256];
l_rc = 0;
p_get_gendate(&l_gendate[0]);
p_get_gendate(&l_gendate[0], sizeof(l_gendate));
/* Query the gimp application's procedural database
* regarding a particular procedure.
@ -391,7 +392,7 @@ gint p_gen_code_iter(char *proc_name)
if (l_params[2].type != GIMP_PDB_DRAWABLE) { l_rc = -1; }
sprintf(l_filename, "%s_iter.c", l_clean_proc_name);
g_snprintf(l_filename, sizeof(l_filename), "%s_iter.c", l_clean_proc_name);
l_fp = fopen(l_filename, "w");
if(l_fp != NULL)
@ -659,7 +660,7 @@ gint p_gen_code_iter(char *proc_name)
fprintf(l_fp, " static GimpParamDef *return_vals = NULL;\n");
fprintf(l_fp, " static int nreturn_vals = 0;\n");
fprintf(l_fp, "\n");
fprintf(l_fp, " sprintf(l_blurb_text, \"This extension calculates the modified values for one iterationstep for the call of %s\");\n", l_clean_proc_name);
fprintf(l_fp, " g_snprintf(l_blurb_text, sizeof(l_blurb_text), \"This extension calculates the modified values for one iterationstep for the call of %s\");\n", l_clean_proc_name);
fprintf(l_fp, "\n");
fprintf(l_fp, " gimp_install_procedure(\"%s_Iterator\",\n", l_clean_proc_name);
fprintf(l_fp, " l_blurb_text,\n");

View File

@ -28,6 +28,7 @@
*/
/* revision history:
* 1.1.29b; 2000/11/30 hof: use g_snprintf
* 1.1.28a; 2000/11/05 hof: check for GIMP_PDB_SUCCESS (not for FALSE)
* version 0.97.00 hof: - modul splitted (2.nd part is now gap_filter_pdb.c)
* version 0.96.03 hof: - pitstop dialog provides optional backup on each step
@ -132,7 +133,7 @@ static gint p_pitstop(GimpRunModeType run_mode, char *plugin_name, gint text_fla
l_but_argv[0].but_val = 0;
l_but_argv[1].but_txt = _("Cancel");
l_but_argv[1].but_val = -1;
sprintf(l_skip_txt, "Skip %d", (int)layer_idx);
g_snprintf(l_skip_txt, sizeof(l_skip_txt), "Skip %d", (int)layer_idx);
l_but_argv[2].but_txt = l_skip_txt;
l_but_argv[2].but_val = 1;
@ -337,7 +338,7 @@ int p_foreach_multilayer(GimpRunModeType run_mode, gint32 image_id,
l_plugin_data_len = p_get_data(plugin_name);
if(l_plugin_data_len > 0)
{
sprintf(l_key_from, "%s_ITER_FROM", plugin_name);
g_snprintf(l_key_from, sizeof(l_key_from), "%s_ITER_FROM", plugin_name);
p_set_data(l_key_from, l_plugin_data_len);
}
else l_rc = -1;
@ -387,7 +388,7 @@ int p_foreach_multilayer(GimpRunModeType run_mode, gint32 image_id,
l_plugin_data_len = p_get_data(plugin_name);
if(l_plugin_data_len > 0)
{
sprintf(l_key_to, "%s_ITER_TO", plugin_name);
g_snprintf(l_key_to, sizeof(l_key_to), "%s_ITER_TO", plugin_name);
p_set_data(l_key_to, l_plugin_data_len);
}
else l_rc = -1;

View File

@ -46,9 +46,10 @@
/* GAP includes */
#include "gap_filter.h"
static char *gap_filter_version = "0.92.00; 1998/01/16";
static char *gap_filter_version = "0.92.01; 2000/11/30";
/* revision history:
* 2000/11/30 v1.1.29b: hof: new e-mail adress
* version 0.92.00 hof: set gap_debug from environment
* version 0.91.01; Tue Dec 23 hof: 1.st (pre) release
*/
@ -99,7 +100,7 @@ query ()
gimp_install_procedure("plug_in_gap_layers_run_animfilter",
"This plugin calls another plugin for each layer of an image, varying its settings (to produce animated effects). The called plugin must work on a single drawable and must be able to GIMP_RUN_WITH_LAST_VALS",
"",
"Wolfgang Hofer (hof@hotbot.com)",
"Wolfgang Hofer (hof@gimp.org)",
"Wolfgang Hofer",
gap_filter_version,
N_("<Image>/Filters/Filter all Layers..."),

View File

@ -41,9 +41,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
static char *gap_main_version = "1.1.11b; 1999/11/20";
static char *gap_main_version = "1.1.29b; 2000/11/25";
/* revision history:
* gimp 1.1.29b; 2000/11/25 hof: use gap lock procedures, update e-mail adress + main version
* gimp 1.1.11b; 1999/11/20 hof: added gap_decode_xanim, fixed typo in mpeg encoder menu path
* based on parts that were found in gap_main.c before.
*/
@ -121,7 +122,7 @@ query ()
gimp_install_procedure("plug_in_gap_xanim_decode",
"This plugin calls xanim to split any video to anim frames. (xanim exporting edition must be installed on your system)",
"",
"Wolfgang Hofer (hof@hotbot.com)",
"Wolfgang Hofer (hof@gimp.org)",
"Wolfgang Hofer",
gap_main_version,
N_("<Image>/Video/Split Video to Frames/Any XANIM readable..."),
@ -133,7 +134,7 @@ query ()
gimp_install_procedure("extension_gap_xanim_decode",
"This plugin calls xanim to split any video to anim frames. (xanim exporting edition must be installed on your system)",
"",
"Wolfgang Hofer (hof@hotbot.com)",
"Wolfgang Hofer (hof@gimp.org)",
"Wolfgang Hofer",
gap_main_version,
N_("<Toolbox>/Xtns/Split Video to Frames/Any XANIM readable..."),
@ -145,7 +146,7 @@ query ()
gimp_install_procedure("plug_in_gap_mpeg_encode",
"This plugin calls mpeg_encode to convert anim frames to MPEG1, or just generates a param file for mpeg_encode. (mpeg_encode must be installed on your system)",
"",
"Wolfgang Hofer (hof@hotbot.com)",
"Wolfgang Hofer (hof@gimp.org)",
"Wolfgang Hofer",
gap_main_version,
N_("<Image>/Video/Encode/MPEG1..."),
@ -158,7 +159,7 @@ query ()
gimp_install_procedure("plug_in_gap_mpeg2encode",
"This plugin calls mpeg2encode to convert anim frames to MPEG1 or MPEG2, or just generates a param file for mpeg2encode. (mpeg2encode must be installed on your system)",
"",
"Wolfgang Hofer (hof@hotbot.com)",
"Wolfgang Hofer (hof@gimp.org)",
"Wolfgang Hofer",
gap_main_version,
N_("<Image>/Video/Encode/MPEG2..."),
@ -179,15 +180,6 @@ run (char *name,
int *nreturn_vals,
GimpParam **return_vals)
{
typedef struct
{
long lock; /* 0 ... NOT Locked, 1 ... locked */
gint32 image_id;
long timestamp; /* locktime not used for now */
} t_lockdata;
t_lockdata l_lock;
static char l_lockname[50];
char *l_env;
char l_extension[32];
@ -195,6 +187,7 @@ run (char *name,
GimpRunModeType run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_id;
gint32 lock_image_id;
gint32 nr;
gint32 l_rc;
@ -213,22 +206,18 @@ run (char *name,
run_mode = param[0].data.d_int32;
image_id = -1;
lock_image_id = image_id;
if(gap_debug) fprintf(stderr, "\n\ngap_main: debug name = %s\n", name);
if (strcmp (name, "extension_gap_xanim_decode") != 0)
{
image_id = param[1].data.d_image;
lock_image_id = image_id;
/* check for locks */
l_lock.lock = 0;
sprintf(l_lockname, "plug_in_gap_plugins_LOCK_%d", (int)image_id);
gimp_get_data (l_lockname, &l_lock);
if((l_lock.lock != 0) && (l_lock.image_id == image_id))
if(p_gap_lock_is_locked(lock_image_id, run_mode))
{
fprintf(stderr, "gap_plugin is LOCKED for Image ID=%s\n", l_lockname);
status = GIMP_PDB_EXECUTION_ERROR;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
@ -237,9 +226,7 @@ run (char *name,
/* set LOCK on current image (for all gap_plugins) */
l_lock.lock = 1;
l_lock.image_id = image_id;
gimp_set_data (l_lockname, &l_lock, sizeof(l_lock));
p_gap_lock_set(lock_image_id);
}
if (run_mode == GIMP_RUN_NONINTERACTIVE) {
@ -333,8 +320,6 @@ run (char *name,
if (strcmp (name, "extension_gap_xanim_decode") != 0)
{
/* remove LOCK on this image for all gap_plugins */
l_lock.lock = 0;
l_lock.image_id = -1;
gimp_set_data (l_lockname, &l_lock, sizeof(l_lock));
p_gap_lock_remove(lock_image_id);
}
}

View File

@ -28,6 +28,7 @@
*/
/* revision history:
* 1.1.29a; 2000/11/23 hof: gap locking (changed to procedures and placed here)
* 1.1.28a; 2000/11/05 hof: check for GIMP_PDB_SUCCESS (not for FALSE)
* 1.1.20a; 2000/04/25 hof: new: p_get_video_paste_name p_vid_edit_clear
* 1.1.17b; 2000/02/27 hof: bug/style fixes
@ -63,6 +64,7 @@
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <signal.h> /* for kill */
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
@ -96,6 +98,10 @@
#define mkdir(path,mode) _mkdir(path)
#endif
#ifdef G_OS_WIN32
#include <process.h> /* For _getpid() */
#endif
/* GAP includes */
#include "gap_layer_copy.h"
#include "gap_lib.h"
@ -126,6 +132,7 @@ char *
p_alloc_fname_thumbnail(char *name)
{
int l_len;
int l_len2;
int l_idx;
char *l_str;
@ -135,7 +142,8 @@ p_alloc_fname_thumbnail(char *name)
}
l_len = strlen(name);
l_str = g_malloc(l_len+10);
l_len2 = l_len + 10;
l_str = g_malloc(l_len2);
strcpy(l_str, name);
if(l_len > 0)
{
@ -147,7 +155,7 @@ p_alloc_fname_thumbnail(char *name)
break;
}
}
sprintf(&l_str[l_idx], ".xvpics%s%s", G_DIR_SEPARATOR_S, &name[l_idx]);
g_snprintf(&l_str[l_idx], l_len2 - l_idx, ".xvpics%s%s", G_DIR_SEPARATOR_S, &name[l_idx]);
}
if(gap_debug) printf("p_alloc_fname_thumbnail: thumbname=%s:\n", l_str );
return(l_str);
@ -2847,3 +2855,108 @@ gap_vid_edit_paste(GimpRunModeType run_mode, gint32 image_id, long paste_mode)
return(rc);
} /* end gap_vid_edit_paste */
gint32
p_getpid(void)
{
#ifndef G_OS_WIN32
/* for UNIX */
return ((gint32)getpid());
#else
/* hof: dont know how to getpid on windows */
return 0;
#endif
}
gint
p_pid_is_alive(gint32 pid)
{
#ifndef G_OS_WIN32
/* for UNIX */
/* kill with signal 0 checks only if the process is alive (no signal is sent)
* returns 0 if alive, 1 if no process with given pid found.
*/
if (0 == kill(pid, 0))
{
return(TRUE);
}
return (FALSE);
#else
/* hof: dont know how to check on Windows
* assume that process is always alive
* (therefore on Windows locks will not be cleared
* automatically after crashes of the locking process)
*/
return(TRUE);
#endif
}
static void
p_gap_lock_build_lockkey(t_gap_lockdata *lock, gint32 image_id)
{
g_snprintf(lock->key, sizeof(lock->key), "plug_in_gap_plugins_LOCK_%d", (int)image_id);
}
gint
p_gap_lock_is_locked(gint32 image_id, GimpRunModeType run_mode)
{
gint32 l_pid;
t_gap_lockdata l_lock;
/* check for locks */
l_pid = p_getpid();
l_lock.lock = 0;
p_gap_lock_build_lockkey(&l_lock, image_id);
gimp_get_data (l_lock.key, &l_lock);
if((l_lock.lock != 0) && (l_lock.image_id == image_id))
{
if(p_pid_is_alive(l_lock.pid))
{
if(run_mode == GIMP_RUN_INTERACTIVE)
{
gchar *l_lockmsg;
l_lockmsg = g_strdup_printf(_("Cant execute more than 1 Video Function\n"
"on the same AnimFrame Image at the same time\n"
"LOCK ID:%s\n")
, l_lock.key);
gimp_message(l_lockmsg);
g_free(l_lockmsg);
}
printf("GAP plugin is LOCKED ID:%s PID:%d\n", l_lock.key, (int)l_lock.pid);
return(TRUE);
}
}
return(FALSE);
}
void
p_gap_lock_set(gint32 image_id)
{
t_gap_lockdata l_lock;
p_gap_lock_build_lockkey(&l_lock, image_id);
/* set LOCK on image (for all gap_plugins) */
l_lock.lock = 1;
l_lock.image_id = image_id;
l_lock.pid = p_getpid();
gimp_set_data (l_lock.key, &l_lock, sizeof(l_lock));
}
void
p_gap_lock_remove(gint32 image_id)
{
t_gap_lockdata l_lock;
p_gap_lock_build_lockkey(&l_lock, image_id);
/* remove LOCK on this image for all gap_plugins */
l_lock.lock = 0;
l_lock.image_id = -1;
gimp_set_data (l_lock.key, &l_lock, sizeof(l_lock));
}

View File

@ -25,6 +25,7 @@
*/
/* revision history:
* 1.1.29a; 2000/11/23 hof: gap locking (changed to procedures and placed here)
* 1.1.20a; 2000/04/25 hof: new: p_get_video_paste_name p_clear_video_paste
* 1.1.14a; 2000/01/02 hof: new: p_get_frame_nr
* 1.1.8a; 1999/08/31 hof: new: p_strdup_del_underscore and p_strdup_add_underscore
@ -61,6 +62,13 @@
#endif /* !G_OS_WIN32 */
typedef struct
{
char key[50];
long lock; /* 0 ... NOT Locked, 1 ... locked */
gint32 image_id;
gint32 pid;
} t_gap_lockdata;
typedef struct t_anim_info {
gint32 image_id;
@ -123,6 +131,13 @@ gint32 p_vid_edit_clear(void);
gint32 p_vid_edit_framecount(void);
gint gap_vid_edit_copy(GimpRunModeType run_mode, gint32 image_id, long range_from, long range_to);
gint gap_vid_edit_paste(GimpRunModeType run_mode, gint32 image_id, long paste_mode);
gint32 p_getpid(void);
gint p_pid_is_alive(gint32 pid);
gint p_gap_lock_is_locked(gint32 image_id, GimpRunModeType run_mode);
void p_gap_lock_set(gint32 image_id);
void p_gap_lock_remove(gint32 image_id);
#define VID_PASTE_REPLACE 0
#define VID_PASTE_INSERT_BEFORE 1

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@
*/
/* revision history:
* gimp 1.1.29b; 2000/11/30 hof: used g_snprintf
* version 0.97.00 1998.10.14 hof: - created module
*/
#include "config.h"
@ -102,8 +103,8 @@ p_substitute_framenr (char *buffer, int buff_len, char *new_layername, long curr
if(l_digits > 0)
{
l_digits--;
sprintf(&l_fmt_str[2], "%dd", l_digits);
sprintf(&buffer[l_idx], l_fmt_str, (int)curr);
g_snprintf(&l_fmt_str[2], sizeof(l_fmt_str) -2, "%dd", l_digits);
g_snprintf(&buffer[l_idx], buff_len - l_idx, l_fmt_str, (int)curr);
l_idx += l_digits;
l_digits = 0;
l_cpy = 0;

View File

@ -28,7 +28,8 @@
*/
/* revision history:
* 1.1.28a; 2000/11/05 hof: check for GIMP_PDB_SUCCESS (not for FALSE)
* gimp 1.1.29b; 2000/11/30 hof: use g_snprintf
* gimp 1.1.28a; 2000/11/05 hof: check for GIMP_PDB_SUCCESS (not for FALSE)
* gimp 1.1.6; 1999/06/21 hof: bugix: wrong iterator total_steps and direction
* gimp 1.1.15.1; 1999/05/08 hof: bugix (dont mix GimpImageType with GimpImageBaseType)
* version 0.98.00 1998.11.27 hof: - use new module gap_pdb_calls.h
@ -177,7 +178,8 @@ int p_layer_modify_dialog(t_anim_info *ainfo_ptr,
argv[3].radio_ret = 4;
/* Layer select pattern string */
sprintf (sel_pattern, "0");
sel_pattern[0] = '0';
sel_pattern[1] = '\0';
p_init_arr_arg(&argv[4], WGT_TEXT);
argv[4].label_txt = _("Select Pattern:");
argv[4].entry_width = 140; /* pixel */
@ -719,7 +721,7 @@ p_do_filter_dialogs(t_anim_info *ainfo_ptr,
*plugin_data_len = p_get_data(filter_procname);
if(*plugin_data_len > 0)
{
sprintf(l_key_from, "%s_ITER_FROM", filter_procname);
g_snprintf(l_key_from, sizeof(l_key_from), "%s_ITER_FROM", filter_procname);
p_set_data(l_key_from, *plugin_data_len);
}
else
@ -817,11 +819,11 @@ p_do_2nd_filter_dialogs(char *filter_procname,
if(l_plugin_data_len <= 0)
goto cleanup;
sprintf(l_key_to, "%s_ITER_TO", filter_procname);
g_snprintf(l_key_to, sizeof(l_key_to), "%s_ITER_TO", filter_procname);
p_set_data(l_key_to, l_plugin_data_len);
/* get FROM values */
sprintf(l_key_from, "%s_ITER_FROM", filter_procname);
g_snprintf(l_key_from, sizeof(l_key_from), "%s_ITER_FROM", filter_procname);
l_plugin_data_len = p_get_data(l_key_from);
p_set_data(filter_procname, l_plugin_data_len);

View File

@ -30,6 +30,7 @@
*/
/* revision history:
* gimp 1.1.29b; 2000/11/30 hof: new feature: FRAME based Stepmodes, changes for NONINTERACTIVE mode
* gimp 1.1.23a; 2000/06/04 hof: new button: rotation follow path
* gimp 1.1.20a; 2000/04/25 hof: support for keyframes, anim_preview (suggested by jakub steiner)
* gimp 1.1.17b; 2000/02/23 hof: bugfix: dont flatten the preview, just merge visible layers
@ -195,8 +196,6 @@ GtkWidget * p_buildmenu (MenuItem *);
long p_move_dialog (t_mov_data *mov_ptr);
static void p_update_point_labels (t_mov_path_preview *path_ptr);
static gint p_conv_keyframe_to_rel (gint abs_keframe);
static gint p_conv_keyframe_to_abs (gint rel_keframe);
static void p_points_from_tab (t_mov_path_preview *path_ptr);
static void p_points_to_tab (t_mov_path_preview *path_ptr);
static void p_point_refresh (t_mov_path_preview *path_ptr);
@ -224,7 +223,6 @@ static void mov_path_prevw_cursor_update ( t_mov_path_preview *path_ptr );
static gint mov_path_prevw_preview_expose ( GtkWidget *widget, GdkEvent *event );
static gint mov_path_prevw_preview_events ( GtkWidget *widget, GdkEvent *event );
static gint p_chk_keyframes(t_mov_path_preview *path_ptr);
static gdouble p_calc_angle(gint p1x, gint p1y, gint p2x, gint p2y);
static void button_pressed_callback (GtkWidget *widget, GdkEventButton *bevent, gpointer client_data);
static void mov_padd_callback (GtkWidget *widget,gpointer data);
@ -299,6 +297,12 @@ static MenuItem option_step_items[] =
{ N_("OnceReverse"), 0, 0, mov_stepmode_menu_callback, (gpointer) GAP_STEP_ONCE_REV, NULL, NULL },
{ N_("PingPong"), 0, 0, mov_stepmode_menu_callback, (gpointer) GAP_STEP_PING_PONG, NULL, NULL },
{ N_("None"), 0, 0, mov_stepmode_menu_callback, (gpointer) GAP_STEP_NONE, NULL, NULL },
{ N_("Frame Loop"), 0, 0, mov_stepmode_menu_callback, (gpointer) GAP_STEP_FRAME_LOOP, NULL, NULL },
{ N_("Frame Loop Reverse"), 0, 0, mov_stepmode_menu_callback, (gpointer) GAP_STEP_FRAME_LOOP_REV, NULL, NULL },
{ N_("Frame Once"), 0, 0, mov_stepmode_menu_callback, (gpointer) GAP_STEP_FRAME_ONCE, NULL, NULL },
{ N_("Frame OnceReverse"), 0, 0, mov_stepmode_menu_callback, (gpointer) GAP_STEP_FRAME_ONCE_REV, NULL, NULL },
{ N_("Frame PingPong"), 0, 0, mov_stepmode_menu_callback, (gpointer) GAP_STEP_FRAME_PING_PONG, NULL, NULL },
{ N_("Frame None"), 0, 0, mov_stepmode_menu_callback, (gpointer) GAP_STEP_FRAME_NONE, NULL, NULL },
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
};
@ -313,6 +317,7 @@ static t_mov_interface mov_int =
OpsButtonModifier global_key_modifier = OPS_BUTTON_MODIFIER_NONE;
/* ============================================================================
**********************
* *
@ -371,6 +376,12 @@ long p_move_dialog (t_mov_data *mov_ptr)
pvals->apv_scalex = 40.0;
pvals->apv_scaley = 40.0;
pvals->cache_src_image_id = -1;
pvals->cache_tmp_image_id = -1;
pvals->cache_tmp_layer_id = -1;
pvals->cache_frame_number = -1;
pvals->cache_ainfo_ptr = NULL;
p_reset_points();
/* pvals->point[1].p_x = 100; */ /* default: move from 0/0 to 100/0 */
@ -914,6 +925,7 @@ mov_apv_callback (GtkWidget *widget,
GIMP_PDB_DRAWABLE, -1, /* dummy */
GIMP_PDB_END);
}
pvals->apv_mlayer_image = -1;
}
apv_locked = FALSE;
@ -934,49 +946,6 @@ p_copy_point(gint to_idx, gint from_idx)
pvals->point[to_idx].keyframe = 0;
}
static gdouble
p_calc_angle(gint p1x, gint p1y, gint p2x, gint p2y)
{
/* calculate angle in degree
* how to rotate an object that follows the line between p1 and p2
*/
gdouble l_a;
gdouble l_b;
gdouble l_angle_rad;
gdouble l_angle;
l_a = p2x - p1x;
l_b = (p2y - p1y) * (-1.0);
if(l_a == 0)
{
if(l_b < 0) { l_angle = 90.0; }
else { l_angle = 270.0; }
}
else
{
l_angle_rad = atan(l_b/l_a);
l_angle = (l_angle_rad * 180.0) / 3.14159;
if(l_a < 0)
{
l_angle = 180 - l_angle;
}
else
{
l_angle = l_angle * (-1.0);
}
}
if(gap_debug)
{
printf("p_calc_angle: p1(%d/%d) p2(%d/%d) a=%f, b=%f, angle=%f\n"
, (int)p1x, (int)p1y, (int)p2x, (int)p2y
, (float)l_a, (float)l_b, (float)l_angle);
}
return(l_angle);
}
static void
button_pressed_callback (GtkWidget *widget,
@ -1185,61 +1154,12 @@ mov_pclr_all_callback (GtkWidget *widget,
p_point_refresh(path_ptr);
}
static gdouble
p_rotatate_less_than_180(gdouble angle, gdouble angle_new, gint *turns)
{
/* if an object follows a circular path and does more than one turn
* there comes a point where it flips from say 265 degree to -85 degree.
*
* if there are more (say 3) frames between the controlpoints,
* the object performs an unexpected rotation effect because the iteration
* from 265 to -85 is done in a sequence like this: 265.0, 148.6, 32.3, -85.0
*
* we can avoid this by preventing angle changes of more than 180 degree.
* in such a case this procedure adjusts the new_angle from -85 to 275
* that results in oterations like this: 265.0, 268.3, 271.6, 275.0
*/
gint l_diff;
gint l_turns;
l_diff = angle - (angle_new + (*turns * 360));
if((l_diff >= -180) && (l_diff < 180))
{
return(angle_new + (*turns * 360));
}
l_diff = (angle - angle_new);
if(l_diff < 0)
{
l_turns = (l_diff / 360) -1;
}
else
{
l_turns = (l_diff / 360) +1;
}
*turns = l_turns;
if(gap_debug)
{
printf("p_rotatate_less_than_180: turns %d angle_new:%f\n"
, (int)l_turns, (float)angle_new);
}
return( angle_new + (l_turns * 360));
}
static void
mov_prot_follow_callback (GtkWidget *widget,
gpointer data)
{
gint l_idx;
gdouble l_startangle;
gdouble l_angle_1;
gdouble l_angle_2;
gdouble l_angle_new;
gdouble l_angle;
gint l_turns;
gint32 l_startangle;
t_mov_path_preview *path_ptr = data;
@ -1248,75 +1168,12 @@ mov_prot_follow_callback (GtkWidget *widget,
if( pvals->point_idx_max > 1)
{
l_startangle = 0.0;
l_angle = 0.0;
l_turns = 0;
if(global_key_modifier == OPS_BUTTON_MODIFIER_SHIFT)
{
p_points_to_tab(path_ptr);
l_startangle = pvals->point[0].rotation;
}
for(l_idx = 0; l_idx <= pvals->point_idx_max; l_idx++)
{
if(l_idx == 0)
{
l_angle = p_calc_angle(pvals->point[l_idx].p_x,
pvals->point[l_idx].p_y,
pvals->point[l_idx +1].p_x,
pvals->point[l_idx +1].p_y);
}
else
{
if(l_idx == pvals->point_idx_max)
{
l_angle_new = p_calc_angle(pvals->point[l_idx -1].p_x,
pvals->point[l_idx -1].p_y,
pvals->point[l_idx].p_x,
pvals->point[l_idx].p_y);
}
else
{
l_angle_1 = p_calc_angle(pvals->point[l_idx -1].p_x,
pvals->point[l_idx -1].p_y,
pvals->point[l_idx].p_x,
pvals->point[l_idx].p_y);
l_angle_2 = p_calc_angle(pvals->point[l_idx].p_x,
pvals->point[l_idx].p_y,
pvals->point[l_idx +1].p_x,
pvals->point[l_idx +1].p_y);
if((l_angle_1 == 0) && (l_angle_2 == 180))
{
l_angle_new = 270;
}
else
{
if((l_angle_1 == 90) && (l_angle_2 == 270))
{
l_angle_new = 0;
}
else
{
l_angle_new = (l_angle_1 + l_angle_2) / 2;
}
}
if(((l_angle_1 < 0) && (l_angle_2 >= 180))
|| ((l_angle_2 < 0) && (l_angle_1 >= 180)))
{
l_angle_new += 180;
}
}
l_angle = p_rotatate_less_than_180(l_angle, l_angle_new, &l_turns);
}
if(gap_debug)
{
printf("ROT Follow [%03d] angle = %f\n", (int)l_idx, (float)l_angle);
}
pvals->point[l_idx].rotation = l_startangle + l_angle;
}
p_calculate_rotate_follow(pvals, l_startangle);
}
global_key_modifier = OPS_BUTTON_MODIFIER_NONE;
@ -1632,25 +1489,6 @@ mov_show_path_callback(GtkWidget *widget, gpointer client_data)
* procedures to handle POINTS - TABLE
* ============================================================================
*/
static gint
p_conv_keyframe_to_rel(gint abs_keyframe)
{
if(pvals->dst_range_start <= pvals->dst_range_end)
{
return (abs_keyframe - pvals->dst_range_start);
}
return (pvals->dst_range_start - abs_keyframe);
}
static gint
p_conv_keyframe_to_abs(gint rel_keyframe)
{
if(pvals->dst_range_start <= pvals->dst_range_end)
{
return(rel_keyframe + pvals->dst_range_start);
}
return(pvals->dst_range_start - rel_keyframe);
}
static void
@ -1701,6 +1539,8 @@ p_points_from_tab(t_mov_path_preview *path_ptr)
static void
p_points_to_tab(t_mov_path_preview *path_ptr)
{
if(gap_debug) printf("p_points_to_tab: idx=%d, rotation=%d\n", (int)pvals->point_idx ,(int) path_ptr->rotation);
pvals->point[pvals->point_idx].p_x = path_ptr->p_x;
pvals->point[pvals->point_idx].p_y = path_ptr->p_y;
pvals->point[pvals->point_idx].opacity = path_ptr->opacity;
@ -1712,7 +1552,7 @@ p_points_to_tab(t_mov_path_preview *path_ptr)
&& (pvals->point_idx != 0)
&& (pvals->point_idx != pvals->point_idx_max))
{
pvals->point[pvals->point_idx].keyframe = p_conv_keyframe_to_rel(path_ptr->keyframe_abs);
pvals->point[pvals->point_idx].keyframe = p_conv_keyframe_to_rel(path_ptr->keyframe_abs, pvals);
}
else
{
@ -1774,72 +1614,9 @@ void p_reset_points()
void p_load_points(char *filename)
{
#define POINT_REC_MAX 128
FILE *l_fp;
gint l_idx;
char l_buff[POINT_REC_MAX +1 ];
char *l_ptr;
gint l_cnt;
gint l_v1, l_v2, l_v3, l_v4, l_v5, l_v6, l_v7;
if(filename == NULL) return;
l_fp = fopen(filename, "r");
if(l_fp != NULL)
if (p_gap_load_pointfile(filename, pvals) < -1)
{
l_idx = -1;
while (NULL != fgets (l_buff, POINT_REC_MAX, l_fp))
{
/* skip leading blanks */
l_ptr = l_buff;
while(*l_ptr == ' ') { l_ptr++; }
/* check if line empty or comment only (starts with '#') */
if((*l_ptr != '#') && (*l_ptr != '\n') && (*l_ptr != '\0'))
{
l_cnt = sscanf(l_ptr, "%d%d%d%d%d%d%d", &l_v1, &l_v2, &l_v3, &l_v4, &l_v5, &l_v6, &l_v7);
if(l_idx == -1)
{
if((l_cnt < 2) || (l_v2 > GAP_MOV_MAX_POINT) || (l_v1 > l_v2))
{
break;
}
pvals->point_idx = l_v1;
pvals->point_idx_max = l_v2 -1;
l_idx = 0;
}
else
{
if((l_cnt != 6) && (l_cnt != 7))
{
p_reset_points();
break;
}
pvals->point[l_idx].p_x = l_v1;
pvals->point[l_idx].p_y = l_v2;
pvals->point[l_idx].w_resize = l_v3;
pvals->point[l_idx].h_resize = l_v4;
pvals->point[l_idx].opacity = l_v5;
pvals->point[l_idx].rotation = l_v6;
if((l_cnt == 7) && (l_idx > 0))
{
pvals->point[l_idx].keyframe = l_v7;
pvals->point[l_idx].keyframe_abs = p_conv_keyframe_to_abs(l_v7);
}
else
{
pvals->point[l_idx].keyframe_abs = 0;
pvals->point[l_idx].keyframe = 0;
}
l_idx ++;
}
if(l_idx > pvals->point_idx_max) break;
}
}
fclose(l_fp);
p_reset_points();
}
}
@ -1848,56 +1625,13 @@ void p_load_points(char *filename)
* save point table (from global pvals into named file)
* ============================================================================
*/
void p_save_points(char *filename)
static void
p_save_points(char *filename)
{
FILE *l_fp;
gint l_idx;
if(filename == NULL) return;
l_fp = fopen(filename, "w+");
if(l_fp != NULL)
{
fprintf(l_fp, "# GAP file contains saved Move Path Point Table\n");
fprintf(l_fp, "%d %d # current_point points\n",
(int)pvals->point_idx,
(int)pvals->point_idx_max + 1);
fprintf(l_fp, "# x y width height opacity rotation\n");
for(l_idx = 0; l_idx <= pvals->point_idx_max; l_idx++)
{
if((l_idx > 0)
&& (l_idx < pvals->point_idx_max)
&& ((int)pvals->point[l_idx].keyframe > 0))
{
fprintf(l_fp, "%04d %04d %03d %03d %03d %d %d\n",
(int)pvals->point[l_idx].p_x,
(int)pvals->point[l_idx].p_y,
(int)pvals->point[l_idx].w_resize,
(int)pvals->point[l_idx].h_resize,
(int)pvals->point[l_idx].opacity,
(int)pvals->point[l_idx].rotation,
(int)p_conv_keyframe_to_rel(pvals->point[l_idx].keyframe_abs));
}
else
{
fprintf(l_fp, "%04d %04d %03d %03d %03d %d\n",
(int)pvals->point[l_idx].p_x,
(int)pvals->point[l_idx].p_y,
(int)pvals->point[l_idx].w_resize,
(int)pvals->point[l_idx].h_resize,
(int)pvals->point[l_idx].opacity,
(int)pvals->point[l_idx].rotation);
}
}
fclose(l_fp);
}
p_gap_save_pointfile(filename, pvals);
} /* end p_save_points */
/* ============================================================================
* Create new source selection table Frame, and return it.
* A frame that contains:
@ -2201,8 +1935,7 @@ mov_path_prevw_create ( GimpDrawable *drawable, t_mov_path_preview *path_ptr)
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
&path_ptr->rotation);
path_ptr->rotation_adj = GTK_ADJUSTMENT(adj);
gtk_widget_show( table );
/* Keyframe */
adj = gimp_scale_entry_new( GTK_TABLE (table), 3, 3, /* table col, row */
@ -2220,7 +1953,7 @@ mov_path_prevw_create ( GimpDrawable *drawable, t_mov_path_preview *path_ptr)
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
&path_ptr->keyframe_abs);
path_ptr->keyframe_adj = GTK_ADJUSTMENT(adj);
gtk_widget_show( table );
@ -2920,90 +2653,14 @@ p_chk_keyframes(t_mov_path_preview *path_ptr)
#define ARGC_ERRWINDOW 2
static t_arr_arg argv[ARGC_APV];
gint l_affected_frames;
gint l_idx;
gint l_errcount;
gint l_prev_keyframe;
gint l_prev_frame;
gchar *l_err;
gchar *l_err_lbltext;
static t_but_arg b_argv[2];
static gint keychk_locked = FALSE;
p_points_to_tab(path_ptr);
l_affected_frames = 1 + MAX(pvals->dst_range_start, pvals->dst_range_end)
- MIN(pvals->dst_range_start, pvals->dst_range_end);
l_errcount = 0;
l_prev_keyframe = 0;
l_prev_frame = 0;
l_err_lbltext = g_strdup("\0");
for(l_idx = 0; l_idx < pvals->point_idx_max; l_idx++ )
{
if(pvals->point[l_idx].keyframe_abs != 0)
{
pvals->point[l_idx].keyframe = p_conv_keyframe_to_rel(pvals->point[l_idx].keyframe_abs);
if(pvals->point[l_idx].keyframe > l_affected_frames - 2)
{
l_err = g_strdup_printf(_("\nError: Keyframe %d at point [%d] higher or equal than last handled frame")
, pvals->point[l_idx].keyframe_abs, l_idx+1);
l_err_lbltext = g_strdup_printf("%s%s", l_err_lbltext, l_err);
g_free(l_err);
l_errcount++;
}
if(pvals->point[l_idx].keyframe < l_prev_frame)
{
l_err = g_strdup_printf(_("\nError: Keyframe %d at point [%d] leaves not enough space (frames)"
"\nfor the previous controlpoints")
, pvals->point[l_idx].keyframe_abs, l_idx+1);
l_err_lbltext = g_strdup_printf("%s%s", l_err_lbltext, l_err);
g_free(l_err);
l_errcount++;
}
if(pvals->point[l_idx].keyframe <= l_prev_keyframe)
{
l_err = g_strdup_printf(_("\nError: Keyframe %d is not in sequence at point [%d]")
, pvals->point[l_idx].keyframe_abs, l_idx+1);
l_err_lbltext = g_strdup_printf("%s%s", l_err_lbltext, l_err);
g_free(l_err);
l_errcount++;
}
l_prev_keyframe = pvals->point[l_idx].keyframe;
if(l_prev_keyframe > l_prev_frame)
{
l_prev_frame = l_prev_keyframe +1;
}
}
else
{
l_prev_frame++;
if(l_prev_frame +1 > l_affected_frames)
{
l_err = g_strdup_printf(_("\nError: controlpoint [%d] is out of handled framerange"), l_idx+1);
l_err_lbltext = g_strdup_printf("%s%s", l_err_lbltext, l_err);
g_free(l_err);
l_errcount++;
}
}
if(l_errcount > 10)
{
break;
}
}
if(pvals->point_idx_max + 1 > l_affected_frames)
{
l_err = g_strdup_printf(_("\nError: more controlpoints (%d) than handled frames (%d)"
"\nplease reduce controlpoints or select more frames"),
(int)pvals->point_idx_max+1, (int)l_affected_frames);
l_err_lbltext = g_strdup_printf("%s%s", l_err_lbltext, l_err);
g_free(l_err);
}
l_err_lbltext = p_gap_chk_keyframes(pvals);
if(*l_err_lbltext != '\0')
{
@ -3047,17 +2704,15 @@ p_chk_keyframes(t_mov_path_preview *path_ptr)
return(TRUE);
} /* end p_chk_keyframes */
/* ============================================================================
* p_get_flattened_drawable
* p_get_flattened_layer
* flatten the given image and return pointer to the
* (only) remaining drawable.
* ============================================================================
*/
GimpDrawable *
p_get_flattened_drawable(gint32 image_id)
gint32
p_get_flattened_layer(gint32 image_id, GimpMergeType mergemode)
{
GimpDrawable *l_drawable_ptr ;
GimpImageBaseType l_type;
guint l_width, l_height;
gint32 l_layer_id;
@ -3085,7 +2740,21 @@ p_get_flattened_drawable(gint32 image_id)
0); /* NORMAL */
gimp_image_add_layer(image_id, l_layer_id, 0);
l_drawable_ptr = gimp_drawable_get (gimp_image_merge_visible_layers (image_id, GIMP_CLIP_TO_IMAGE));
return gimp_image_merge_visible_layers (image_id, mergemode);
} /* end p_get_flattened_layer */
/* ============================================================================
* p_get_flattened_drawable
* flatten the given image and return pointer to the
* (only) remaining drawable.
* ============================================================================
*/
GimpDrawable *
p_get_flattened_drawable(gint32 image_id)
{
GimpDrawable *l_drawable_ptr ;
l_drawable_ptr = gimp_drawable_get (p_get_flattened_layer(image_id, GIMP_CLIP_TO_IMAGE));
return l_drawable_ptr;
} /* end p_get_flattened_drawable */
@ -3113,13 +2782,6 @@ p_get_prevw_drawable (t_mov_path_preview *path_ptr)
/* calculate current settings */
l_curr.dst_frame_nr = 0;
l_curr.deltaX = 0.0;
l_curr.deltaY = 0.0;
l_curr.deltaOpacity = 0.0;
l_curr.deltaWidth = 0.0;
l_curr.deltaHeight = 0.0;
l_curr.deltaRotation = 0.0;
l_curr.currX = (gdouble)path_ptr->p_x;
l_curr.currY = (gdouble)path_ptr->p_y;
@ -3141,8 +2803,13 @@ p_get_prevw_drawable (t_mov_path_preview *path_ptr)
if(l_curr.src_layers[l_curr.src_layer_idx] == pvals->src_layer_id)
break;
}
}
if(pvals->src_stepmode >= GAP_STEP_FRAME)
{
p_fetch_src_frame (pvals, -1); /* negative value fetches the selected frame number */
}
/* set offsets (in cur_ptr)
* according to handle_mode and src_img dimension (pvals)
*/
@ -3152,6 +2819,7 @@ p_get_prevw_drawable (t_mov_path_preview *path_ptr)
p_mov_render(pvals->tmp_image_id, pvals, &l_curr);
if(l_curr.src_layers != NULL) g_free(l_curr.src_layers);
l_curr.src_layers = NULL;
}
/* flatten image, and get the (only) resulting drawable */
@ -3170,8 +2838,18 @@ void p_set_handle_offsets(t_mov_values *val_ptr, t_mov_current *cur_ptr)
guint l_src_width, l_src_height; /* dimensions of the source image */
/* get dimensions of source image */
l_src_width = gimp_image_width(val_ptr->src_image_id);
l_src_height = gimp_image_height(val_ptr->src_image_id);
if((val_ptr->src_stepmode < GAP_STEP_FRAME)
|| (val_ptr->cache_tmp_image_id < 0))
{
l_src_width = gimp_image_width(val_ptr->src_image_id);
l_src_height = gimp_image_height(val_ptr->src_image_id);
}
else
{
/* for Frame Based Modes use the cached tmp image */
l_src_width = gimp_image_width(val_ptr->cache_tmp_image_id);
l_src_height = gimp_image_height(val_ptr->cache_tmp_image_id);
}
cur_ptr->l_handleX = 0.0;
cur_ptr->l_handleY = 0.0;
@ -3232,7 +2910,8 @@ p_mov_render(gint32 image_id, t_mov_values *val_ptr, t_mov_current *cur_ptr)
if(gap_debug) printf("p_mov_render: frame/layer: %ld/%ld X=%f, Y=%f\n"
" Width=%f Height=%f\n"
" Opacity=%f Rotate=%f clip_to_img = %d force_visibility = %d\n",
" Opacity=%f Rotate=%f clip_to_img = %d force_visibility = %d\n"
" src_stepmode = %d\n",
cur_ptr->dst_frame_nr, cur_ptr->src_layer_idx,
cur_ptr->currX, cur_ptr->currY,
cur_ptr->currWidth,
@ -3240,25 +2919,42 @@ p_mov_render(gint32 image_id, t_mov_values *val_ptr, t_mov_current *cur_ptr)
cur_ptr->currOpacity,
cur_ptr->currRotation,
val_ptr->clip_to_img,
val_ptr->src_force_visible);
val_ptr->src_force_visible,
val_ptr->src_stepmode);
if(gap_debug)
if(val_ptr->src_stepmode < GAP_STEP_FRAME)
{
printf("p_mov_render: Before p_my_layer_copy image_id:%d src_layer_id:%d\n"
,(int)image_id, (int)cur_ptr->src_layers[cur_ptr->src_layer_idx]);
}
/* make a copy of the current source layer
* (using current opacity & paintmode values)
*/
l_cp_layer_id = p_my_layer_copy(image_id,
if(gap_debug)
{
printf("p_mov_render: Before p_my_layer_copy image_id:%d src_layer_id:%d\n"
,(int)image_id, (int)cur_ptr->src_layers[cur_ptr->src_layer_idx]);
}
/* make a copy of the current source layer
* (using current opacity & paintmode values)
*/
l_cp_layer_id = p_my_layer_copy(image_id,
cur_ptr->src_layers[cur_ptr->src_layer_idx],
cur_ptr->currOpacity,
val_ptr->src_paintmode,
&l_src_offset_x,
&l_src_offset_y);
}
else
{
if(gap_debug)
{
printf("p_mov_render: Before p_my_layer_copy image_id:%d cache_tmp_layer_id:%d\n"
,(int)image_id, (int)val_ptr->cache_tmp_layer_id);
}
/* for FRAME based stepmodes use the flattened layer in the cahed frame image */
l_cp_layer_id = p_my_layer_copy(image_id,
val_ptr->cache_tmp_layer_id,
cur_ptr->currOpacity,
val_ptr->src_paintmode,
&l_src_offset_x,
&l_src_offset_y);
}
/* add the copied layer to current destination image */
if(gap_debug) printf("p_mov_render: after layer copy layer_id=%d\n", (int)l_cp_layer_id);
@ -3425,3 +3121,150 @@ p_buildmenu (MenuItem *items)
return menu;
} /* end p_buildmenu */
/* ============================================================================
* p_fetch_src_frame
* fetch the requested AnimFrame SourceImage into cache_tmp_image_id
* and
* - reduce all visible layer to one layer (cache_tmp_layer_id)
* - (scale to animated preview size if called for AnimPreview )
* - reuse cached image (for subsequent calls for the same framenumber
* of the same source image -- for GAP_STEP_FRAME_NONE
* - never load current frame number from diskfile (use duplicate of the src_image)
* returns 0 (OK) or -1 (on Errors)
* ============================================================================
*/
gint
p_fetch_src_frame(t_mov_values *pvals, gint32 wanted_frame_nr)
{
t_anim_info *l_ainfo_ptr;
t_anim_info *l_old_ainfo_ptr;
if(gap_debug)
{
printf("p_fetch_src_frame: START src_image_id: %d wanted_frame_nr:%d"
" cache_src_image_id:%d cache_frame_number:%d\n"
, (int)pvals->src_image_id
, (int)wanted_frame_nr
, (int)pvals->cache_src_image_id
, (int)pvals->cache_frame_number
);
}
if(pvals->src_image_id < 0)
{
return -1;
}
if((pvals->src_image_id != pvals->cache_src_image_id)
|| (wanted_frame_nr != pvals->cache_frame_number))
{
if(pvals->cache_tmp_image_id >= 0)
{
if(gap_debug)
{
printf("p_fetch_src_frame: DELETE cache_tmp_image_id:%d\n",
(int)pvals->cache_tmp_image_id);
}
/* destroy the cached frame image */
gimp_image_delete(pvals->cache_tmp_image_id);
pvals->cache_tmp_image_id = -1;
}
l_ainfo_ptr = p_alloc_ainfo(pvals->src_image_id, GIMP_RUN_NONINTERACTIVE);
if(pvals->cache_ainfo_ptr == NULL)
{
pvals->cache_ainfo_ptr = l_ainfo_ptr;
}
else
{
if ((pvals->src_image_id == pvals->cache_src_image_id)
&& (strcmp(pvals->cache_ainfo_ptr->basename, l_ainfo_ptr->basename) == 0))
{
pvals->cache_ainfo_ptr->curr_frame_nr = l_ainfo_ptr->curr_frame_nr;
p_free_ainfo(&l_ainfo_ptr);
}
else
{
/* update cached ainfo if source image has changed
* (either by id or by its basename)
*/
l_old_ainfo_ptr = pvals->cache_ainfo_ptr;
pvals->cache_ainfo_ptr = l_ainfo_ptr;
p_free_ainfo(&l_old_ainfo_ptr);
}
}
if ((wanted_frame_nr == pvals->cache_ainfo_ptr->curr_frame_nr)
|| (wanted_frame_nr < 0))
{
/* always take the current source frame from the already opened image
* not only for speedup reasons. (the diskfile may contain non actual imagedata)
*/
pvals->cache_tmp_image_id = p_gimp_channel_ops_duplicate(pvals->src_image_id);
wanted_frame_nr = pvals->cache_ainfo_ptr->curr_frame_nr;
}
else
{
/* build the source framename */
if(pvals->cache_ainfo_ptr->new_filename != NULL)
{
g_free(pvals->cache_ainfo_ptr->new_filename);
}
pvals->cache_ainfo_ptr->new_filename = p_alloc_fname(pvals->cache_ainfo_ptr->basename,
wanted_frame_nr,
pvals->cache_ainfo_ptr->extension);
if(pvals->cache_ainfo_ptr->new_filename == NULL)
{
printf("gap: error got no source frame filename\n");
return -1;
}
/* load the wanted source frame */
pvals->cache_tmp_image_id = p_load_image(pvals->cache_ainfo_ptr->new_filename);
if(pvals->cache_tmp_image_id < 0)
{
printf("gap: load error on src image %s\n", pvals->cache_ainfo_ptr->new_filename);
return -1;
}
}
pvals->cache_tmp_layer_id = p_get_flattened_layer(pvals->cache_tmp_image_id, GIMP_EXPAND_AS_NECESSARY);
/* check if we are generating an anim preview
* where we must Scale (down) the src image to preview size
*/
if ((pvals->apv_mlayer_image >= 0)
&& ((pvals->apv_scalex != 100.0) || (pvals->apv_scaley != 100.0)))
{
GimpParam *l_params;
gint l_retvals;
gint32 l_size_x, l_size_y;
if(gap_debug)
{
printf("p_fetch_src_frame: Scale for Animpreview apv_scalex %f apv_scaley %f\n"
, (float)pvals->apv_scalex, (float)pvals->apv_scaley );
}
l_size_x = (gimp_image_width(pvals->cache_tmp_image_id) * pvals->apv_scalex) / 100;
l_size_y = (gimp_image_height(pvals->cache_tmp_image_id) * pvals->apv_scaley) / 100;
l_params = gimp_run_procedure ("gimp_image_scale",
&l_retvals,
GIMP_PDB_IMAGE, pvals->cache_tmp_image_id,
GIMP_PDB_INT32, l_size_x,
GIMP_PDB_INT32, l_size_y,
GIMP_PDB_END);
}
pvals->cache_src_image_id = pvals->src_image_id;
pvals->cache_frame_number = wanted_frame_nr;
}
return 0; /* OK */
} /* end p_fetch_src_frame */

View File

@ -27,6 +27,8 @@
#define _GAP_MOV_DIALOG_H
/* revision history:
* gimp 1.1.29b; 2000/11/19 hof: new feature: FRAME based Stepmodes,
* increased controlpoint Limit GAP_MOV_MAX_POINT (from 256 -> 1024)
* gimp 1.1.20a; 2000/04/25 hof: support for keyframes, anim_preview
* version 0.96.02; 1998.07.25 hof: added clip_to_img
*/
@ -38,9 +40,17 @@ typedef enum
GAP_STEP_ONCE = 2,
GAP_STEP_ONCE_REV = 3,
GAP_STEP_PING_PONG = 4,
GAP_STEP_NONE = 5
GAP_STEP_NONE = 5,
GAP_STEP_FRAME_LOOP = 100,
GAP_STEP_FRAME_LOOP_REV = 101,
GAP_STEP_FRAME_ONCE = 102,
GAP_STEP_FRAME_ONCE_REV = 103,
GAP_STEP_FRAME_PING_PONG = 104,
GAP_STEP_FRAME_NONE = 105
} t_mov_stepmodes;
#define GAP_STEP_FRAME GAP_STEP_FRAME_LOOP
typedef enum
{
GAP_HANDLE_LEFT_TOP = 0,
@ -59,22 +69,18 @@ typedef enum
typedef struct {
long dst_frame_nr; /* current destination frame_nr */
long src_layer_idx; /* index of current layer */
gint32 *src_layers; /* array of source images layer id's */
long src_last_layer; /* index of last layer 0 upto n-1 */
long src_layer_idx; /* index of current layer (used for multilayer stepmodes) */
long src_frame_idx; /* current frame number (used for source frame stepmodes) */
gint32 *src_layers; /* array of source images layer id's (used for multilayer stepmodes) */
long src_last_layer; /* index of last layer 0 upto n-1 (used for multilayer stepmodes) */
gdouble currX, currY;
gdouble deltaX, deltaY;
gint l_handleX;
gint l_handleY;
gdouble currOpacity;
gdouble deltaOpacity;
gdouble currWidth;
gdouble deltaWidth;
gdouble currHeight;
gdouble deltaHeight;
gdouble currRotation;
gdouble deltaRotation;
} t_mov_current;
typedef struct {
@ -88,7 +94,7 @@ typedef struct {
gint keyframe;
} t_mov_point;
#define GAP_MOV_MAX_POINT 256
#define GAP_MOV_MAX_POINT 1024
/*
* Notes:
@ -117,7 +123,6 @@ typedef struct {
gint dst_range_start; /* use current frame as default */
gint dst_range_end;
gint dst_layerstack;
gint dst_combination_mode; /* GimpLayerModeEffects */
/* for dialog only */
gint32 dst_image_id; /* frame image */
@ -141,6 +146,13 @@ typedef struct {
gdouble apv_scalex;
gdouble apv_scaley;
/* for FRAME based stepmodes */
gint32 cache_src_image_id; /* id of the source image (from where cache image was copied) */
gint32 cache_tmp_image_id; /* id of a cached flattened copy of the src image */
gint32 cache_tmp_layer_id; /* the only visible layer in the cached image */
gint32 cache_frame_number;
t_anim_info *cache_ainfo_ptr;
} t_mov_values;
typedef struct {
@ -151,5 +163,7 @@ typedef struct {
long p_move_dialog (t_mov_data *mov_ptr);
void p_set_handle_offsets(t_mov_values *val_ptr, t_mov_current *cur_ptr);
int p_mov_render(gint32 image_id, t_mov_values *val_ptr, t_mov_current *cur_ptr);
gint32 p_get_flattened_layer (gint32 image_id, GimpMergeType mergemode);
gint p_fetch_src_frame(t_mov_values *pvals, gint32 wanted_frame_nr);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@
*/
/* revision history:
* gimp 1.1.29b; 2000/11/25 hof: NONINTEACTIV PDB interface for Movepath
* gimp 1.1.20a; 2000/04/25 hof: support for keyframes, anim_preview
* 0.96.00; 1998/06/27 hof: added gap animation sizechange plugins
* (moved range_ops to seperate .h file)
@ -38,8 +39,16 @@
#include "libgimp/gimp.h"
#include "gap_mov_dialog.h"
int gap_move(GimpRunModeType run_mode, gint32 image_id);
gint32 p_mov_anim_preview(t_mov_values *pvals_orig, t_anim_info *ainfo_ptr, gint preview_frame_nr);
int gap_move_path(GimpRunModeType run_mode, gint32 image_id, t_mov_values *pvals, gchar *pointfile, gint rotation_follow, gint32 startangle);
gint32 p_mov_anim_preview(t_mov_values *pvals_orig, t_anim_info *ainfo_ptr, gint preview_frame_nr);
gchar *p_gap_chk_keyframes(t_mov_values *pvals);
gint p_conv_keyframe_to_rel(gint abs_keyframe, t_mov_values *pvals);
gint p_conv_keyframe_to_abs(gint rel_keyframe, t_mov_values *pvals);
gint p_gap_save_pointfile(char *filename, t_mov_values *pvals);
gint p_gap_load_pointfile(char *filename, t_mov_values *pvals);
void p_calculate_rotate_follow(t_mov_values *pvals, gint32 startangle);
#endif

View File

@ -70,11 +70,12 @@
/* revision history:
* version 1.1.29b; 2000.11.30 hof: new e-mail adress
* version 1.1.20a; 2000.04.25 hof: copy/cut/paste menu
* version 1.1.14a; 2000.01.08 hof: 1st release
*/
static char *gap_navigator_version = "1.1.19a; 2000/04/24";
static char *gap_navigator_version = "1.1.29b; 2000/11/30";
/* SYTEM (UNIX) includes */
@ -456,7 +457,7 @@ query ()
gimp_install_procedure(PLUGIN_NAME,
"GAP video navigator dialog",
"",
"Wolfgang Hofer (hof@hotbot.com)",
"Wolfgang Hofer (hof@gimp.org)",
"Wolfgang Hofer",
gap_navigator_version,
N_("<Image>/Video/VCR Navigator..."),
@ -884,7 +885,7 @@ void navi_reload_ainfo_force(gint32 image_id)
if(naviD->framerange_number_label)
{
sprintf(frame_nr_to_char, "%04d - %04d"
g_snprintf(frame_nr_to_char, sizeof(frame_nr_to_char), "%04d - %04d"
, (int)naviD->ainfo_ptr->first_frame_nr
, (int)naviD->ainfo_ptr->last_frame_nr );
gtk_label_set_text (GTK_LABEL (naviD->framerange_number_label),
@ -1398,7 +1399,7 @@ static void navi_playback(gint32 optimize)
if(naviD->vin_ptr->framerate > 0)
{
l_frame_delay = 1000 / naviD->vin_ptr->framerate;
sprintf(l_frame_name, "frame_[####] (%dms)", (int)l_frame_delay);
g_snprintf(l_frame_name, sizeof(l_frame_name), "frame_[####] (%dms)", (int)l_frame_delay);
}
}
@ -2671,7 +2672,7 @@ navi_preview_extents (void)
}
static void
navi_calc_frametiming(gint32 frame_nr, char *buf)
navi_calc_frametiming(gint32 frame_nr, char *buf, gint32 sizeof_buf)
{
gint32 first;
gdouble msec_per_frame;
@ -2688,13 +2689,13 @@ navi_calc_frametiming(gint32 frame_nr, char *buf)
if(naviD->vin_ptr == NULL)
{
sprintf(buf, "min:sec:msec");
g_snprintf(buf, sizeof_buf, "min:sec:msec");
return;
}
if(naviD->vin_ptr->framerate < 1)
{
sprintf(buf, "min:sec:msec");
g_snprintf(buf, sizeof_buf, "min:sec:msec");
return;
}
@ -2705,7 +2706,7 @@ navi_calc_frametiming(gint32 frame_nr, char *buf)
tsec = (tmsec / 1000) % 60;
tmin = tmsec / 60000;
sprintf(buf, "%02d:%02d:%03d", (int)tmin, (int)tsec, (int)tms);
g_snprintf(buf, sizeof_buf, "%02d:%02d:%03d", (int)tmin, (int)tsec, (int)tms);
}
static void
@ -2713,7 +2714,7 @@ frame_widget_time_label_update(FrameWidget *fw)
{
char frame_nr_to_time[20];
navi_calc_frametiming(fw->frame_nr, frame_nr_to_time);
navi_calc_frametiming(fw->frame_nr, frame_nr_to_time, sizeof(frame_nr_to_time));
gtk_label_set_text (GTK_LABEL (fw->time_label), frame_nr_to_time);
}
@ -2749,8 +2750,8 @@ frame_widget_create (gint32 image_id, gint32 frame_nr)
frame_widget->visited = TRUE;
/* frame_widget->drop_type = GIMP_DROP_NONE; */
sprintf(frame_nr_to_char, "%04d", (int)frame_nr);
navi_calc_frametiming(frame_nr, frame_nr_to_time);
g_snprintf(frame_nr_to_char, sizeof(frame_nr_to_char), "%04d", (int)frame_nr);
navi_calc_frametiming(frame_nr, frame_nr_to_time, sizeof(frame_nr_to_time));
/* Need to let the list item know about the frame_widget */
@ -2864,7 +2865,7 @@ navi_dialog_create (GtkWidget* shell, gint32 image_id)
return naviD->vbox;
}
l_basename = NULL;
sprintf(frame_nr_to_char, "0000 - 0000");
g_snprintf(frame_nr_to_char, sizeof(frame_nr_to_char), "0000 - 0000");
naviD = g_new (NaviDialog, 1);
naviD->waiting_cursor = FALSE;
naviD->cursor_wait = gdk_cursor_new (GDK_WATCH);
@ -2884,7 +2885,7 @@ navi_dialog_create (GtkWidget* shell, gint32 image_id)
navi_reload_ainfo_force(image_id);
if(naviD->ainfo_ptr != NULL)
{
sprintf(frame_nr_to_char, "%04d - %04d"
g_snprintf(frame_nr_to_char, sizeof(frame_nr_to_char), "%04d - %04d"
, (int)naviD->ainfo_ptr->first_frame_nr
, (int)naviD->ainfo_ptr->last_frame_nr);
l_basename = naviD->ainfo_ptr->basename;

View File

@ -123,7 +123,7 @@ resize_widget_new (ResizeType type,
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
/* the width label and entry */
sprintf (size, "%d", width);
g_snprintf (size, sizeof(size), "%d", width);
label = gtk_label_new ( _("New width:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
@ -140,7 +140,7 @@ resize_widget_new (ResizeType type,
gtk_widget_show (private->width_text);
/* the height label and entry */
sprintf (size, "%d", height);
g_snprintf (size, sizeof(size), "%d", height);
label = gtk_label_new ( _("New height:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
@ -157,7 +157,7 @@ resize_widget_new (ResizeType type,
gtk_widget_show (private->height_text);
/* the x scale ratio label and entry */
sprintf (ratio_text, "%0.4f", resize->ratio_x);
g_snprintf (ratio_text, sizeof(ratio_text), "%0.4f", resize->ratio_x);
label = gtk_label_new ( _("X ratio:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
@ -174,7 +174,7 @@ resize_widget_new (ResizeType type,
gtk_widget_show (private->ratio_x_text);
/* the y scale ratio label and entry */
sprintf (ratio_text, "%0.4f", resize->ratio_y);
g_snprintf (ratio_text, sizeof(ratio_text), "%0.4f", resize->ratio_y);
label = gtk_label_new ( _("Y ratio:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
@ -193,7 +193,7 @@ resize_widget_new (ResizeType type,
if (type == ResizeWidget)
{
/* the off_x label and entry */
sprintf (size, "%d", 0);
g_snprintf (size, sizeof(size), "%d", 0);
label = gtk_label_new ( _("X Offset:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
@ -210,7 +210,7 @@ resize_widget_new (ResizeType type,
gtk_widget_show (private->off_x_text);
/* the off_y label and entry */
sprintf (size, "%d", 0);
g_snprintf (size, sizeof(size), "%d", 0);
label = gtk_label_new ( _("Y Offset:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6,
@ -479,7 +479,7 @@ width_update (GtkWidget *w,
ratio = (double) resize->width / (double) private->old_width;
resize->ratio_x = ratio;
sprintf (ratio_text, "%0.4f", ratio);
g_snprintf (ratio_text, sizeof(ratio_text), "%0.4f", ratio);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->ratio_x_text), data);
gtk_entry_set_text (GTK_ENTRY (private->ratio_x_text), ratio_text);
@ -488,7 +488,7 @@ width_update (GtkWidget *w,
if (resize->type == ResizeWidget)
{
resize->off_x = resize_bound_off_x (resize, (resize->width - private->old_width) / 2);
sprintf (size, "%d", resize->off_x);
g_snprintf (size, sizeof(size), "%d", resize->off_x);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->off_x_text), data);
gtk_entry_set_text (GTK_ENTRY (private->off_x_text), size);
@ -504,7 +504,7 @@ width_update (GtkWidget *w,
if (new_height != resize->height)
{
resize->height = new_height;
sprintf (size, "%d", resize->height);
g_snprintf (size, sizeof(size), "%d", resize->height);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->height_text), data);
gtk_entry_set_text (GTK_ENTRY (private->height_text), size);
@ -519,7 +519,7 @@ width_update (GtkWidget *w,
if (resize->type == ResizeWidget)
{
resize->off_y = resize_bound_off_y (resize, (resize->height - private->old_height) / 2);
sprintf (size, "%d", resize->off_y);
g_snprintf (size, sizeof(size), "%d", resize->off_y);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->off_y_text), data);
gtk_entry_set_text (GTK_ENTRY (private->off_y_text), size);
@ -553,7 +553,7 @@ height_update (GtkWidget *w,
ratio = (double) resize->height / (double) private->old_height;
resize->ratio_y = ratio;
sprintf (ratio_text, "%0.4f", ratio);
g_snprintf (ratio_text, sizeof(ratio_text), "%0.4f", ratio);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->ratio_y_text), data);
gtk_entry_set_text (GTK_ENTRY (private->ratio_y_text), ratio_text);
@ -561,7 +561,7 @@ height_update (GtkWidget *w,
if (resize->type == ResizeWidget)
{
resize->off_y = resize_bound_off_y (resize, (resize->height - private->old_height) / 2);
sprintf (size, "%d", resize->off_y);
g_snprintf (size, sizeof(size), "%d", resize->off_y);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->off_y_text), data);
gtk_entry_set_text (GTK_ENTRY (private->off_y_text), size);
@ -578,7 +578,7 @@ height_update (GtkWidget *w,
if (new_width != resize->width)
{
resize->width = new_width;
sprintf (size, "%d", resize->width);
g_snprintf (size, sizeof(size), "%d", resize->width);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->width_text), data);
gtk_entry_set_text (GTK_ENTRY (private->width_text), size);
@ -593,7 +593,7 @@ height_update (GtkWidget *w,
if (resize->type == ResizeWidget)
{
resize->off_x = resize_bound_off_x (resize, (resize->width - private->old_width) / 2);
sprintf (size, "%d", resize->off_x);
g_snprintf (size, sizeof(size), "%d", resize->off_x);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->off_x_text), data);
gtk_entry_set_text (GTK_ENTRY (private->off_x_text), size);
@ -630,7 +630,7 @@ ratio_x_update (GtkWidget *w,
if (new_width != resize->width)
{
resize->width = new_width;
sprintf (size, "%d", new_width);
g_snprintf (size, sizeof(size), "%d", new_width);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->width_text), data);
gtk_entry_set_text (GTK_ENTRY (private->width_text), size);
@ -639,7 +639,7 @@ ratio_x_update (GtkWidget *w,
if (resize->type == ResizeWidget)
{
resize->off_x = resize_bound_off_x (resize, (resize->width - private->old_width) / 2);
sprintf (size, "%d", resize->off_x);
g_snprintf (size, sizeof(size), "%d", resize->off_x);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->off_x_text), data);
gtk_entry_set_text (GTK_ENTRY (private->off_x_text), size);
@ -660,13 +660,13 @@ ratio_x_update (GtkWidget *w,
{
resize->height = new_height;
sprintf (size, "%d", resize->height);
g_snprintf (size, sizeof(size), "%d", resize->height);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->height_text), data);
gtk_entry_set_text (GTK_ENTRY (private->height_text), size);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (private->height_text), data);
sprintf (ratio_text, "%0.4f", resize->ratio_y);
g_snprintf (ratio_text, sizeof(ratio_text), "%0.4f", resize->ratio_y);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->ratio_y_text), data);
gtk_entry_set_text (GTK_ENTRY (private->ratio_y_text), ratio_text);
@ -675,7 +675,7 @@ ratio_x_update (GtkWidget *w,
if (resize->type == ResizeWidget)
{
resize->off_y = resize_bound_off_y (resize, (resize->height - private->old_height) / 2);
sprintf (size, "%d", resize->off_y);
g_snprintf (size, sizeof(size), "%d", resize->off_y);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->off_y_text), data);
gtk_entry_set_text (GTK_ENTRY (private->off_y_text), size);
@ -712,7 +712,7 @@ ratio_y_update (GtkWidget *w,
if (new_height != resize->height)
{
resize->height = new_height;
sprintf (size, "%d", new_height);
g_snprintf (size, sizeof(size), "%d", new_height);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->height_text), data);
gtk_entry_set_text (GTK_ENTRY (private->height_text), size);
@ -721,7 +721,7 @@ ratio_y_update (GtkWidget *w,
if (resize->type == ResizeWidget)
{
resize->off_y = resize_bound_off_y (resize, (resize->height - private->old_height) / 2);
sprintf (size, "%d", resize->off_y);
g_snprintf (size, sizeof(size), "%d", resize->off_y);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->off_y_text), data);
gtk_entry_set_text (GTK_ENTRY (private->off_y_text), size);
@ -742,13 +742,13 @@ ratio_y_update (GtkWidget *w,
{
resize->width = new_width;
sprintf (size, "%d", resize->width);
g_snprintf (size, sizeof(size), "%d", resize->width);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->width_text), data);
gtk_entry_set_text (GTK_ENTRY (private->width_text), size);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (private->width_text), data);
sprintf (ratio_text, "%0.4f", resize->ratio_x);
g_snprintf (ratio_text, sizeof(ratio_text), "%0.4f", resize->ratio_x);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->ratio_x_text), data);
gtk_entry_set_text (GTK_ENTRY (private->ratio_x_text), ratio_text);
@ -757,7 +757,7 @@ ratio_y_update (GtkWidget *w,
if (resize->type == ResizeWidget)
{
resize->off_x = resize_bound_off_x (resize, (resize->width - private->old_width) / 2);
sprintf (size, "%d", resize->off_x);
g_snprintf (size, sizeof(size), "%d", resize->off_x);
gtk_signal_handler_block_by_data (GTK_OBJECT (private->off_x_text), data);
gtk_entry_set_text (GTK_ENTRY (private->off_x_text), size);
@ -804,14 +804,14 @@ resize_events (GtkWidget *widget,
dx = event->motion.x - private->start_x;
off_x = private->orig_x + dx / private->ratio;
off_x = resize_bound_off_x (resize, off_x);
sprintf (size, "%d", off_x);
g_snprintf (size, sizeof(size), "%d", off_x);
gtk_entry_set_text (GTK_ENTRY (private->off_x_text), size);
/* Y offset */
dy = event->motion.y - private->start_y;
off_y = private->orig_y + dy / private->ratio;
off_y = resize_bound_off_y (resize, off_y);
sprintf (size, "%d", off_y);
g_snprintf (size, sizeof(size), "%d", off_y);
gtk_entry_set_text (GTK_ENTRY (private->off_y_text), size);
break;
case GDK_BUTTON_RELEASE:

View File

@ -107,9 +107,9 @@
(script-fu-register "script-fu-selection-to-anim-image"
_"<Image>/Script-Fu/Animators/Selection to AnimImage..."
"Create a multilayer image from current selection and apply any PDB Filter to all layer-copies"
"Wolfgang Hofer <hof@hotbot.com>"
"Wolfgang Hofer <hof@gimp.org>"
"Wolfgang Hofer"
"20/05/98"
"2000/11/30"
"RGB RGBA GRAY GRAYA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0