some small fixes and the new GAP VCR Navigator

--Sven
This commit is contained in:
Sven Neumann 2000-01-10 23:27:25 +00:00
parent 4131ba845f
commit a579edc9ad
31 changed files with 4442 additions and 274 deletions

View File

@ -1,3 +1,35 @@
Tue Jan 11 01:50:41 CET 2000 Sven Neumann <sven@gimp.org>
* libgimp/parasite.c
* app/gimpparasite.c
* app/parasitelist.c: indentation (actually I was searching for a
memleak, but had no luck so far)
* app/blob.c: raise the maximum image size that will make the ink tool
fail to 16384 x 16384 (sort of fixes bug #4464)
* Makefile.am
* pixmaps/first.xpm
* pixmaps/last.xpm
* pixmaps/next.xpm
* pixmaps/play.xpm
* pixmaps/prev.xpm
* pixmaps/update.xpm: new icons
* plug-ins/gap/gap_decode_mpeg_main.c
* plug-ins/gap/gap_decode_xanim.c
* plug-ins/gap/gap_lib.c
* plug-ins/gap/gap_lib.h
* plug-ins/gap/gap_main.c
* plug-ins/gap/gap_pdb_calls.c
* plug-ins/gap/gap_pdb_calls.h
* plug-ins/gap/gap_range_ops.c: changes by Wolfgang Hofer
* plug-ins/gap/Makefile.am
* plug-ins/gap/gap_navigator_dialog.c: new GAP VCR Navigator brought
to you by Wolfgang Hofer <hof@hotbot.com>. Needs some work, but is
already very nice, IMHO
Mon Jan 10 01:13:02 PST 2000 Manish Singh <yosh@gimp.org>
* tools/pdbgen/pdb/gimage.pdb: Made appropriate changes to

View File

@ -41,12 +41,15 @@ EXTRA_DIST = \
pixmaps/duplicate.xpm \
pixmaps/eek.xpm \
pixmaps/eye.xbm \
pixmaps/first.xpm \
pixmaps/last.xpm \
pixmaps/layer.xbm \
pixmaps/linked.xbm \
pixmaps/locked.xbm \
pixmaps/lower.xpm \
pixmaps/mask.xbm \
pixmaps/navbutton.xpm \
pixmaps/next.xpm \
pixmaps/new.xpm \
pixmaps/no.xpm \
pixmaps/raise.xpm \
@ -56,11 +59,14 @@ EXTRA_DIST = \
pixmaps/penedit.xpm \
pixmaps/pennorm.xpm \
pixmaps/penstroke.xpm \
pixmaps/play.xpm \
pixmaps/prev.xpm \
pixmaps/qmasksel.xpm \
pixmaps/qmasknosel.xpm \
pixmaps/question.xpm \
pixmaps/topath.xpm \
pixmaps/toselection.xpm \
pixmaps/update.xpm \
pixmaps/yes.xpm \
pixmaps/zoom_in.xpm \
pixmaps/zoom_out.xpm \

View File

@ -452,9 +452,25 @@ blob_line (Blob *b, int x0, int y0, int x1, int y1)
#define TABLE_SIZE 256
#define ELLIPSE_SHIFT 2
#define TABLE_SHIFT 14
#define TABLE_SHIFT 12
#define TOTAL_SHIFT (ELLIPSE_SHIFT + TABLE_SHIFT)
/*
* The choose of this values limits the maximal image_size to
* 16384 x 16384 pixels. The values will overflow as soon as
* x or y > INT_MAX / (1 << (ELLIPSE_SHIFT + TABLE_SHIFT)) / SUBSAMPLE
*
* Alternatively the code could be change the code as follows:
*
* xc_base = floor (xc)
* xc_shift = 0.5 + (xc - xc_base) * (1 << TOTAL_SHIFT);
*
* gint x = xc_base + (xc_shift + c * xp_shift + s * xq_shift +
* (1 << (TOTAL_SHIFT - 1))) >> TOTAL_SHIFT;
*
* which would change the limit from the image to the ellipse size
*/
static int trig_initialized = 0;
static int trig_table[TABLE_SIZE];

View File

@ -36,30 +36,33 @@ static ParasiteList *parasites = NULL;
void
gimp_init_parasites()
{
g_return_if_fail(parasites == NULL);
parasites = parasite_list_new();
gimp_parasiterc_load();
g_return_if_fail (parasites == NULL);
parasites = parasite_list_new ();
gimp_parasiterc_load ();
}
void
gimp_parasite_attach (Parasite *p)
{
parasite_list_add(parasites, p);
parasite_list_add (parasites, p);
}
void
gimp_parasite_detach (const char *name)
{
parasite_list_remove(parasites, name);
parasite_list_remove (parasites, name);
}
Parasite *
gimp_parasite_find (const char *name)
{
return parasite_list_find(parasites, name);
return parasite_list_find (parasites, name);
}
static void list_func(char *key, Parasite *p, char ***cur)
static void
list_func (char *key,
Parasite *p,
char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
@ -67,7 +70,7 @@ static void list_func(char *key, Parasite *p, char ***cur)
char **
gimp_parasite_list (gint *count)
{
char **list, **cur;
gchar **list, **cur;
*count = parasite_list_length (parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
@ -77,7 +80,10 @@ gimp_parasite_list (gint *count)
return list;
}
static void save_func(char *key, Parasite *p, FILE *fp)
static void
save_func (char *key,
Parasite *p,
FILE *fp)
{
if (parasite_is_persistent (p))
{
@ -115,7 +121,7 @@ static void save_func(char *key, Parasite *p, FILE *fp)
}
void
gimp_parasiterc_save(void)
gimp_parasiterc_save (void)
{
char *filename;
FILE *fp;
@ -135,17 +141,17 @@ gimp_parasiterc_save(void)
fclose (fp);
if (rename(gimp_personal_rc_file ("#parasiterc.tmp~"),
gimp_personal_rc_file("parasiterc")) != 0)
gimp_personal_rc_file ("parasiterc")) != 0)
unlink(gimp_personal_rc_file ("#parasiterc.tmp~"));
}
void
gimp_parasiterc_load()
gimp_parasiterc_load (void)
{
char *filename;
filename = gimp_personal_rc_file ("parasiterc");
app_init_update_status(NULL, filename, -1);
app_init_update_status (NULL, filename, -1);
parse_gimprc_file (filename);
g_free (filename);
}

View File

@ -36,30 +36,33 @@ static ParasiteList *parasites = NULL;
void
gimp_init_parasites()
{
g_return_if_fail(parasites == NULL);
parasites = parasite_list_new();
gimp_parasiterc_load();
g_return_if_fail (parasites == NULL);
parasites = parasite_list_new ();
gimp_parasiterc_load ();
}
void
gimp_parasite_attach (Parasite *p)
{
parasite_list_add(parasites, p);
parasite_list_add (parasites, p);
}
void
gimp_parasite_detach (const char *name)
{
parasite_list_remove(parasites, name);
parasite_list_remove (parasites, name);
}
Parasite *
gimp_parasite_find (const char *name)
{
return parasite_list_find(parasites, name);
return parasite_list_find (parasites, name);
}
static void list_func(char *key, Parasite *p, char ***cur)
static void
list_func (char *key,
Parasite *p,
char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
@ -67,7 +70,7 @@ static void list_func(char *key, Parasite *p, char ***cur)
char **
gimp_parasite_list (gint *count)
{
char **list, **cur;
gchar **list, **cur;
*count = parasite_list_length (parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
@ -77,7 +80,10 @@ gimp_parasite_list (gint *count)
return list;
}
static void save_func(char *key, Parasite *p, FILE *fp)
static void
save_func (char *key,
Parasite *p,
FILE *fp)
{
if (parasite_is_persistent (p))
{
@ -115,7 +121,7 @@ static void save_func(char *key, Parasite *p, FILE *fp)
}
void
gimp_parasiterc_save(void)
gimp_parasiterc_save (void)
{
char *filename;
FILE *fp;
@ -135,17 +141,17 @@ gimp_parasiterc_save(void)
fclose (fp);
if (rename(gimp_personal_rc_file ("#parasiterc.tmp~"),
gimp_personal_rc_file("parasiterc")) != 0)
gimp_personal_rc_file ("parasiterc")) != 0)
unlink(gimp_personal_rc_file ("#parasiterc.tmp~"));
}
void
gimp_parasiterc_load()
gimp_parasiterc_load (void)
{
char *filename;
filename = gimp_personal_rc_file ("parasiterc");
app_init_update_status(NULL, filename, -1);
app_init_update_status (NULL, filename, -1);
parse_gimprc_file (filename);
g_free (filename);
}

View File

@ -45,7 +45,7 @@ parasite_list_init (ParasiteList* list)
}
static void
parasite_list_class_init(ParasiteListClass *klass)
parasite_list_class_init (ParasiteListClass *klass)
{
GtkObjectClass *class = GTK_OBJECT_CLASS(klass);
GtkType type = class->type;
@ -53,16 +53,17 @@ parasite_list_class_init(ParasiteListClass *klass)
class->destroy = parasite_list_destroy;
parasite_list_signals[ADD] =
gimp_signal_new("add", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
gimp_signal_new ("add", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
parasite_list_signals[REMOVE] =
gimp_signal_new("remove", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
gimp_signal_new ("remove", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
gtk_object_class_add_signals (class, parasite_list_signals, LAST_SIGNAL);
}
GtkType
parasite_list_get_type()
parasite_list_get_type (void)
{
static GtkType type = 0;
if (!type)
{
GtkTypeInfo info =
@ -76,141 +77,168 @@ parasite_list_get_type()
NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique(GIMP_TYPE_OBJECT, &info);
type = gtk_type_unique (GIMP_TYPE_OBJECT, &info);
}
return type;
}
ParasiteList*
parasite_list_new()
parasite_list_new (void)
{
ParasiteList *list = gtk_type_new(GIMP_TYPE_PARASITE_LIST);
ParasiteList *list = gtk_type_new (GIMP_TYPE_PARASITE_LIST);
list->table = NULL;
return list;
}
static int
free_a_parasite(void *key, void *parasite, void *unused)
free_a_parasite (void *key,
void *parasite,
void *unused)
{
parasite_free((Parasite *)parasite);
parasite_free ((Parasite *)parasite);
return TRUE;
}
static void
parasite_list_destroy(GtkObject *obj)
parasite_list_destroy (GtkObject *obj)
{
ParasiteList *list;
g_return_if_fail(obj != NULL);
g_return_if_fail(GIMP_IS_PARASITE_LIST(obj));
g_return_if_fail (obj != NULL);
g_return_if_fail (GIMP_IS_PARASITE_LIST(obj));
list = (ParasiteList *)obj;
if (list->table)
{
g_hash_table_foreach_remove(list->table, free_a_parasite, NULL);
g_hash_table_destroy(list->table);
g_hash_table_foreach_remove (list->table, free_a_parasite, NULL);
g_hash_table_destroy (list->table);
}
}
static void
parasite_copy_one(void *key, void *p, void *data)
parasite_copy_one (void *key,
void *p,
void *data)
{
ParasiteList *list = (ParasiteList*)data;
Parasite *parasite = (Parasite*)p;
parasite_list_add(list, parasite);
parasite_list_add (list, parasite);
}
ParasiteList*
parasite_list_copy(const ParasiteList *list)
parasite_list_copy (const ParasiteList *list)
{
ParasiteList *newlist;
newlist = parasite_list_new();
newlist = parasite_list_new ();
if (list->table)
g_hash_table_foreach(list->table, parasite_copy_one, newlist);
g_hash_table_foreach (list->table, parasite_copy_one, newlist);
return newlist;
}
void
parasite_list_add(ParasiteList *list, Parasite *p)
parasite_list_add (ParasiteList *list,
Parasite *p)
{
g_return_if_fail(list != NULL);
g_return_if_fail (list != NULL);
if (list->table == NULL)
list->table = g_hash_table_new(g_str_hash, g_str_equal);
g_return_if_fail(p != NULL);
g_return_if_fail(p->name != NULL);
parasite_list_remove(list, p->name);
p = parasite_copy(p);
g_hash_table_insert(list->table, p->name, p);
list->table = g_hash_table_new (g_str_hash, g_str_equal);
g_return_if_fail (p != NULL);
g_return_if_fail (p->name != NULL);
parasite_list_remove (list, p->name);
p = parasite_copy (p);
g_hash_table_insert (list->table, p->name, p);
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[ADD], p);
}
void
parasite_list_remove(ParasiteList *list, const char *name)
parasite_list_remove (ParasiteList *list,
const char *name)
{
Parasite *p;
g_return_if_fail(list != NULL);
g_return_if_fail (list != NULL);
if (list->table)
{
p = parasite_list_find(list, name);
if (p)
{
g_hash_table_remove(list->table, name);
g_hash_table_remove (list->table, name);
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[REMOVE], p);
parasite_free(p);
parasite_free (p);
}
}
}
gint
parasite_list_length(ParasiteList *list)
parasite_list_length (ParasiteList *list)
{
g_return_val_if_fail(list != NULL, 0);
g_return_val_if_fail (list != NULL, 0);
if (!list->table)
return 0;
return g_hash_table_size(list->table);
return g_hash_table_size (list->table);
}
static void ppcount_func(char *key, Parasite *p, int *count)
static void
ppcount_func (char *key,
Parasite *p,
int *count)
{
if (parasite_is_persistent(p))
if (parasite_is_persistent (p))
*count = *count + 1;
}
gint
parasite_list_persistent_length(ParasiteList *list)
parasite_list_persistent_length (ParasiteList *list)
{
int ppcount = 0;
g_return_val_if_fail(list != NULL, 0);
g_return_val_if_fail (list != NULL, 0);
if (!list->table)
return 0;
parasite_list_foreach(list, (GHFunc)ppcount_func, &ppcount);
parasite_list_foreach (list, (GHFunc)ppcount_func, &ppcount);
return ppcount;
}
void
parasite_list_foreach(ParasiteList *list, GHFunc function, gpointer user_data)
parasite_list_foreach (ParasiteList *list,
GHFunc function,
gpointer user_data)
{
g_return_if_fail(list != NULL);
g_return_if_fail (list != NULL);
if (!list->table)
return;
g_hash_table_foreach(list->table, function, user_data);
g_hash_table_foreach (list->table, function, user_data);
}
Parasite *
parasite_list_find(ParasiteList *list, const char *name)
parasite_list_find (ParasiteList *list,
const char *name)
{
g_return_val_if_fail(list != NULL, NULL);
g_return_val_if_fail (list != NULL, NULL);
if (list->table)
return (Parasite *)g_hash_table_lookup(list->table, name);
return (Parasite *)g_hash_table_lookup (list->table, name);
else
return NULL;
}
void
parasite_shift_parent(Parasite *p)
parasite_shift_parent (Parasite *p)
{
if (p == NULL)
return;
p->flags = (p->flags >> 8);
}

View File

@ -36,30 +36,33 @@ static ParasiteList *parasites = NULL;
void
gimp_init_parasites()
{
g_return_if_fail(parasites == NULL);
parasites = parasite_list_new();
gimp_parasiterc_load();
g_return_if_fail (parasites == NULL);
parasites = parasite_list_new ();
gimp_parasiterc_load ();
}
void
gimp_parasite_attach (Parasite *p)
{
parasite_list_add(parasites, p);
parasite_list_add (parasites, p);
}
void
gimp_parasite_detach (const char *name)
{
parasite_list_remove(parasites, name);
parasite_list_remove (parasites, name);
}
Parasite *
gimp_parasite_find (const char *name)
{
return parasite_list_find(parasites, name);
return parasite_list_find (parasites, name);
}
static void list_func(char *key, Parasite *p, char ***cur)
static void
list_func (char *key,
Parasite *p,
char ***cur)
{
*(*cur)++ = (char *) g_strdup (key);
}
@ -67,7 +70,7 @@ static void list_func(char *key, Parasite *p, char ***cur)
char **
gimp_parasite_list (gint *count)
{
char **list, **cur;
gchar **list, **cur;
*count = parasite_list_length (parasites);
cur = list = (char **) g_malloc (sizeof (char *) * *count);
@ -77,7 +80,10 @@ gimp_parasite_list (gint *count)
return list;
}
static void save_func(char *key, Parasite *p, FILE *fp)
static void
save_func (char *key,
Parasite *p,
FILE *fp)
{
if (parasite_is_persistent (p))
{
@ -115,7 +121,7 @@ static void save_func(char *key, Parasite *p, FILE *fp)
}
void
gimp_parasiterc_save(void)
gimp_parasiterc_save (void)
{
char *filename;
FILE *fp;
@ -135,17 +141,17 @@ gimp_parasiterc_save(void)
fclose (fp);
if (rename(gimp_personal_rc_file ("#parasiterc.tmp~"),
gimp_personal_rc_file("parasiterc")) != 0)
gimp_personal_rc_file ("parasiterc")) != 0)
unlink(gimp_personal_rc_file ("#parasiterc.tmp~"));
}
void
gimp_parasiterc_load()
gimp_parasiterc_load (void)
{
char *filename;
filename = gimp_personal_rc_file ("parasiterc");
app_init_update_status(NULL, filename, -1);
app_init_update_status (NULL, filename, -1);
parse_gimprc_file (filename);
g_free (filename);
}

View File

@ -452,9 +452,25 @@ blob_line (Blob *b, int x0, int y0, int x1, int y1)
#define TABLE_SIZE 256
#define ELLIPSE_SHIFT 2
#define TABLE_SHIFT 14
#define TABLE_SHIFT 12
#define TOTAL_SHIFT (ELLIPSE_SHIFT + TABLE_SHIFT)
/*
* The choose of this values limits the maximal image_size to
* 16384 x 16384 pixels. The values will overflow as soon as
* x or y > INT_MAX / (1 << (ELLIPSE_SHIFT + TABLE_SHIFT)) / SUBSAMPLE
*
* Alternatively the code could be change the code as follows:
*
* xc_base = floor (xc)
* xc_shift = 0.5 + (xc - xc_base) * (1 << TOTAL_SHIFT);
*
* gint x = xc_base + (xc_shift + c * xp_shift + s * xq_shift +
* (1 << (TOTAL_SHIFT - 1))) >> TOTAL_SHIFT;
*
* which would change the limit from the image to the ellipse size
*/
static int trig_initialized = 0;
static int trig_table[TABLE_SIZE];

View File

@ -45,7 +45,7 @@ parasite_list_init (ParasiteList* list)
}
static void
parasite_list_class_init(ParasiteListClass *klass)
parasite_list_class_init (ParasiteListClass *klass)
{
GtkObjectClass *class = GTK_OBJECT_CLASS(klass);
GtkType type = class->type;
@ -53,16 +53,17 @@ parasite_list_class_init(ParasiteListClass *klass)
class->destroy = parasite_list_destroy;
parasite_list_signals[ADD] =
gimp_signal_new("add", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
gimp_signal_new ("add", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
parasite_list_signals[REMOVE] =
gimp_signal_new("remove", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
gimp_signal_new ("remove", GTK_RUN_FIRST, type, 0, gimp_sigtype_pointer);
gtk_object_class_add_signals (class, parasite_list_signals, LAST_SIGNAL);
}
GtkType
parasite_list_get_type()
parasite_list_get_type (void)
{
static GtkType type = 0;
if (!type)
{
GtkTypeInfo info =
@ -76,141 +77,168 @@ parasite_list_get_type()
NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique(GIMP_TYPE_OBJECT, &info);
type = gtk_type_unique (GIMP_TYPE_OBJECT, &info);
}
return type;
}
ParasiteList*
parasite_list_new()
parasite_list_new (void)
{
ParasiteList *list = gtk_type_new(GIMP_TYPE_PARASITE_LIST);
ParasiteList *list = gtk_type_new (GIMP_TYPE_PARASITE_LIST);
list->table = NULL;
return list;
}
static int
free_a_parasite(void *key, void *parasite, void *unused)
free_a_parasite (void *key,
void *parasite,
void *unused)
{
parasite_free((Parasite *)parasite);
parasite_free ((Parasite *)parasite);
return TRUE;
}
static void
parasite_list_destroy(GtkObject *obj)
parasite_list_destroy (GtkObject *obj)
{
ParasiteList *list;
g_return_if_fail(obj != NULL);
g_return_if_fail(GIMP_IS_PARASITE_LIST(obj));
g_return_if_fail (obj != NULL);
g_return_if_fail (GIMP_IS_PARASITE_LIST(obj));
list = (ParasiteList *)obj;
if (list->table)
{
g_hash_table_foreach_remove(list->table, free_a_parasite, NULL);
g_hash_table_destroy(list->table);
g_hash_table_foreach_remove (list->table, free_a_parasite, NULL);
g_hash_table_destroy (list->table);
}
}
static void
parasite_copy_one(void *key, void *p, void *data)
parasite_copy_one (void *key,
void *p,
void *data)
{
ParasiteList *list = (ParasiteList*)data;
Parasite *parasite = (Parasite*)p;
parasite_list_add(list, parasite);
parasite_list_add (list, parasite);
}
ParasiteList*
parasite_list_copy(const ParasiteList *list)
parasite_list_copy (const ParasiteList *list)
{
ParasiteList *newlist;
newlist = parasite_list_new();
newlist = parasite_list_new ();
if (list->table)
g_hash_table_foreach(list->table, parasite_copy_one, newlist);
g_hash_table_foreach (list->table, parasite_copy_one, newlist);
return newlist;
}
void
parasite_list_add(ParasiteList *list, Parasite *p)
parasite_list_add (ParasiteList *list,
Parasite *p)
{
g_return_if_fail(list != NULL);
g_return_if_fail (list != NULL);
if (list->table == NULL)
list->table = g_hash_table_new(g_str_hash, g_str_equal);
g_return_if_fail(p != NULL);
g_return_if_fail(p->name != NULL);
parasite_list_remove(list, p->name);
p = parasite_copy(p);
g_hash_table_insert(list->table, p->name, p);
list->table = g_hash_table_new (g_str_hash, g_str_equal);
g_return_if_fail (p != NULL);
g_return_if_fail (p->name != NULL);
parasite_list_remove (list, p->name);
p = parasite_copy (p);
g_hash_table_insert (list->table, p->name, p);
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[ADD], p);
}
void
parasite_list_remove(ParasiteList *list, const char *name)
parasite_list_remove (ParasiteList *list,
const char *name)
{
Parasite *p;
g_return_if_fail(list != NULL);
g_return_if_fail (list != NULL);
if (list->table)
{
p = parasite_list_find(list, name);
if (p)
{
g_hash_table_remove(list->table, name);
g_hash_table_remove (list->table, name);
gtk_signal_emit (GTK_OBJECT(list), parasite_list_signals[REMOVE], p);
parasite_free(p);
parasite_free (p);
}
}
}
gint
parasite_list_length(ParasiteList *list)
parasite_list_length (ParasiteList *list)
{
g_return_val_if_fail(list != NULL, 0);
g_return_val_if_fail (list != NULL, 0);
if (!list->table)
return 0;
return g_hash_table_size(list->table);
return g_hash_table_size (list->table);
}
static void ppcount_func(char *key, Parasite *p, int *count)
static void
ppcount_func (char *key,
Parasite *p,
int *count)
{
if (parasite_is_persistent(p))
if (parasite_is_persistent (p))
*count = *count + 1;
}
gint
parasite_list_persistent_length(ParasiteList *list)
parasite_list_persistent_length (ParasiteList *list)
{
int ppcount = 0;
g_return_val_if_fail(list != NULL, 0);
g_return_val_if_fail (list != NULL, 0);
if (!list->table)
return 0;
parasite_list_foreach(list, (GHFunc)ppcount_func, &ppcount);
parasite_list_foreach (list, (GHFunc)ppcount_func, &ppcount);
return ppcount;
}
void
parasite_list_foreach(ParasiteList *list, GHFunc function, gpointer user_data)
parasite_list_foreach (ParasiteList *list,
GHFunc function,
gpointer user_data)
{
g_return_if_fail(list != NULL);
g_return_if_fail (list != NULL);
if (!list->table)
return;
g_hash_table_foreach(list->table, function, user_data);
g_hash_table_foreach (list->table, function, user_data);
}
Parasite *
parasite_list_find(ParasiteList *list, const char *name)
parasite_list_find (ParasiteList *list,
const char *name)
{
g_return_val_if_fail(list != NULL, NULL);
g_return_val_if_fail (list != NULL, NULL);
if (list->table)
return (Parasite *)g_hash_table_lookup(list->table, name);
return (Parasite *)g_hash_table_lookup (list->table, name);
else
return NULL;
}
void
parasite_shift_parent(Parasite *p)
parasite_shift_parent (Parasite *p)
{
if (p == NULL)
return;
p->flags = (p->flags >> 8);
}

View File

@ -452,9 +452,25 @@ blob_line (Blob *b, int x0, int y0, int x1, int y1)
#define TABLE_SIZE 256
#define ELLIPSE_SHIFT 2
#define TABLE_SHIFT 14
#define TABLE_SHIFT 12
#define TOTAL_SHIFT (ELLIPSE_SHIFT + TABLE_SHIFT)
/*
* The choose of this values limits the maximal image_size to
* 16384 x 16384 pixels. The values will overflow as soon as
* x or y > INT_MAX / (1 << (ELLIPSE_SHIFT + TABLE_SHIFT)) / SUBSAMPLE
*
* Alternatively the code could be change the code as follows:
*
* xc_base = floor (xc)
* xc_shift = 0.5 + (xc - xc_base) * (1 << TOTAL_SHIFT);
*
* gint x = xc_base + (xc_shift + c * xp_shift + s * xq_shift +
* (1 << (TOTAL_SHIFT - 1))) >> TOTAL_SHIFT;
*
* which would change the limit from the image to the ellipse size
*/
static int trig_initialized = 0;
static int trig_table[TABLE_SIZE];

View File

@ -452,9 +452,25 @@ blob_line (Blob *b, int x0, int y0, int x1, int y1)
#define TABLE_SIZE 256
#define ELLIPSE_SHIFT 2
#define TABLE_SHIFT 14
#define TABLE_SHIFT 12
#define TOTAL_SHIFT (ELLIPSE_SHIFT + TABLE_SHIFT)
/*
* The choose of this values limits the maximal image_size to
* 16384 x 16384 pixels. The values will overflow as soon as
* x or y > INT_MAX / (1 << (ELLIPSE_SHIFT + TABLE_SHIFT)) / SUBSAMPLE
*
* Alternatively the code could be change the code as follows:
*
* xc_base = floor (xc)
* xc_shift = 0.5 + (xc - xc_base) * (1 << TOTAL_SHIFT);
*
* gint x = xc_base + (xc_shift + c * xp_shift + s * xq_shift +
* (1 << (TOTAL_SHIFT - 1))) >> TOTAL_SHIFT;
*
* which would change the limit from the image to the ellipse size
*/
static int trig_initialized = 0;
static int trig_table[TABLE_SIZE];

View File

@ -33,7 +33,8 @@
#endif
#ifdef DEBUG
static void parasite_print(Parasite *p)
static void
parasite_print (Parasite *p)
{
if (p == NULL)
{
@ -53,13 +54,15 @@ static void parasite_print(Parasite *p)
#endif
Parasite *
parasite_new (const char *name, guint32 flags,
guint32 size, const void *data)
parasite_new (const char *name,
guint32 flags,
guint32 size,
const void *data)
{
Parasite *p;
p = g_new (Parasite, 1);
if (name)
p->name = g_strdup(name);
p->name = g_strdup (name);
else
{
g_free (p);
@ -68,7 +71,7 @@ parasite_new (const char *name, guint32 flags,
p->flags = (flags & 0xFF);
p->size = size;
if (size)
p->data = g_memdup(data, size);
p->data = g_memdup (data, size);
else
p->data = NULL;
return p;
@ -80,14 +83,15 @@ parasite_free (Parasite *parasite)
if (parasite == NULL)
return;
if (parasite->name)
g_free(parasite->name);
g_free (parasite->name);
if (parasite->data)
g_free(parasite->data);
g_free(parasite);
g_free (parasite->data);
g_free (parasite);
}
int
parasite_is_type (const Parasite *parasite, const char *name)
parasite_is_type (const Parasite *parasite,
const char *name)
{
if (!parasite || !parasite->name)
return FALSE;
@ -104,7 +108,8 @@ parasite_copy (const Parasite *parasite)
}
int
parasite_compare (const Parasite *a, const Parasite *b)
parasite_compare (const Parasite *a,
const Parasite *b)
{
if (a && b && a->name && b->name && strcmp(a->name, b->name) == 0 &&
a->flags == b->flags && a->size == b->size )
@ -118,7 +123,7 @@ parasite_compare (const Parasite *a, const Parasite *b)
}
gulong
parasite_flags(const Parasite *p)
parasite_flags (const Parasite *p)
{
if (p == NULL)
return 0;
@ -126,7 +131,7 @@ parasite_flags(const Parasite *p)
}
int
parasite_is_persistent(const Parasite *p)
parasite_is_persistent (const Parasite *p)
{
if (p == NULL)
return FALSE;
@ -134,7 +139,7 @@ parasite_is_persistent(const Parasite *p)
}
int
parasite_is_undoable(const Parasite *p)
parasite_is_undoable (const Parasite *p)
{
if (p == NULL)
return FALSE;
@ -142,7 +147,8 @@ parasite_is_undoable(const Parasite *p)
}
int
parasite_has_flag(const Parasite *p, gulong flag)
parasite_has_flag (const Parasite *p,
gulong flag)
{
if (p == NULL)
return FALSE;
@ -150,23 +156,28 @@ parasite_has_flag(const Parasite *p, gulong flag)
}
const char *
parasite_name(const Parasite *p)
parasite_name (const Parasite *p)
{
if (p)
return p->name;
return NULL;
}
void *parasite_data(const Parasite *p)
void *
parasite_data (const Parasite *p)
{
if (p)
return p->data;
return NULL;
}
long parasite_data_size(const Parasite *p)
long
parasite_data_size (const Parasite *p)
{
if (p)
return p->size;
return 0;
}

View File

@ -33,7 +33,8 @@
#endif
#ifdef DEBUG
static void parasite_print(Parasite *p)
static void
parasite_print (Parasite *p)
{
if (p == NULL)
{
@ -53,13 +54,15 @@ static void parasite_print(Parasite *p)
#endif
Parasite *
parasite_new (const char *name, guint32 flags,
guint32 size, const void *data)
parasite_new (const char *name,
guint32 flags,
guint32 size,
const void *data)
{
Parasite *p;
p = g_new (Parasite, 1);
if (name)
p->name = g_strdup(name);
p->name = g_strdup (name);
else
{
g_free (p);
@ -68,7 +71,7 @@ parasite_new (const char *name, guint32 flags,
p->flags = (flags & 0xFF);
p->size = size;
if (size)
p->data = g_memdup(data, size);
p->data = g_memdup (data, size);
else
p->data = NULL;
return p;
@ -80,14 +83,15 @@ parasite_free (Parasite *parasite)
if (parasite == NULL)
return;
if (parasite->name)
g_free(parasite->name);
g_free (parasite->name);
if (parasite->data)
g_free(parasite->data);
g_free(parasite);
g_free (parasite->data);
g_free (parasite);
}
int
parasite_is_type (const Parasite *parasite, const char *name)
parasite_is_type (const Parasite *parasite,
const char *name)
{
if (!parasite || !parasite->name)
return FALSE;
@ -104,7 +108,8 @@ parasite_copy (const Parasite *parasite)
}
int
parasite_compare (const Parasite *a, const Parasite *b)
parasite_compare (const Parasite *a,
const Parasite *b)
{
if (a && b && a->name && b->name && strcmp(a->name, b->name) == 0 &&
a->flags == b->flags && a->size == b->size )
@ -118,7 +123,7 @@ parasite_compare (const Parasite *a, const Parasite *b)
}
gulong
parasite_flags(const Parasite *p)
parasite_flags (const Parasite *p)
{
if (p == NULL)
return 0;
@ -126,7 +131,7 @@ parasite_flags(const Parasite *p)
}
int
parasite_is_persistent(const Parasite *p)
parasite_is_persistent (const Parasite *p)
{
if (p == NULL)
return FALSE;
@ -134,7 +139,7 @@ parasite_is_persistent(const Parasite *p)
}
int
parasite_is_undoable(const Parasite *p)
parasite_is_undoable (const Parasite *p)
{
if (p == NULL)
return FALSE;
@ -142,7 +147,8 @@ parasite_is_undoable(const Parasite *p)
}
int
parasite_has_flag(const Parasite *p, gulong flag)
parasite_has_flag (const Parasite *p,
gulong flag)
{
if (p == NULL)
return FALSE;
@ -150,23 +156,28 @@ parasite_has_flag(const Parasite *p, gulong flag)
}
const char *
parasite_name(const Parasite *p)
parasite_name (const Parasite *p)
{
if (p)
return p->name;
return NULL;
}
void *parasite_data(const Parasite *p)
void *
parasite_data (const Parasite *p)
{
if (p)
return p->data;
return NULL;
}
long parasite_data_size(const Parasite *p)
long
parasite_data_size (const Parasite *p)
{
if (p)
return p->size;
return 0;
}

View File

@ -33,7 +33,8 @@
#endif
#ifdef DEBUG
static void parasite_print(Parasite *p)
static void
parasite_print (Parasite *p)
{
if (p == NULL)
{
@ -53,13 +54,15 @@ static void parasite_print(Parasite *p)
#endif
Parasite *
parasite_new (const char *name, guint32 flags,
guint32 size, const void *data)
parasite_new (const char *name,
guint32 flags,
guint32 size,
const void *data)
{
Parasite *p;
p = g_new (Parasite, 1);
if (name)
p->name = g_strdup(name);
p->name = g_strdup (name);
else
{
g_free (p);
@ -68,7 +71,7 @@ parasite_new (const char *name, guint32 flags,
p->flags = (flags & 0xFF);
p->size = size;
if (size)
p->data = g_memdup(data, size);
p->data = g_memdup (data, size);
else
p->data = NULL;
return p;
@ -80,14 +83,15 @@ parasite_free (Parasite *parasite)
if (parasite == NULL)
return;
if (parasite->name)
g_free(parasite->name);
g_free (parasite->name);
if (parasite->data)
g_free(parasite->data);
g_free(parasite);
g_free (parasite->data);
g_free (parasite);
}
int
parasite_is_type (const Parasite *parasite, const char *name)
parasite_is_type (const Parasite *parasite,
const char *name)
{
if (!parasite || !parasite->name)
return FALSE;
@ -104,7 +108,8 @@ parasite_copy (const Parasite *parasite)
}
int
parasite_compare (const Parasite *a, const Parasite *b)
parasite_compare (const Parasite *a,
const Parasite *b)
{
if (a && b && a->name && b->name && strcmp(a->name, b->name) == 0 &&
a->flags == b->flags && a->size == b->size )
@ -118,7 +123,7 @@ parasite_compare (const Parasite *a, const Parasite *b)
}
gulong
parasite_flags(const Parasite *p)
parasite_flags (const Parasite *p)
{
if (p == NULL)
return 0;
@ -126,7 +131,7 @@ parasite_flags(const Parasite *p)
}
int
parasite_is_persistent(const Parasite *p)
parasite_is_persistent (const Parasite *p)
{
if (p == NULL)
return FALSE;
@ -134,7 +139,7 @@ parasite_is_persistent(const Parasite *p)
}
int
parasite_is_undoable(const Parasite *p)
parasite_is_undoable (const Parasite *p)
{
if (p == NULL)
return FALSE;
@ -142,7 +147,8 @@ parasite_is_undoable(const Parasite *p)
}
int
parasite_has_flag(const Parasite *p, gulong flag)
parasite_has_flag (const Parasite *p,
gulong flag)
{
if (p == NULL)
return FALSE;
@ -150,23 +156,28 @@ parasite_has_flag(const Parasite *p, gulong flag)
}
const char *
parasite_name(const Parasite *p)
parasite_name (const Parasite *p)
{
if (p)
return p->name;
return NULL;
}
void *parasite_data(const Parasite *p)
void *
parasite_data (const Parasite *p)
{
if (p)
return p->data;
return NULL;
}
long parasite_data_size(const Parasite *p)
long
parasite_data_size (const Parasite *p)
{
if (p)
return p->size;
return 0;
}

40
pixmaps/first.xpm Normal file
View File

@ -0,0 +1,40 @@
/* XPM */
static char * first_xpm[] = {
"13 13 24 1",
" c None",
". c #000000",
"+ c #333333",
"@ c #999999",
"# c #FFFFFF",
"$ c #CCCCCC",
"% c #BEBEBE",
"& c #E5E5E5",
"* c #CDCDCD",
"= c #8B8B8B",
"- c #B7B7B7",
"; c #A2A2A2",
"> c #6B6B6B",
", c #636363",
"' c #979797",
") c #A4A4A4",
"! c #9B9B9B",
"~ c #5D5D5D",
"{ c #9F9F9F",
"] c #B2B2B2",
"^ c #757575",
"/ c #8A8A8A",
"( c #666666",
"_ c #898989",
".. . ",
".+ ..@.",
".+ ..@##.",
".+ ..@##$#.",
".+ ..@##$%$#.",
"...@&*=-;$$#.",
".+>,'=)!$%$#.",
"...+~{=-]$$#.",
".+ ..+^/-%$#.",
".+ ..+()$#.",
".+ ..+_@.",
".+ ..+.",
".. . "};

40
pixmaps/last.xpm Normal file
View File

@ -0,0 +1,40 @@
/* XPM */
static char * last_xpm[] = {
"13 13 24 1",
" c None",
". c #000000",
"+ c #999999",
"@ c #333333",
"# c #FFFFFF",
"$ c #CCCCCC",
"% c #BEBEBE",
"& c #A2A2A2",
"* c #B7B7B7",
"= c #8B8B8B",
"- c #CDCDCD",
"; c #E5E5E5",
"> c #9B9B9B",
", c #A4A4A4",
"' c #979797",
") c #636363",
"! c #6B6B6B",
"~ c #B2B2B2",
"{ c #9F9F9F",
"] c #5D5D5D",
"^ c #8A8A8A",
"/ c #757575",
"( c #666666",
"_ c #898989",
" . ..",
".+.. @.",
".##+.. @.",
".#$##+.. @.",
".#$%$##+.. @.",
".#$$&*=-;+...",
".#$%$>,=')!@.",
".#$$~*={]@...",
".#$%*^/@.. @.",
".#$,(@.. @.",
".+_@.. @.",
".@.. @.",
" . .."};

38
pixmaps/next.xpm Normal file
View File

@ -0,0 +1,38 @@
/* XPM */
static char * next_xpm[] = {
"13 13 22 1",
" c None",
". c #000000",
"+ c #333333",
"@ c #FFFFFF",
"# c #999999",
"$ c #CCCCCC",
"% c #A2A2A2",
"& c #B7B7B7",
"* c #8B8B8B",
"= c #CDCDCD",
"- c #E5E5E5",
"; c #9B9B9B",
"> c #A4A4A4",
", c #979797",
"' c #636363",
") c #6B6B6B",
"! c #B2B2B2",
"~ c #9F9F9F",
"{ c #5D5D5D",
"] c #8A8A8A",
"^ c #757575",
"/ c #666666",
" ",
".. . ",
".+ ... ",
".+ .@#.. ",
".+ .$@@#.. ",
".+ .%&*=-#.. ",
".+ .$;>*,')+.",
".+ .!&*~{+.. ",
".+ .&]^+.. ",
".+ ./+.. ",
".+ ... ",
".. . ",
" "};

39
pixmaps/play.xpm Normal file
View File

@ -0,0 +1,39 @@
/* XPM */
static char * play_xpm[] = {
"13 13 23 1",
" c None",
". c #000000",
"+ c #4D4D4D",
"@ c #808080",
"# c #666666",
"$ c #5F5F5F",
"% c #515151",
"& c #5C5C5C",
"* c #464646",
"= c #676767",
"- c #737373",
"; c #4E4E4E",
"> c #525252",
", c #4C4C4C",
"' c #323232",
") c #363636",
"! c #1A1A1A",
"~ c #595959",
"{ c #505050",
"] c #2F2F2F",
"^ c #454545",
"/ c #3B3B3B",
"( c #333333",
" . ",
".+.. ",
".@@+.. ",
".@#@@+.. ",
".@#$#@@+.. ",
".@##%&*=-+.. ",
".@#$#;>*,')!.",
".@##~&*{]!.. ",
".@#$&^/!.. ",
".@#>(!.. ",
".+^!.. ",
".!.. ",
" . "};

38
pixmaps/prev.xpm Normal file
View File

@ -0,0 +1,38 @@
/* XPM */
static char * prev_xpm[] = {
"13 13 22 1",
" c None",
". c #000000",
"+ c #333333",
"@ c #999999",
"# c #FFFFFF",
"$ c #CCCCCC",
"% c #E5E5E5",
"& c #CDCDCD",
"* c #8B8B8B",
"= c #B7B7B7",
"- c #A2A2A2",
"; c #6B6B6B",
"> c #636363",
", c #979797",
"' c #A4A4A4",
") c #9B9B9B",
"! c #5D5D5D",
"~ c #9F9F9F",
"{ c #B2B2B2",
"] c #757575",
"^ c #8A8A8A",
"/ c #666666",
" ",
" . ..",
" ... +.",
" ..@#. +.",
" ..@##$. +.",
" ..@%&*=-. +.",
".+;>,*')$. +.",
" ..+!~*={. +.",
" ..+]^=. +.",
" ..+/. +.",
" ... +.",
" . ..",
" "};

96
pixmaps/update.xpm Normal file
View File

@ -0,0 +1,96 @@
/* XPM */
static char * update_xpm[] = {
"17 17 76 1",
" c None",
". c #C5C5C5",
"+ c #8A8A8A",
"@ c #000000",
"# c #848484",
"$ c #B2B2B2",
"% c #979797",
"& c #343434",
"* c #272727",
"= c #CCCCCC",
"- c #111111",
"; c #2C2C2C",
"> c #838383",
", c #545454",
"' c #202020",
") c #525252",
"! c #ADADAD",
"~ c #FFFFFF",
"{ c #989898",
"] c #494949",
"^ c #222222",
"/ c #565656",
"( c #535353",
"_ c #262626",
": c #888888",
"< c #C8C8C8",
"[ c #666666",
"} c #C6C6C6",
"| c #1D1D1D",
"1 c #5A5A5A",
"2 c #9A9A9A",
"3 c #8C8C8C",
"4 c #DADADA",
"5 c #999999",
"6 c #969696",
"7 c #141414",
"8 c #282828",
"9 c #555555",
"0 c #C7C7C7",
"a c #4B4B4B",
"b c #2A2A2A",
"c c #B0B0B0",
"d c #BEBEBE",
"e c #919191",
"f c #BBBBBB",
"g c #8F8F8F",
"h c #1C1C1C",
"i c #B7B7B7",
"j c #B6B6B6",
"k c #8B8B8B",
"l c #292929",
"m c #C0C0C0",
"n c #AEAEAE",
"o c #B3B3B3",
"p c #8E8E8E",
"q c #1E1E1E",
"r c #B8B8B8",
"s c #909090",
"t c #BABABA",
"u c #333333",
"v c #2B2B2B",
"w c #0E0E0E",
"x c #4F4F4F",
"y c #939393",
"z c #1F1F1F",
"A c #585858",
"B c #484848",
"C c #505050",
"D c #B9B9B9",
"E c #9D9D9D",
"F c #101010",
"G c #5B5B5B",
"H c #252525",
"I c #808080",
"J c #959595",
"K c #C9C9C9",
" .+@#$ ",
" %&*@=@-;> ",
" ,')!@~@{]^/ ",
" (_:<@=~[@}%|1 ",
" 2|3 @~45@ 67> ",
" 89< @=~=4[@ 0ab ",
"c-5 @~d4d5@ e-f",
"ghi @=~4d4d[@ jhk",
">lm @~=n=o=5@ mb>",
"pqr@=~5=5=5d[@j|+",
"o-%@~5o5o5o55@s-t",
" _@=5[[[[[[[[u@v ",
" :w@@@@@@@@@@@q: ",
" xby< 0yzA ",
" B^C6DmfEaFG ",
" e*FzbH*bI ",
" ok>JK "};

View File

@ -7,3 +7,4 @@ gap_filter
gap_plugins
gap_frontends
gap_decode_mpeg
gap_navigator_dialog

View File

@ -99,6 +99,7 @@ libexec_PROGRAMS = \
gap_plugins \
gap_filter \
gap_frontends \
gap_navigator_dialog \
$(GAP_DECODE_MPEG)
EXTRA_PROGRAMS = \
@ -183,6 +184,20 @@ gap_decode_mpeg_SOURCES = \
gap_pdb_calls.h
gap_navigator_dialog_SOURCES = \
gap_navigator_dialog.c \
gap_lib.c \
gap_lib.h \
gap_arr_dialog.c \
gap_arr_dialog.h \
gap_pdb_calls.c \
gap_pdb_calls.h \
gap_layer_copy.c \
gap_layer_copy.h \
gap_exchange_image.c \
gap_exchange_image.h
AM_CPPFLAGS = \
-DLOCALEDIR=\""$(localedir)"\"

View File

@ -58,6 +58,8 @@
/*
* Changelog:
*
* 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]
* (based on plug-ins/common/mpeg.c v1.1 99/05/31 by Adam D. Moss)
*/
@ -85,6 +87,7 @@
/* GAP includes */
#include "gap_arr_dialog.h"
#include "gap_pdb_calls.h"
/* Includes for extra LIBS */
#include "mpeg.h"
@ -164,7 +167,7 @@ query ()
_("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",
"1999/11/18",
"2000/01/01",
N_("<Image>/Video/Split Video to Frames/MPEG1"),
NULL,
PROC_PLUG_IN,
@ -176,7 +179,7 @@ query ()
_("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",
"1999/11/18",
"2000/01/01",
N_("<Toolbox>/Xtns/Split Video to Frames/MPEG1"),
NULL,
PROC_EXTENSION,
@ -340,23 +343,36 @@ p_overwrite_dialog(char *filename, gint overwrite_mode)
}
static gint
MPEG_frame_period_ms(gint mpeg_rate_code)
MPEG_frame_period_ms(gint mpeg_rate_code, char *basename)
{
gint l_rc;
gdouble l_framerate;
t_video_info *vin_ptr;
vin_ptr = p_get_video_info(basename);
l_rc = 0;
switch(mpeg_rate_code)
{
case 1: return 44; /* ~23 fps */
case 2: return 42; /* 24 fps */
case 3: return 40; /* 25 fps */
case 4: return 33; /* ~30 fps */
case 5: return 33; /* 30 fps */
case 6: return 20; /* 50 fps */
case 7: return 17; /* ~60 fps */
case 8: return 17; /* 60 fps */
case 1: l_rc = 44; l_framerate = 23.976; break;
case 2: l_rc = 42; l_framerate = 24.0; break;
case 3: l_rc = 40; l_framerate = 25.0; break;
case 4: l_rc = 33; l_framerate = 29.97; break;
case 5: l_rc = 33; l_framerate = 30.0; break;
case 6: l_rc = 20; l_framerate = 50.0; break;
case 7: l_rc = 17; l_framerate = 59.94; break;
case 8: l_rc = 17; l_framerate = 60.0; break;
case 0: /* ? */
default:
printf("mpeg: warning - this MPEG has undefined timing.\n");
return 0;
break;
}
if(vin_ptr)
{
if(l_rc != 0) vin_ptr->framerate = l_framerate;
p_set_video_info(vin_ptr ,basename);
g_free(vin_ptr);
}
return(l_rc);
}
@ -427,11 +443,11 @@ load_image (char *filename,
data = g_malloc(img.Size);
delay = MPEG_frame_period_ms(img.PictureRate);
delay = MPEG_frame_period_ms(img.PictureRate, basename);
/*
printf(" <%d : %d> %dx%d - d%d - bmp%d - ps%d - s%d\n",
img.PictureRate, MPEG_frame_period_ms(img.PictureRate),
img.PictureRate, delay,
img.Width,img.Height,img.Depth,img.BitmapPad,img.PixelSize,img.Size);
*/
@ -567,6 +583,7 @@ load_image (char *filename,
PARAM_STRING, framename,
PARAM_STRING, framename, /* raw name ? */
PARAM_END);
p_gimp_file_save_thumbnail(image_ID, framename);
}
}

View File

@ -48,6 +48,7 @@
*/
/* revision history
* 1.1.14a; 1999/11/22 hof: fixed gcc warning (too many arguments for format)
* 1.1.13a; 1999/11/22 hof: first release
*/
@ -545,12 +546,12 @@ p_rename_frames(gint32 frame_from, gint32 frame_to, char *basename, char *ext)
if (strcmp(l_src_frame, l_dst_frame) != 0)
{
/* check overwrire if Destination frame already exsts */
/* check overwrite if Destination frame already exsts */
l_overwrite_mode = p_overwrite_dialog(l_dst_frame, l_overwrite_mode);
if (l_overwrite_mode < 0)
{
sprintf(global_errlist,
_("frames are not extracted, because overwrite was cancelled"),
_("frames are not extracted, because overwrite of %s was cancelled"),
l_dst_frame);
return(-1);
}

View File

@ -28,6 +28,8 @@
*/
/* revision history:
* 1.1.14a; 1999/12/18 hof: handle .xvpics on fileops (copy, rename and delete)
* new: p_get_frame_nr,
* 1.1.9a; 1999/09/14 hof: handle frame filenames with framenumbers
* that are not the 4digit style. (like frame1.xcf)
* 1.1.8a; 1999/08/31 hof: for AnimFrame Filtypes != XCF:
@ -53,7 +55,7 @@
*/
#include "config.h"
/* SYTEM (UNIX) includes */
/* SYSTEM (UNIX) includes */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
@ -89,8 +91,8 @@
/* GAP includes */
#include "gap_layer_copy.h"
#include "gap_lib.h"
#include "gap_pdb_calls.h"
#include "gap_arr_dialog.h"
#include "gap_mov_dialog.h"
#include "gap_exchange_image.h"
extern int gap_debug; /* ==0 ... dont print debug infos */
@ -108,6 +110,43 @@ static int p_delete_frame(t_anim_info *ainfo_ptr, long nr);
static int p_del(t_anim_info *ainfo_ptr, long cnt);
static int p_decide_save_as(gint32 image_id, char *sav_name);
/* ============================================================================
* p_alloc_fname_thumbnail
* return the thumbnail name (in .xvpics subdir)
* for the given filename
* ============================================================================
*/
char *
p_alloc_fname_thumbnail(char *name)
{
int l_len;
int l_idx;
char *l_str;
if(name == NULL)
{
return(g_strdup("\0"));
}
l_len = strlen(name);
l_str = g_malloc(l_len+10);
strcpy(l_str, name);
if(l_len > 0)
{
for(l_idx = l_len -1; l_idx > 0; l_idx--)
{
if((name[l_idx] == G_DIR_SEPARATOR) || (name[l_idx] == DIR_ROOT))
{
l_idx++;
break;
}
}
sprintf(&l_str[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);
}
/* ============================================================================
* p_strdup_*_underscore
* duplicate string and if last char is no underscore add one at end.
@ -226,6 +265,32 @@ int p_file_exists(char *fname)
return(1);
} /* end p_file_exists */
/* ============================================================================
* p_image_file_copy
* (copy the imagefile and its thumbnail)
* ============================================================================
*/
int p_image_file_copy(char *fname, char *fname_copy)
{
char *l_from_fname_thumbnail;
char *l_to_fname_thumbnail;
int l_rc;
l_from_fname_thumbnail = p_alloc_fname_thumbnail(fname);
l_to_fname_thumbnail = p_alloc_fname_thumbnail(fname_copy);
l_rc = p_file_copy(fname, fname_copy);
if((l_from_fname_thumbnail)
&& (l_to_fname_thumbnail))
{
p_file_copy(l_from_fname_thumbnail, l_to_fname_thumbnail);
}
if(l_from_fname_thumbnail) g_free(l_from_fname_thumbnail);
if(l_to_fname_thumbnail) g_free(l_to_fname_thumbnail);
return(l_rc);
}
/* ============================================================================
* p_file_copy
* ============================================================================
@ -293,15 +358,23 @@ int p_file_copy(char *fname, char *fname_copy)
int p_delete_frame(t_anim_info *ainfo_ptr, long nr)
{
char *l_fname;
char *l_fname_thumbnail;
int l_rc;
l_fname = p_alloc_fname(ainfo_ptr->basename, nr, ainfo_ptr->extension);
if(l_fname == NULL) { return(1); }
l_fname_thumbnail = p_alloc_fname_thumbnail(l_fname);
if(l_fname_thumbnail == NULL) { return(1); }
if(gap_debug) fprintf(stderr, "\nDEBUG p_delete_frame: %s\n", l_fname);
l_rc = remove(l_fname);
if(gap_debug) fprintf(stderr, "\nDEBUG p_delete_frame: %s\n", l_fname_thumbnail);
remove(l_fname_thumbnail);
g_free(l_fname);
g_free(l_fname_thumbnail);
return(l_rc);
@ -315,6 +388,8 @@ int p_rename_frame(t_anim_info *ainfo_ptr, long from_nr, long to_nr)
{
char *l_from_fname;
char *l_to_fname;
char *l_from_fname_thumbnail;
char *l_to_fname_thumbnail;
int l_rc;
l_from_fname = p_alloc_fname(ainfo_ptr->basename, from_nr, ainfo_ptr->extension);
@ -323,12 +398,22 @@ int p_rename_frame(t_anim_info *ainfo_ptr, long from_nr, long to_nr)
l_to_fname = p_alloc_fname(ainfo_ptr->basename, to_nr, ainfo_ptr->extension);
if(l_to_fname == NULL) { g_free(l_from_fname); return(1); }
l_from_fname_thumbnail = p_alloc_fname_thumbnail(l_from_fname);
if(l_from_fname_thumbnail == NULL) { return(1); }
l_to_fname_thumbnail = p_alloc_fname_thumbnail(l_to_fname);
if(l_to_fname_thumbnail == NULL) { g_free(l_from_fname_thumbnail); return(1); }
if(gap_debug) fprintf(stderr, "\nDEBUG p_rename_frame: %s ..to.. %s\n", l_from_fname, l_to_fname);
l_rc = rename(l_from_fname, l_to_fname);
if(gap_debug) fprintf(stderr, "\nDEBUG p_rename_frame: %s ..to.. %s\n", l_from_fname_thumbnail, l_to_fname_thumbnail);
rename(l_from_fname_thumbnail, l_to_fname_thumbnail);
g_free(l_from_fname);
g_free(l_to_fname);
g_free(l_from_fname_thumbnail);
g_free(l_to_fname_thumbnail);
return(l_rc);
@ -727,6 +812,52 @@ void p_free_ainfo(t_anim_info **ainfo)
}
/* ============================================================================
* p_get_frame_nr
* ============================================================================
*/
long
p_get_frame_nr_from_name(char *fname)
{
long number;
int len;
char *basename;
if(fname == NULL) return(-1);
basename = p_alloc_basename(fname, &number);
if(basename == NULL) return(-1);
len = strlen(basename);
g_free(basename);
if(number > 0) return(number);
if(fname[len] == '0') return(number);
/*
* if(fname[len] == '_')
* {
* if(fname[len+1] == '0') return(TRUE);
* }
*/
return(-1);
}
long
p_get_frame_nr(gint32 image_id)
{
char *fname;
long number;
number = -1;
fname = gimp_image_get_filename(image_id);
if(fname)
{
number = p_get_frame_nr_from_name(fname);
g_free(fname);
}
return (number);
}
/* ============================================================================
* p_chk_framechange
*
@ -948,6 +1079,8 @@ gint32 p_save_named_image(gint32 image_id, char *sav_name, GRunModeType run_mode
if(gap_debug) fprintf(stderr, "DEBUG: after p_save_named_image: '%s' nlayers=%d image=%d drw=%d run_mode=%d\n", sav_name, (int)l_nlayers, (int)image_id, (int)l_drawable->id, (int)run_mode);
p_gimp_file_save_thumbnail(image_id, sav_name);
g_free (l_layers_list);
g_free (l_drawable);
@ -1104,7 +1237,10 @@ int p_save_named_frame(gint32 image_id, char *sav_name)
* so lets try a copy ; remove sequence
*/
if(gap_debug) fprintf(stderr, "DEBUG: p_save_named_frame: RENAME 2nd try\n");
if(0 == p_file_copy(l_tmpname, sav_name)) remove(l_tmpname);
if(0 == p_file_copy(l_tmpname, sav_name))
{
remove(l_tmpname);
}
else
{
fprintf(stderr, "ERROR in p_save_named_frame: cant rename %s to %s\n",
@ -1125,6 +1261,8 @@ int p_save_named_frame(gint32 image_id, char *sav_name)
}
}
p_gimp_file_save_thumbnail(image_id, sav_name);
g_free(l_tmpname); /* free temporary name */
return l_rc;
@ -1461,6 +1599,7 @@ int p_dup(t_anim_info *ainfo_ptr, long cnt, long range_from, long range_to)
l_hi = l_lo + l_cnt2;
while(l_lo > l_src_nr_max)
{
sprintf(g_errtxt, "BEFORE rename frame %ld to %ld\n", l_lo, l_hi);
if(0 != p_rename_frame(ainfo_ptr, l_lo, l_hi))
{
sprintf(g_errtxt, "Error: could not rename frame %ld to %ld\n", l_lo, l_hi);
@ -1487,7 +1626,7 @@ int p_dup(t_anim_info *ainfo_ptr, long cnt, long range_from, long range_to)
l_dup_name = p_alloc_fname(ainfo_ptr->basename, l_hi, ainfo_ptr->extension);
if((l_dup_name != NULL) && (l_curr_name != NULL))
{
p_file_copy(l_curr_name, l_dup_name);
p_image_file_copy(l_curr_name, l_dup_name);
g_free(l_dup_name);
g_free(l_curr_name);
}

View File

@ -25,6 +25,7 @@
*/
/* revision history:
* 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
* 0.99.00; 1999/03/15 hof: prepared for win/dos filename conventions
* 0.96.02; 1998/08/05 hof: extended gap_dup (duplicate range instead of singele frame)
@ -77,7 +78,6 @@ typedef struct t_anim_info {
long last_frame_nr;
} t_anim_info;
/* procedures used in other gap*.c files */
int p_file_exists(char *fname);
int p_file_copy(char *fname, char *fname_copy);
@ -98,6 +98,11 @@ char* p_gzip (char *orig_name, char *new_name, char *zip);
char* p_strdup_add_underscore(char *name);
char* p_strdup_del_underscore(char *name);
long p_get_frame_nr(gint32 image_id);
long p_get_frame_nr_from_name(char *fname);
char *p_alloc_fname_thumbnail(char *name);
int p_image_file_copy(char *fname, char *fname_copy);
/* animation menu fuctions provided by gap_lib.c */
int gap_next(GRunModeType run_mode, gint32 image_id);
@ -113,7 +118,6 @@ int gap_shift(GRunModeType run_mode, gint32 image_id, int nr, long range_from, l
void p_msg_win(GRunModeType run_mode, char *msg);
#endif

View File

@ -38,9 +38,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
static char *gap_main_version = "1.1.13a; 1999/11/26";
static char *gap_main_version = "1.1.14a; 2000/01/01";
/* revision history:
* gimp 1.1.14a; 2000/01/01 hof: bugfix params for gap_dup in noninteractive mode
* gimp 1.1.13a; 1999/11/26 hof: splitted frontends for external programs (mpeg encoders)
* to gap_frontends_main.c
* gimp 1.1.11a; 1999/11/15 hof: changed Menunames (AnimFrames to Video, Submenu Encode)
@ -804,7 +805,7 @@ run (char *name,
image_id = param[1].data.d_image;
nr = param[3].data.d_int32; /* how often to copy current frame */
if (n_params != 6)
if (n_params > 5)
{
range_from = param[4].data.d_int32; /* frame nr to start */
range_to = param[5].data.d_int32; /* frame nr to stop */

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
* IMPORTANT Notes:
* some Procedures have changed their Interface from GIMP 1.0.2 to GIMP 1.1
* in that cases the procedure parameters are checked and the call is done
* in 1.0.2 or 1.1 style repectivly.
* in 1.0.2 or 1.1 style respectivly.
*
* some of these procedures are not available in the official GIMP 1.0.2 releases
* (and prior releases)
@ -37,6 +37,8 @@
*/
/* revision history:
* version 1.1.14a; 2000/01/09 hof: thumbnail save/load,
* Procedures for video_info file
* version 0.98.00; 1998/11/28 hof: 1.st (pre) release (GAP port to GIMP 1.1)
*/
#include <stdio.h>
@ -833,3 +835,263 @@ gint p_gimp_drawable_set_image(gint32 drawable_id, gint32 image_id)
return(-1);
} /* end p_gimp_drawable_set_image */
/* ============================================================================
* p_gimp_gimprc_query
*
* ============================================================================
*/
char*
p_gimp_gimprc_query(char *key)
{
GParam *return_vals;
gint nreturn_vals;
char *value;
return_vals = gimp_run_procedure ("gimp_gimprc_query",
&nreturn_vals,
PARAM_STRING, key,
PARAM_END);
value = NULL;
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
if(return_vals[1].data.d_string != NULL)
{
value = g_strdup(return_vals[1].data.d_string);
}
}
gimp_destroy_params (return_vals, nreturn_vals);
return(value);
}
/* ============================================================================
* p_gimp_file_save_thumbnail
*
* ============================================================================
*/
gint
p_gimp_file_save_thumbnail(gint32 image_id, char* filename)
{
static char *l_called_proc = "gimp_file_save_thumbnail";
GParam *return_vals;
int nreturn_vals;
if (p_pdb_procedure_available(l_called_proc) >= 0)
{
return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_STRING, filename,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
return (0);
}
printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_called_proc,
"(cannot save thumbnails)");
}
return(-1);
} /* end p_gimp_file_save_thumbnail */
/* ============================================================================
* p_gimp_file_load_thumbnail
*
* ============================================================================
*/
gint
p_gimp_file_load_thumbnail(char* filename, gint32 *th_width, gint32 *th_height, unsigned char **th_data)
{
static char *l_called_proc = "gimp_file_load_thumbnail";
GParam *return_vals;
int nreturn_vals;
int bytesize;
unsigned char *l_ptr;
*th_data = NULL;
if (p_pdb_procedure_available(l_called_proc) >= 0)
{
return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals,
PARAM_STRING, filename,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
*th_width = return_vals[1].data.d_int32;
*th_height = return_vals[2].data.d_int32;
l_ptr = return_vals[3].data.d_int8array;
bytesize = 3 * (*th_width) * (*th_height);
*th_data = g_malloc(bytesize);
if((*th_data != NULL) && (l_ptr != NULL))
{
/* BUG in the PDB Interface in gimp.1.1.14
* the return_vals[3].data.d_int8array does NOT really point
* to the thumbnail data (as it should)
* and we retrieve only NONSENSE DATA here.
*
* (maybe we need an additional data length parameter
* as it is usual for array parameter passing ?)
*/
memcpy(*th_data, l_ptr, bytesize);
return (0);
}
}
printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_called_proc,
"(cannot load thumbnails)");
}
return(-1);
} /* end p_gimp_file_load_thumbnail */
gint p_gimp_image_thumbnail(gint32 image_id, gint32 width, gint32 height,
gint32 *th_width, gint32 *th_height, gint32 *th_bpp,
gint32 *th_data_count, unsigned char **th_data)
{
static char *l_called_proc = "gimp_image_thumbnail";
GParam *return_vals;
int nreturn_vals;
unsigned char *l_ptr;
gint32 *l_ptr32;
*th_data = NULL;
if (p_pdb_procedure_available(l_called_proc) >= 0)
{
return_vals = gimp_run_procedure (l_called_proc,
&nreturn_vals,
PARAM_IMAGE, image_id,
PARAM_INT32, width,
PARAM_INT32, height,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
*th_width = return_vals[1].data.d_int32;
*th_height = return_vals[2].data.d_int32;
*th_bpp = return_vals[3].data.d_int32;
*th_data_count = return_vals[4].data.d_int32;
l_ptr = return_vals[5].data.d_int8array;
*th_data = g_malloc(*th_data_count);
if((*th_data != NULL) && (l_ptr != NULL))
{
memcpy(*th_data, l_ptr, *th_data_count);
return (0);
}
}
printf("GAP: Error: PDB call of %s failed\n", l_called_proc);
}
else
{
printf("GAP: Warning: Procedure %s not found. %s\n",
l_called_proc,
"(cannot get image thumbnail)");
}
return(-1);
} /* end p_gimp_image_thumbnail */
/* ============================================================================
* Procedures to get/set the video_info_file
* ============================================================================
*/
char *
p_alloc_video_info_name(char *basename)
{
int l_len;
char *l_str;
if(basename == NULL)
{
return(NULL);
}
l_len = strlen(basename);
l_str = g_malloc(l_len+8);
sprintf(l_str, "%svin.gap", basename);
return(l_str);
}
int
p_set_video_info(t_video_info *vin_ptr, char *basename)
{
FILE *l_fp;
char *l_vin_filename;
int l_rc;
l_rc = -1;
l_vin_filename = p_alloc_video_info_name(basename);
if(l_vin_filename)
{
l_fp = fopen(l_vin_filename, "w");
if(l_fp)
{
fprintf(l_fp, "# GIMP / GAP Videoinfo file\n");
fprintf(l_fp, "(framerate %f) # 1.0 upto 100.0 frames per sec\n", (float)vin_ptr->framerate);
fprintf(l_fp, "(timezoom %d) # 1 upto 100 frames\n", (int)vin_ptr->timezoom );
fclose(l_fp);
l_rc = 0;
}
g_free(l_vin_filename);
}
return(l_rc);
}
t_video_info *
p_get_video_info(char *basename)
{
FILE *l_fp;
char *l_vin_filename;
t_video_info *l_vin_ptr;
char l_buf[4000];
int l_len;
l_vin_ptr = g_malloc(sizeof(t_video_info));
l_vin_ptr->timezoom = 1;
l_vin_ptr->framerate = 24.0;
l_vin_filename = p_alloc_video_info_name(basename);
if(l_vin_filename)
{
l_fp = fopen(l_vin_filename, "r");
if(l_fp)
{
while(NULL != fgets(l_buf, 4000-1, l_fp))
{
l_len = strlen("(framerate ");
if(strncmp(l_buf, "(framerate ", l_len) == 0)
{
l_vin_ptr->framerate = atof(&l_buf[l_len]);
}
l_len = strlen("(timezoom ");
if (strncmp(l_buf, "(timezoom ", l_len ) == 0)
{
l_vin_ptr->timezoom = atol(&l_buf[l_len]);
}
}
fclose(l_fp);
}
g_free(l_vin_filename);
}
return(l_vin_ptr);
}

View File

@ -21,6 +21,8 @@
*/
/* revision history:
* version 1.1.14a; 2000/01/06 hof: thumbnail save/load,
* Procedures for video_info file
* version 0.98.00; 1998/11/30 hof: all PDB-calls of GIMP PDB-Procedures
*/
@ -29,6 +31,12 @@
#include "libgimp/gimp.h"
typedef struct t_video_info {
gdouble framerate; /* playback rate in frames per second */
gint32 timezoom;
} t_video_info;
gint p_pdb_procedure_available(char *proc_name);
gint p_get_gimp_selection_bounds (gint32 image_id, gint32 *x1, gint32 *y1, gint32 *x2, gint32 *y2);
gint p_gimp_selection_load (gint32 image_id, gint32 channel_id);
@ -53,4 +61,19 @@ gint32 p_gimp_channel_ops_duplicate (gint32 image_ID);
gint p_gimp_drawable_set_image(gint32 drawable_id, gint32 image_id);
char* p_gimp_gimprc_query(char *key);
gint p_gimp_file_save_thumbnail(gint32 image_id, char* filename);
gint p_gimp_file_load_thumbnail(char* filename, gint32 *th_width, gint32 *th_height, unsigned char **th_data);
gint p_gimp_image_thumbnail(gint32 image_id, gint32 width, gint32 height,
gint32 *th_width, gint32 *th_height, gint32 *th_bpp,
gint32 *th_data_count, unsigned char **th_data);
char *p_alloc_video_info_name(char *basename);
int p_set_video_info(t_video_info *vin_ptr, char *basename);
t_video_info *p_get_video_info(char *basename);
#endif

View File

@ -32,6 +32,8 @@
*/
/* revision history
* 1.1.14a 2000/01/06 hof: gap_range_to_multilayer: use framerate (from video info file) in framenames
* bugfix: gap_range_to_multilayer: first save current frame
* 1.1.10a 1999/10/22 hof: bugfix: have to use the changed PDB-Interface
* for gimp_convert_indexed
* (with extended dither options and extra dialog window)
@ -74,6 +76,7 @@
/* GAP includes */
#include "gap_layer_copy.h"
#include "gap_lib.h"
#include "gap_pdb_calls.h"
#include "gap_match.h"
#include "gap_arr_dialog.h"
#include "gap_resi_dialog.h"
@ -918,9 +921,11 @@ gint32 gap_range_to_multilayer(GRunModeType run_mode, gint32 image_id,
gint32 l_rc;
long l_from, l_to;
t_anim_info *ainfo_ptr;
t_video_info *vin_ptr;
gint32 l_sel_mode;
gint32 l_sel_case;
gint32 l_sel_invert;
gdouble l_framerate;
char l_sel_pattern[MAX_LAYERNAME];
@ -932,8 +937,14 @@ gint32 gap_range_to_multilayer(GRunModeType run_mode, gint32 image_id,
{
if(run_mode == RUN_INTERACTIVE)
{
strcpy(frame_basename, "frame_[####]");
l_framerate = 24.0;
vin_ptr = p_get_video_info(ainfo_ptr->basename);
if(vin_ptr)
{
if(vin_ptr->framerate > 0) l_framerate = vin_ptr->framerate;
g_free(vin_ptr);
}
sprintf(frame_basename, "frame_[####] (%dms)", (int)(1000/l_framerate));
framerate = 0;
l_rc = p_range_to_multilayer_dialog (ainfo_ptr, &l_from, &l_to,
&flatten_mode, &bg_visible,
@ -957,6 +968,9 @@ gint32 gap_range_to_multilayer(GRunModeType run_mode, gint32 image_id,
l_sel_pattern[sizeof(l_sel_pattern) -1] = '\0';
}
if(l_rc >= 0)
{
l_rc = p_save_named_frame(ainfo_ptr->image_id, ainfo_ptr->old_filename);
if(l_rc >= 0)
{
new_image_id = p_frames_to_multilayer(ainfo_ptr, l_from, l_to,
@ -968,6 +982,7 @@ gint32 gap_range_to_multilayer(GRunModeType run_mode, gint32 image_id,
l_rc = new_image_id;
}
}
}
p_free_ainfo(&ainfo_ptr);
}