mirror of https://github.com/GNOME/gimp.git
plug-ins: clean the rest of the file-fli plug-in.
While I am at it, let's just do all the files in there. Other also had a bunch of tabs and wrong coding style.
This commit is contained in:
parent
375b767928
commit
eb21819081
|
@ -158,57 +158,57 @@ query (void)
|
||||||
* Load/export procedures
|
* Load/export procedures
|
||||||
*/
|
*/
|
||||||
gimp_install_procedure (LOAD_PROC,
|
gimp_install_procedure (LOAD_PROC,
|
||||||
"load FLI-movies",
|
"load FLI-movies",
|
||||||
"This is an experimantal plug-in to handle FLI movies",
|
"This is an experimantal plug-in to handle FLI movies",
|
||||||
"Jens Ch. Restemeier",
|
"Jens Ch. Restemeier",
|
||||||
"Jens Ch. Restemeier",
|
"Jens Ch. Restemeier",
|
||||||
"1997",
|
"1997",
|
||||||
N_("AutoDesk FLIC animation"),
|
N_("AutoDesk FLIC animation"),
|
||||||
NULL,
|
NULL,
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (load_args) - 2,
|
G_N_ELEMENTS (load_args) - 2,
|
||||||
G_N_ELEMENTS (load_return_vals),
|
G_N_ELEMENTS (load_return_vals),
|
||||||
load_args,
|
load_args,
|
||||||
load_return_vals);
|
load_return_vals);
|
||||||
|
|
||||||
gimp_register_file_handler_mime (LOAD_PROC, "image/x-flic");
|
gimp_register_file_handler_mime (LOAD_PROC, "image/x-flic");
|
||||||
gimp_register_magic_load_handler (LOAD_PROC,
|
gimp_register_magic_load_handler (LOAD_PROC,
|
||||||
"fli,flc",
|
"fli,flc",
|
||||||
"",
|
"",
|
||||||
"");
|
"");
|
||||||
|
|
||||||
gimp_install_procedure (SAVE_PROC,
|
gimp_install_procedure (SAVE_PROC,
|
||||||
"export FLI-movies",
|
"export FLI-movies",
|
||||||
"This is an experimantal plug-in to handle FLI movies",
|
"This is an experimantal plug-in to handle FLI movies",
|
||||||
"Jens Ch. Restemeier",
|
"Jens Ch. Restemeier",
|
||||||
"Jens Ch. Restemeier",
|
"Jens Ch. Restemeier",
|
||||||
"1997",
|
"1997",
|
||||||
N_("AutoDesk FLIC animation"),
|
N_("AutoDesk FLIC animation"),
|
||||||
"INDEXED,GRAY",
|
"INDEXED,GRAY",
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (save_args), 0,
|
G_N_ELEMENTS (save_args), 0,
|
||||||
save_args, NULL);
|
save_args, NULL);
|
||||||
|
|
||||||
gimp_register_file_handler_mime (SAVE_PROC, "image/x-flic");
|
gimp_register_file_handler_mime (SAVE_PROC, "image/x-flic");
|
||||||
gimp_register_save_handler (SAVE_PROC,
|
gimp_register_save_handler (SAVE_PROC,
|
||||||
"fli,flc",
|
"fli,flc",
|
||||||
"");
|
"");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Utility functions:
|
* Utility functions:
|
||||||
*/
|
*/
|
||||||
gimp_install_procedure (INFO_PROC,
|
gimp_install_procedure (INFO_PROC,
|
||||||
"Get information about a Fli movie",
|
"Get information about a Fli movie",
|
||||||
"This is a experimantal plug-in to handle FLI movies",
|
"This is a experimantal plug-in to handle FLI movies",
|
||||||
"Jens Ch. Restemeier",
|
"Jens Ch. Restemeier",
|
||||||
"Jens Ch. Restemeier",
|
"Jens Ch. Restemeier",
|
||||||
"1997",
|
"1997",
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
GIMP_PLUGIN,
|
GIMP_PLUGIN,
|
||||||
G_N_ELEMENTS (info_args),
|
G_N_ELEMENTS (info_args),
|
||||||
G_N_ELEMENTS (info_return_vals),
|
G_N_ELEMENTS (info_return_vals),
|
||||||
info_args,
|
info_args,
|
||||||
info_return_vals);
|
info_return_vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,82 +243,82 @@ run (const gchar *name,
|
||||||
if (strcmp (name, LOAD_PROC) == 0)
|
if (strcmp (name, LOAD_PROC) == 0)
|
||||||
{
|
{
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
/*
|
/*
|
||||||
* check for valid parameters:
|
* check for valid parameters:
|
||||||
* (Or can I trust GIMP ?)
|
* (Or can I trust GIMP ?)
|
||||||
*/
|
*/
|
||||||
if ((nparams < G_N_ELEMENTS (load_args) - 2) ||
|
if ((nparams < G_N_ELEMENTS (load_args) - 2) ||
|
||||||
(G_N_ELEMENTS (load_args) < nparams))
|
(G_N_ELEMENTS (load_args) < nparams))
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (pc = 0; pc < G_N_ELEMENTS (load_args) - 2; pc++)
|
for (pc = 0; pc < G_N_ELEMENTS (load_args) - 2; pc++)
|
||||||
{
|
{
|
||||||
if (load_args[pc].type != param[pc].type)
|
if (load_args[pc].type != param[pc].type)
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (pc = G_N_ELEMENTS (load_args) - 2; pc < nparams; pc++)
|
for (pc = G_N_ELEMENTS (load_args) - 2; pc < nparams; pc++)
|
||||||
{
|
{
|
||||||
if (load_args[pc].type != param[pc].type)
|
if (load_args[pc].type != param[pc].type)
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
to_frame = ((nparams < G_N_ELEMENTS (load_args) - 1) ?
|
to_frame = ((nparams < G_N_ELEMENTS (load_args) - 1) ?
|
||||||
1 : param[3].data.d_int32);
|
1 : param[3].data.d_int32);
|
||||||
from_frame = ((nparams < G_N_ELEMENTS (load_args)) ?
|
from_frame = ((nparams < G_N_ELEMENTS (load_args)) ?
|
||||||
-1 : param[4].data.d_int32);
|
-1 : param[4].data.d_int32);
|
||||||
|
|
||||||
image_ID = load_image (param[1].data.d_string,
|
image_ID = load_image (param[1].data.d_string,
|
||||||
from_frame, to_frame, &error);
|
from_frame, to_frame, &error);
|
||||||
|
|
||||||
if (image_ID != -1)
|
if (image_ID != -1)
|
||||||
{
|
{
|
||||||
*nreturn_vals = 2;
|
*nreturn_vals = 2;
|
||||||
values[1].type = GIMP_PDB_IMAGE;
|
values[1].type = GIMP_PDB_IMAGE;
|
||||||
values[1].data.d_image = image_ID;
|
values[1].data.d_image = image_ID;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
if (load_dialog (param[1].data.d_string))
|
if (load_dialog (param[1].data.d_string))
|
||||||
{
|
{
|
||||||
image_ID = load_image (param[1].data.d_string,
|
image_ID = load_image (param[1].data.d_string,
|
||||||
from_frame, to_frame, &error);
|
from_frame, to_frame, &error);
|
||||||
|
|
||||||
if (image_ID != -1)
|
if (image_ID != -1)
|
||||||
{
|
{
|
||||||
*nreturn_vals = 2;
|
*nreturn_vals = 2;
|
||||||
values[1].type = GIMP_PDB_IMAGE;
|
values[1].type = GIMP_PDB_IMAGE;
|
||||||
values[1].data.d_image = image_ID;
|
values[1].data.d_image = image_ID;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CANCEL;
|
status = GIMP_PDB_CANCEL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp (name, SAVE_PROC) == 0)
|
else if (strcmp (name, SAVE_PROC) == 0)
|
||||||
{
|
{
|
||||||
|
@ -326,62 +326,62 @@ run (const gchar *name,
|
||||||
drawable_ID = param[2].data.d_int32;
|
drawable_ID = param[2].data.d_int32;
|
||||||
|
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
if (nparams != G_N_ELEMENTS (save_args))
|
if (nparams != G_N_ELEMENTS (save_args))
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (pc = 0; pc < G_N_ELEMENTS (save_args); pc++)
|
for (pc = 0; pc < G_N_ELEMENTS (save_args); pc++)
|
||||||
{
|
{
|
||||||
if (save_args[pc].type!=param[pc].type)
|
if (save_args[pc].type!=param[pc].type)
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! save_image (param[3].data.d_string, image_ID,
|
if (! save_image (param[3].data.d_string, image_ID,
|
||||||
param[5].data.d_int32,
|
param[5].data.d_int32,
|
||||||
param[6].data.d_int32, &error))
|
param[6].data.d_int32, &error))
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
gimp_ui_init (PLUG_IN_BINARY, FALSE);
|
gimp_ui_init (PLUG_IN_BINARY, FALSE);
|
||||||
|
|
||||||
export = gimp_export_image (&image_ID, &drawable_ID, "FLI",
|
export = gimp_export_image (&image_ID, &drawable_ID, "FLI",
|
||||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||||
GIMP_EXPORT_CAN_HANDLE_ALPHA |
|
GIMP_EXPORT_CAN_HANDLE_ALPHA |
|
||||||
GIMP_EXPORT_CAN_HANDLE_LAYERS);
|
GIMP_EXPORT_CAN_HANDLE_LAYERS);
|
||||||
|
|
||||||
if (export == GIMP_EXPORT_CANCEL)
|
if (export == GIMP_EXPORT_CANCEL)
|
||||||
{
|
{
|
||||||
values[0].data.d_status = GIMP_PDB_CANCEL;
|
values[0].data.d_status = GIMP_PDB_CANCEL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save_dialog (param[1].data.d_image))
|
if (save_dialog (param[1].data.d_image))
|
||||||
{
|
{
|
||||||
if (! save_image (param[3].data.d_string,
|
if (! save_image (param[3].data.d_string,
|
||||||
image_ID, from_frame, to_frame, &error))
|
image_ID, from_frame, to_frame, &error))
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CANCEL;
|
status = GIMP_PDB_CANCEL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (export == GIMP_EXPORT_EXPORT)
|
if (export == GIMP_EXPORT_EXPORT)
|
||||||
gimp_image_delete (image_ID);
|
gimp_image_delete (image_ID);
|
||||||
}
|
}
|
||||||
else if (strcmp (name, INFO_PROC) == 0)
|
else if (strcmp (name, INFO_PROC) == 0)
|
||||||
{
|
{
|
||||||
|
@ -391,34 +391,34 @@ run (const gchar *name,
|
||||||
* check for valid parameters;
|
* check for valid parameters;
|
||||||
*/
|
*/
|
||||||
if (nparams != G_N_ELEMENTS (info_args))
|
if (nparams != G_N_ELEMENTS (info_args))
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
for (pc = 0; pc < G_N_ELEMENTS (save_args); pc++)
|
for (pc = 0; pc < G_N_ELEMENTS (save_args); pc++)
|
||||||
{
|
{
|
||||||
if (info_args[pc].type != param[pc].type)
|
if (info_args[pc].type != param[pc].type)
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_CALLING_ERROR;
|
status = GIMP_PDB_CALLING_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
if (get_info (param[0].data.d_string,
|
if (get_info (param[0].data.d_string,
|
||||||
&width, &height, &frames, &error))
|
&width, &height, &frames, &error))
|
||||||
{
|
{
|
||||||
*nreturn_vals = 4;
|
*nreturn_vals = 4;
|
||||||
values[1].type = GIMP_PDB_INT32;
|
values[1].type = GIMP_PDB_INT32;
|
||||||
values[1].data.d_int32 = width;
|
values[1].data.d_int32 = width;
|
||||||
values[2].type = GIMP_PDB_INT32;
|
values[2].type = GIMP_PDB_INT32;
|
||||||
values[2].data.d_int32 = height;
|
values[2].data.d_int32 = height;
|
||||||
values[3].type = GIMP_PDB_INT32;
|
values[3].type = GIMP_PDB_INT32;
|
||||||
values[3].data.d_int32 = frames;
|
values[3].data.d_int32 = frames;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -444,9 +444,9 @@ run (const gchar *name,
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
get_info (const gchar *filename,
|
get_info (const gchar *filename,
|
||||||
gint32 *width,
|
gint32 *width,
|
||||||
gint32 *height,
|
gint32 *height,
|
||||||
gint32 *frames,
|
gint32 *frames,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
@ -479,8 +479,8 @@ get_info (const gchar *filename,
|
||||||
*/
|
*/
|
||||||
static gint32
|
static gint32
|
||||||
load_image (const gchar *filename,
|
load_image (const gchar *filename,
|
||||||
gint32 from_frame,
|
gint32 from_frame,
|
||||||
gint32 to_frame,
|
gint32 to_frame,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
@ -563,8 +563,8 @@ load_image (const gchar *filename,
|
||||||
gchar *name_buf = g_strdup_printf (_("Frame (%i)"), cnt);
|
gchar *name_buf = g_strdup_printf (_("Frame (%i)"), cnt);
|
||||||
|
|
||||||
layer_ID = gimp_layer_new (image_id, name_buf,
|
layer_ID = gimp_layer_new (image_id, name_buf,
|
||||||
fli_header.width, fli_header.height,
|
fli_header.width, fli_header.height,
|
||||||
GIMP_INDEXED_IMAGE,
|
GIMP_INDEXED_IMAGE,
|
||||||
100,
|
100,
|
||||||
gimp_image_get_default_new_layer_mode (image_id));
|
gimp_image_get_default_new_layer_mode (image_id));
|
||||||
g_free (name_buf);
|
g_free (name_buf);
|
||||||
|
@ -581,15 +581,15 @@ load_image (const gchar *filename,
|
||||||
g_object_unref (buffer);
|
g_object_unref (buffer);
|
||||||
|
|
||||||
if (cnt > 0)
|
if (cnt > 0)
|
||||||
gimp_layer_add_alpha (layer_ID);
|
gimp_layer_add_alpha (layer_ID);
|
||||||
|
|
||||||
gimp_image_insert_layer (image_id, layer_ID, -1, 0);
|
gimp_image_insert_layer (image_id, layer_ID, -1, 0);
|
||||||
|
|
||||||
if (cnt < to_frame)
|
if (cnt < to_frame)
|
||||||
{
|
{
|
||||||
memcpy (ocm, cm, 768);
|
memcpy (ocm, cm, 768);
|
||||||
fb_x = fb; fb = ofb; ofb = fb_x;
|
fb_x = fb; fb = ofb; ofb = fb_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_progress_update ((double) cnt + 1 / (double)(to_frame - from_frame));
|
gimp_progress_update ((double) cnt + 1 / (double)(to_frame - from_frame));
|
||||||
}
|
}
|
||||||
|
@ -615,9 +615,9 @@ load_image (const gchar *filename,
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
save_image (const gchar *filename,
|
save_image (const gchar *filename,
|
||||||
gint32 image_id,
|
gint32 image_id,
|
||||||
gint32 from_frame,
|
gint32 from_frame,
|
||||||
gint32 to_frame,
|
gint32 to_frame,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
@ -675,9 +675,9 @@ save_image (const gchar *filename,
|
||||||
case GIMP_GRAY:
|
case GIMP_GRAY:
|
||||||
/* build grayscale palette */
|
/* build grayscale palette */
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
cm[i*3+0] = cm[i*3+1] = cm[i*3+2] = i;
|
cm[i*3+0] = cm[i*3+1] = cm[i*3+2] = i;
|
||||||
}
|
}
|
||||||
bg = GIMP_RGB_LUMINANCE (red, green, blue) + 0.5;
|
bg = GIMP_RGB_LUMINANCE (red, green, blue) + 0.5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -686,28 +686,28 @@ save_image (const gchar *filename,
|
||||||
bg = 0;
|
bg = 0;
|
||||||
cmap = gimp_image_get_colormap (image_id, &colors);
|
cmap = gimp_image_get_colormap (image_id, &colors);
|
||||||
for (i = 0; i < MIN (colors, 256); i++)
|
for (i = 0; i < MIN (colors, 256); i++)
|
||||||
{
|
{
|
||||||
cm[i*3+0] = cmap[i*3+0];
|
cm[i*3+0] = cmap[i*3+0];
|
||||||
cm[i*3+1] = cmap[i*3+1];
|
cm[i*3+1] = cmap[i*3+1];
|
||||||
cm[i*3+2] = cmap[i*3+2];
|
cm[i*3+2] = cmap[i*3+2];
|
||||||
|
|
||||||
diff = red - cm[i*3+0];
|
diff = red - cm[i*3+0];
|
||||||
sum = SQR (diff);
|
sum = SQR (diff);
|
||||||
diff = green - cm[i*3+1];
|
diff = green - cm[i*3+1];
|
||||||
sum += SQR (diff);
|
sum += SQR (diff);
|
||||||
diff = blue - cm[i*3+2];
|
diff = blue - cm[i*3+2];
|
||||||
sum += SQR (diff);
|
sum += SQR (diff);
|
||||||
|
|
||||||
if (sum < max)
|
if (sum < max)
|
||||||
{
|
{
|
||||||
bg = i;
|
bg = i;
|
||||||
max = sum;
|
max = sum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = colors; i < 256; i++)
|
for (i = colors; i < 256; i++)
|
||||||
{
|
{
|
||||||
cm[i*3+0] = cm[i*3+1] = cm[i*3+2] = i;
|
cm[i*3+0] = cm[i*3+1] = cm[i*3+2] = i;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -721,8 +721,8 @@ save_image (const gchar *filename,
|
||||||
/*
|
/*
|
||||||
* First build the fli header.
|
* First build the fli header.
|
||||||
*/
|
*/
|
||||||
fli_header.filesize = 0; /* will be fixed when writing the header */
|
fli_header.filesize = 0; /* will be fixed when writing the header */
|
||||||
fli_header.frames = 0; /* will be fixed during the write */
|
fli_header.frames = 0; /* will be fixed during the write */
|
||||||
fli_header.width = gimp_image_width (image_id);
|
fli_header.width = gimp_image_width (image_id);
|
||||||
fli_header.height = gimp_image_height (image_id);
|
fli_header.height = gimp_image_height (image_id);
|
||||||
|
|
||||||
|
@ -792,38 +792,38 @@ save_image (const gchar *filename,
|
||||||
|
|
||||||
/* now paste it into the framebuffer, with the necessary offset */
|
/* now paste it into the framebuffer, with the necessary offset */
|
||||||
for (yc = 0, yy = offset_y; yc < rows; yc++, yy++)
|
for (yc = 0, yy = offset_y; yc < rows; yc++, yy++)
|
||||||
{
|
{
|
||||||
if (yy >= 0 && yy < fli_header.height)
|
if (yy >= 0 && yy < fli_header.height)
|
||||||
{
|
{
|
||||||
gegl_buffer_get (buffer, GEGL_RECTANGLE (0, yc, cols, 1), 1.0,
|
gegl_buffer_get (buffer, GEGL_RECTANGLE (0, yc, cols, 1), 1.0,
|
||||||
format, src_row,
|
format, src_row,
|
||||||
GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
|
GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
|
||||||
|
|
||||||
for (xc = 0, xx = offset_x; xc < cols; xc++, xx++)
|
for (xc = 0, xx = offset_x; xc < cols; xc++, xx++)
|
||||||
{
|
{
|
||||||
if (xx >= 0 && xx < fli_header.width)
|
if (xx >= 0 && xx < fli_header.width)
|
||||||
fb[yy * fli_header.width + xx] = src_row[xc * bytes];
|
fb[yy * fli_header.width + xx] = src_row[xc * bytes];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (src_row);
|
g_free (src_row);
|
||||||
g_object_unref (buffer);
|
g_object_unref (buffer);
|
||||||
|
|
||||||
/* save the frame */
|
/* save the frame */
|
||||||
if (cnt > from_frame)
|
if (cnt > from_frame)
|
||||||
{
|
{
|
||||||
/* save frame, allow all codecs */
|
/* save frame, allow all codecs */
|
||||||
fli_write_frame (file, &fli_header, ofb, cm, fb, cm, W_ALL);
|
fli_write_frame (file, &fli_header, ofb, cm, fb, cm, W_ALL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* save first frame, no delta information, allow all codecs */
|
/* save first frame, no delta information, allow all codecs */
|
||||||
fli_write_frame (file, &fli_header, NULL, NULL, fb, cm, W_ALL);
|
fli_write_frame (file, &fli_header, NULL, NULL, fb, cm, W_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cnt < to_frame)
|
if (cnt < to_frame)
|
||||||
memcpy (ofb, fb, fli_header.width * fli_header.height);
|
memcpy (ofb, fb, fli_header.width * fli_header.height);
|
||||||
|
|
||||||
gimp_progress_update ((double) cnt + 1 / (double)(to_frame - from_frame));
|
gimp_progress_update ((double) cnt + 1 / (double)(to_frame - from_frame));
|
||||||
}
|
}
|
||||||
|
@ -865,12 +865,12 @@ load_dialog (const gchar *filename)
|
||||||
|
|
||||||
dialog = gimp_dialog_new (_("GFLI 1.3 - Load framestack"), PLUG_IN_ROLE,
|
dialog = gimp_dialog_new (_("GFLI 1.3 - Load framestack"), PLUG_IN_ROLE,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
gimp_standard_help_func, LOAD_PROC,
|
gimp_standard_help_func, LOAD_PROC,
|
||||||
|
|
||||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||||
_("_Open"), GTK_RESPONSE_OK,
|
_("_Open"), GTK_RESPONSE_OK,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||||
GTK_RESPONSE_OK,
|
GTK_RESPONSE_OK,
|
||||||
|
@ -893,8 +893,8 @@ load_dialog (const gchar *filename)
|
||||||
spinbutton = gtk_spin_button_new (adj, 1, 0);
|
spinbutton = gtk_spin_button_new (adj, 1, 0);
|
||||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||||
C_("frame-range", "From:"), 0.0, 0.5,
|
C_("frame-range", "From:"), 0.0, 0.5,
|
||||||
spinbutton, 1, TRUE);
|
spinbutton, 1, TRUE);
|
||||||
g_signal_connect (adj, "value-changed",
|
g_signal_connect (adj, "value-changed",
|
||||||
G_CALLBACK (gimp_int_adjustment_update),
|
G_CALLBACK (gimp_int_adjustment_update),
|
||||||
&from_frame);
|
&from_frame);
|
||||||
|
@ -903,8 +903,8 @@ load_dialog (const gchar *filename)
|
||||||
spinbutton = gtk_spin_button_new (adj, 1, 0);
|
spinbutton = gtk_spin_button_new (adj, 1, 0);
|
||||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||||
C_("frame-range", "To:"), 0.0, 0.5,
|
C_("frame-range", "To:"), 0.0, 0.5,
|
||||||
spinbutton, 1, TRUE);
|
spinbutton, 1, TRUE);
|
||||||
g_signal_connect (adj, "value-changed",
|
g_signal_connect (adj, "value-changed",
|
||||||
G_CALLBACK (gimp_int_adjustment_update),
|
G_CALLBACK (gimp_int_adjustment_update),
|
||||||
&to_frame);
|
&to_frame);
|
||||||
|
@ -951,8 +951,8 @@ save_dialog (gint32 image_id)
|
||||||
spinbutton = gtk_spin_button_new (adj, 1, 0);
|
spinbutton = gtk_spin_button_new (adj, 1, 0);
|
||||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||||
C_("frame-range", "From:"), 0.0, 0.5,
|
C_("frame-range", "From:"), 0.0, 0.5,
|
||||||
spinbutton, 1, TRUE);
|
spinbutton, 1, TRUE);
|
||||||
g_signal_connect (adj, "value-changed",
|
g_signal_connect (adj, "value-changed",
|
||||||
G_CALLBACK (gimp_int_adjustment_update),
|
G_CALLBACK (gimp_int_adjustment_update),
|
||||||
&from_frame);
|
&from_frame);
|
||||||
|
@ -961,8 +961,8 @@ save_dialog (gint32 image_id)
|
||||||
spinbutton = gtk_spin_button_new (adj, 1, 0);
|
spinbutton = gtk_spin_button_new (adj, 1, 0);
|
||||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
||||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||||
C_("frame-range", "To:"), 0.0, 0.5,
|
C_("frame-range", "To:"), 0.0, 0.5,
|
||||||
spinbutton, 1, TRUE);
|
spinbutton, 1, TRUE);
|
||||||
g_signal_connect (adj, "value-changed",
|
g_signal_connect (adj, "value-changed",
|
||||||
G_CALLBACK (gimp_int_adjustment_update),
|
G_CALLBACK (gimp_int_adjustment_update),
|
||||||
&to_frame);
|
&to_frame);
|
||||||
|
|
|
@ -20,82 +20,134 @@
|
||||||
|
|
||||||
/** structures */
|
/** structures */
|
||||||
|
|
||||||
typedef struct _fli_header {
|
typedef struct _fli_header
|
||||||
unsigned long filesize;
|
{
|
||||||
unsigned short magic;
|
unsigned long filesize;
|
||||||
unsigned short frames;
|
unsigned short magic;
|
||||||
unsigned short width;
|
unsigned short frames;
|
||||||
unsigned short height;
|
unsigned short width;
|
||||||
unsigned short depth;
|
unsigned short height;
|
||||||
unsigned short flags;
|
unsigned short depth;
|
||||||
unsigned long speed;
|
unsigned short flags;
|
||||||
unsigned long created;
|
unsigned long speed;
|
||||||
unsigned long creator;
|
unsigned long created;
|
||||||
unsigned long updated;
|
unsigned long creator;
|
||||||
unsigned short aspect_x, aspect_y;
|
unsigned long updated;
|
||||||
unsigned long oframe1, oframe2;
|
unsigned short aspect_x, aspect_y;
|
||||||
|
unsigned long oframe1, oframe2;
|
||||||
} s_fli_header;
|
} s_fli_header;
|
||||||
|
|
||||||
typedef struct _fli_frame {
|
typedef struct _fli_frame
|
||||||
unsigned long size;
|
{
|
||||||
unsigned short magic;
|
unsigned long size;
|
||||||
unsigned short chunks;
|
unsigned short magic;
|
||||||
|
unsigned short chunks;
|
||||||
} s_fli_frame;
|
} s_fli_frame;
|
||||||
|
|
||||||
typedef struct _fli_chunk {
|
typedef struct _fli_chunk
|
||||||
unsigned long size;
|
{
|
||||||
unsigned short magic;
|
unsigned long size;
|
||||||
unsigned char *data;
|
unsigned short magic;
|
||||||
|
unsigned char *data;
|
||||||
} s_fli_chunk;
|
} s_fli_chunk;
|
||||||
|
|
||||||
/** chunk magics */
|
/** chunk magics */
|
||||||
#define NO_HEADER 0
|
#define NO_HEADER 0
|
||||||
#define HEADER_FLI 0xAF11
|
#define HEADER_FLI 0xAF11
|
||||||
#define HEADER_FLC 0xAF12
|
#define HEADER_FLC 0xAF12
|
||||||
#define FRAME 0xF1FA
|
#define FRAME 0xF1FA
|
||||||
|
|
||||||
/** codec magics */
|
/** codec magics */
|
||||||
#define FLI_COLOR 11
|
#define FLI_COLOR 11
|
||||||
#define FLI_BLACK 13
|
#define FLI_BLACK 13
|
||||||
#define FLI_BRUN 15
|
#define FLI_BRUN 15
|
||||||
#define FLI_COPY 16
|
#define FLI_COPY 16
|
||||||
#define FLI_LC 12
|
#define FLI_LC 12
|
||||||
#define FLI_LC_2 7
|
#define FLI_LC_2 7
|
||||||
#define FLI_COLOR_2 4
|
#define FLI_COLOR_2 4
|
||||||
#define FLI_MINI 18
|
#define FLI_MINI 18
|
||||||
|
|
||||||
/** codec masks */
|
/** codec masks */
|
||||||
#define W_COLOR 0x0001
|
#define W_COLOR 0x0001
|
||||||
#define W_BLACK 0x0002
|
#define W_BLACK 0x0002
|
||||||
#define W_BRUN 0x0004
|
#define W_BRUN 0x0004
|
||||||
#define W_COPY 0x0008
|
#define W_COPY 0x0008
|
||||||
#define W_LC 0x0010
|
#define W_LC 0x0010
|
||||||
#define W_LC_2 0x0020
|
#define W_LC_2 0x0020
|
||||||
#define W_COLOR_2 0x0040
|
#define W_COLOR_2 0x0040
|
||||||
#define W_MINI 0x0080
|
#define W_MINI 0x0080
|
||||||
#define W_ALL 0xFFFF
|
#define W_ALL 0xFFFF
|
||||||
|
|
||||||
/** functions */
|
/** functions */
|
||||||
void fli_read_header(FILE *f, s_fli_header *fli_header);
|
void fli_read_header (FILE *f,
|
||||||
void fli_read_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *old_cmap, unsigned char *framebuf, unsigned char *cmap);
|
s_fli_header *fli_header);
|
||||||
|
void fli_read_frame (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *old_framebuf,
|
||||||
|
unsigned char *old_cmap,
|
||||||
|
unsigned char *framebuf,
|
||||||
|
unsigned char *cmap);
|
||||||
|
|
||||||
void fli_read_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap);
|
void fli_read_color (FILE *f,
|
||||||
void fli_read_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap);
|
s_fli_header *fli_header,
|
||||||
void fli_read_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
unsigned char *old_cmap,
|
||||||
void fli_read_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
unsigned char *cmap);
|
||||||
void fli_read_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
void fli_read_color_2 (FILE *f,
|
||||||
void fli_read_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf);
|
s_fli_header *fli_header,
|
||||||
void fli_read_lc_2(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf);
|
unsigned char *old_cmap,
|
||||||
|
unsigned char *cmap);
|
||||||
|
void fli_read_black (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
void fli_read_brun (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
void fli_read_copy (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
void fli_read_lc (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *old_framebuf,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
void fli_read_lc_2 (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *old_framebuf,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
|
||||||
void fli_write_header(FILE *f, s_fli_header *fli_header);
|
void fli_write_header (FILE *f,
|
||||||
void fli_write_frame(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *old_cmap, unsigned char *framebuf, unsigned char *cmap, unsigned short codec_mask);
|
s_fli_header *fli_header);
|
||||||
|
void fli_write_frame (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *old_framebuf,
|
||||||
|
unsigned char *old_cmap,
|
||||||
|
unsigned char *framebuf,
|
||||||
|
unsigned char *cmap,
|
||||||
|
unsigned short codec_mask);
|
||||||
|
|
||||||
int fli_write_color(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap);
|
int fli_write_color (FILE *f,
|
||||||
int fli_write_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap);
|
s_fli_header *fli_header,
|
||||||
void fli_write_black(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
unsigned char *old_cmap,
|
||||||
void fli_write_brun(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
unsigned char *cmap);
|
||||||
void fli_write_copy(FILE *f, s_fli_header *fli_header, unsigned char *framebuf);
|
int fli_write_color_2 (FILE *f,
|
||||||
void fli_write_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf);
|
s_fli_header *fli_header,
|
||||||
void fli_write_lc_2(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf);
|
unsigned char *old_cmap,
|
||||||
|
unsigned char *cmap);
|
||||||
|
void fli_write_black (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
void fli_write_brun (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
void fli_write_copy (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
void fli_write_lc (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *old_framebuf,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
void fli_write_lc_2 (FILE *f,
|
||||||
|
s_fli_header *fli_header,
|
||||||
|
unsigned char *old_framebuf,
|
||||||
|
unsigned char *framebuf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue