Commit ff2d22d9 authored by Jehan's avatar Jehan

plug-ins: a lot of coding style cleanup in file-dds.

Still a lot more to do but pushing WIP to not have it wasted if more
commits come in from others.
Also got rid of some global variables.
parent 74c9d835
/* /*
DDS GIMP plugin * DDS GIMP plugin
*
Copyright (C) 2004-2012 Shawn Kirst <skirst@gmail.com>, * Copyright (C) 2004-2012 Shawn Kirst <skirst@gmail.com>,
with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified. * with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified.
*
This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public * modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. * version 2 of the License, or (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. * General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to * along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor * the Free Software Foundation, 51 Franklin Street, Fifth Floor
Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include "config.h" #include "config.h"
...@@ -37,32 +37,44 @@ ...@@ -37,32 +37,44 @@
#include "dds.h" #include "dds.h"
#include "misc.h" #include "misc.h"
FILE *errFile; static void query (void);
gchar *prog_name = "dds"; static void run (const gchar *name,
gchar *filename; gint nparams,
gint interactive_dds; const GimpParam *param,
gint *nreturn_vals,
static void query(void); GimpParam **return_vals);
static void run(const gchar *name, gint nparams, const GimpParam *param,
gint *nreturn_vals, GimpParam **return_vals);
GimpPlugInInfo PLUG_IN_INFO = GimpPlugInInfo PLUG_IN_INFO =
{ {
0, 0, query, run 0,
0,
query,
run
}; };
DDSWriteVals dds_write_vals = DDSWriteVals dds_write_vals =
{ {
DDS_COMPRESS_NONE, DDS_MIPMAP_NONE, DDS_SAVE_SELECTED_LAYER, DDS_COMPRESS_NONE,
DDS_FORMAT_DEFAULT, -1, DDS_MIPMAP_FILTER_DEFAULT, DDS_MIPMAP_WRAP_DEFAULT, DDS_MIPMAP_NONE,
0, 0, 0.0, 0, 0, DDS_SAVE_SELECTED_LAYER,
0, 0.5 DDS_FORMAT_DEFAULT,
-1,
DDS_MIPMAP_FILTER_DEFAULT,
DDS_MIPMAP_WRAP_DEFAULT,
0,
0,
0.0,
0,
0,
0,
0.5
}; };
DDSReadVals dds_read_vals = DDSReadVals dds_read_vals =
{ {
1, 1 1,
1
}; };
static GimpParamDef load_args[] = static GimpParamDef load_args[] =
...@@ -73,6 +85,7 @@ static GimpParamDef load_args[] = ...@@ -73,6 +85,7 @@ static GimpParamDef load_args[] =
{GIMP_PDB_INT32, "load_mipmaps", "Load mipmaps if present"}, {GIMP_PDB_INT32, "load_mipmaps", "Load mipmaps if present"},
{GIMP_PDB_INT32, "decode_images", "Decode YCoCg/AExp images when detected"} {GIMP_PDB_INT32, "decode_images", "Decode YCoCg/AExp images when detected"}
}; };
static GimpParamDef load_return_vals[] = static GimpParamDef load_return_vals[] =
{ {
{GIMP_PDB_IMAGE, "image", "Output image"} {GIMP_PDB_IMAGE, "image", "Output image"}
...@@ -107,9 +120,10 @@ static GimpParamDef decode_args[] = ...@@ -107,9 +120,10 @@ static GimpParamDef decode_args[] =
{GIMP_PDB_DRAWABLE, "drawable", "Drawable to save"} {GIMP_PDB_DRAWABLE, "drawable", "Drawable to save"}
}; };
MAIN() MAIN ()
static void query(void) static void
query (void)
{ {
gimp_install_procedure (LOAD_PROC, gimp_install_procedure (LOAD_PROC,
"Loads files in DDS image format", "Loads files in DDS image format",
...@@ -120,8 +134,8 @@ static void query(void) ...@@ -120,8 +134,8 @@ static void query(void)
N_("DDS image"), N_("DDS image"),
0, 0,
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS(load_args), G_N_ELEMENTS (load_args),
G_N_ELEMENTS(load_return_vals), G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals); load_args, load_return_vals);
gimp_register_file_handler_mime (LOAD_PROC, "image/dds"); gimp_register_file_handler_mime (LOAD_PROC, "image/dds");
...@@ -139,7 +153,7 @@ static void query(void) ...@@ -139,7 +153,7 @@ static void query(void)
N_("DDS image"), N_("DDS image"),
"INDEXED, GRAY, RGB", "INDEXED, GRAY, RGB",
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS(save_args), 0, G_N_ELEMENTS (save_args), 0,
save_args, 0); save_args, 0);
gimp_register_file_handler_mime (SAVE_PROC, "image/dds"); gimp_register_file_handler_mime (SAVE_PROC, "image/dds");
...@@ -156,7 +170,7 @@ static void query(void) ...@@ -156,7 +170,7 @@ static void query(void)
N_("Decode YCoCg"), N_("Decode YCoCg"),
"RGBA", "RGBA",
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS(decode_args), 0, G_N_ELEMENTS (decode_args), 0,
decode_args, 0); decode_args, 0);
/*gimp_plugin_menu_register (DECODE_YCOCG_PROC, "<Image>/Filters/Colors");*/ /*gimp_plugin_menu_register (DECODE_YCOCG_PROC, "<Image>/Filters/Colors");*/
...@@ -169,7 +183,7 @@ static void query(void) ...@@ -169,7 +183,7 @@ static void query(void)
N_("Decode YCoCg (scaled)"), N_("Decode YCoCg (scaled)"),
"RGBA", "RGBA",
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS(decode_args), 0, G_N_ELEMENTS (decode_args), 0,
decode_args, 0); decode_args, 0);
/*gimp_plugin_menu_register (DECODE_YCOCG_SCALED_PROC, "<Image>/Filters/Colors");*/ /*gimp_plugin_menu_register (DECODE_YCOCG_SCALED_PROC, "<Image>/Filters/Colors");*/
...@@ -182,201 +196,201 @@ static void query(void) ...@@ -182,201 +196,201 @@ static void query(void)
N_("Decode Alpha exponent"), N_("Decode Alpha exponent"),
"RGBA", "RGBA",
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS(decode_args), 0, G_N_ELEMENTS (decode_args), 0,
decode_args, 0); decode_args, 0);
/*gimp_plugin_menu_register (DECODE_ALPHA_EXP_PROC, "<Image>/Filters/Colors");*/ /*gimp_plugin_menu_register (DECODE_ALPHA_EXP_PROC, "<Image>/Filters/Colors");*/
} }
static void run(const gchar *name, gint nparams, const GimpParam *param, static void
gint *nreturn_vals, GimpParam **return_vals) run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{ {
static GimpParam values[2]; static GimpParam values[2];
GimpRunMode run_mode; GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 imageID; gint32 imageID;
gint32 drawableID; gint32 drawableID;
GimpExportReturn export = GIMP_EXPORT_CANCEL; GimpExportReturn export = GIMP_EXPORT_CANCEL;
gegl_init(NULL, NULL); gegl_init (NULL, NULL);
run_mode = param[0].data.d_int32; run_mode = param[0].data.d_int32;
*nreturn_vals = 1; *nreturn_vals = 1;
*return_vals = values; *return_vals = values;
values[0].type = GIMP_PDB_STATUS; values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
if(!strcmp(name, LOAD_PROC)) if (!strcmp (name, LOAD_PROC))
{ {
switch(run_mode) switch (run_mode)
{ {
case GIMP_RUN_INTERACTIVE: case GIMP_RUN_INTERACTIVE:
gimp_ui_init("dds", 0); gimp_ui_init ("dds", 0);
interactive_dds = 1; gimp_get_data (LOAD_PROC, &dds_read_vals);
gimp_get_data(LOAD_PROC, &dds_read_vals); break;
break; case GIMP_RUN_NONINTERACTIVE:
case GIMP_RUN_NONINTERACTIVE: dds_read_vals.mipmaps = param[3].data.d_int32;
interactive_dds = 0; dds_read_vals.decode_images = param[4].data.d_int32;
dds_read_vals.mipmaps = param[3].data.d_int32; if (nparams != G_N_ELEMENTS (load_args))
dds_read_vals.decode_images = param[4].data.d_int32; status = GIMP_PDB_CALLING_ERROR;
if(nparams != G_N_ELEMENTS(load_args)) break;
status = GIMP_PDB_CALLING_ERROR; default:
break; break;
default: }
break;
} if (status == GIMP_PDB_SUCCESS)
{
if(status == GIMP_PDB_SUCCESS) status = read_dds (param[1].data.d_string, &imageID,
{ run_mode == GIMP_RUN_INTERACTIVE);
status = read_dds(param[1].data.d_string, &imageID); if (status == GIMP_PDB_SUCCESS && imageID != -1)
if(status == GIMP_PDB_SUCCESS && imageID != -1) {
{ *nreturn_vals = 2;
*nreturn_vals = 2; values[1].type = GIMP_PDB_IMAGE;
values[1].type = GIMP_PDB_IMAGE; values[1].data.d_image = imageID;
values[1].data.d_image = imageID; if (run_mode == GIMP_RUN_INTERACTIVE)
if(interactive_dds) gimp_set_data (LOAD_PROC, &dds_read_vals, sizeof (dds_read_vals));
gimp_set_data(LOAD_PROC, &dds_read_vals, sizeof(dds_read_vals)); }
} else if (status != GIMP_PDB_CANCEL)
else if(status != GIMP_PDB_CANCEL) status = GIMP_PDB_EXECUTION_ERROR;
status = GIMP_PDB_EXECUTION_ERROR; }
} }
} else if (!strcmp (name, SAVE_PROC))
else if(!strcmp(name, SAVE_PROC)) {
{ imageID = param[1].data.d_int32;
imageID = param[1].data.d_int32; drawableID = param[2].data.d_int32;
drawableID = param[2].data.d_int32;
switch (run_mode)
switch(run_mode) {
{ case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_INTERACTIVE: case GIMP_RUN_WITH_LAST_VALS:
case GIMP_RUN_WITH_LAST_VALS: gimp_ui_init ("dds", 0);
gimp_ui_init("dds", 0); export = gimp_export_image (&imageID, &drawableID, "DDS",
export = gimp_export_image(&imageID, &drawableID, "DDS", (GIMP_EXPORT_CAN_HANDLE_RGB |
(GIMP_EXPORT_CAN_HANDLE_RGB | GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_GRAY | GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_INDEXED | 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; }
} default:
default: break;
break; }
}
switch (run_mode)
switch(run_mode) {
{ case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_INTERACTIVE: gimp_get_data (SAVE_PROC, &dds_write_vals);
gimp_get_data(SAVE_PROC, &dds_write_vals); break;
interactive_dds = 1; case GIMP_RUN_NONINTERACTIVE:
break; if (nparams != G_N_ELEMENTS (save_args))
case GIMP_RUN_NONINTERACTIVE: status = GIMP_PDB_CALLING_ERROR;
interactive_dds = 0; else
if(nparams != G_N_ELEMENTS(save_args)) {
status = GIMP_PDB_CALLING_ERROR; dds_write_vals.compression = param[5].data.d_int32;
else dds_write_vals.mipmaps = param[6].data.d_int32;
{ dds_write_vals.savetype = param[7].data.d_int32;
dds_write_vals.compression = param[5].data.d_int32; dds_write_vals.format = param[8].data.d_int32;
dds_write_vals.mipmaps = param[6].data.d_int32; dds_write_vals.transindex = param[9].data.d_int32;
dds_write_vals.savetype = param[7].data.d_int32; dds_write_vals.mipmap_filter = param[10].data.d_int32;
dds_write_vals.format = param[8].data.d_int32; dds_write_vals.mipmap_wrap = param[11].data.d_int32;
dds_write_vals.transindex = param[9].data.d_int32; dds_write_vals.gamma_correct = param[12].data.d_int32;
dds_write_vals.mipmap_filter = param[10].data.d_int32; dds_write_vals.srgb = param[13].data.d_int32;
dds_write_vals.mipmap_wrap = param[11].data.d_int32; dds_write_vals.gamma = param[14].data.d_float;
dds_write_vals.gamma_correct = param[12].data.d_int32; dds_write_vals.perceptual_metric = param[15].data.d_int32;
dds_write_vals.srgb = param[13].data.d_int32; dds_write_vals.preserve_alpha_coverage = param[16].data.d_int32;
dds_write_vals.gamma = param[14].data.d_float; dds_write_vals.alpha_test_threshold = param[17].data.d_float;
dds_write_vals.perceptual_metric = param[15].data.d_int32;
dds_write_vals.preserve_alpha_coverage = param[16].data.d_int32; if ((dds_write_vals.compression < DDS_COMPRESS_NONE) ||
dds_write_vals.alpha_test_threshold = param[17].data.d_float; (dds_write_vals.compression >= DDS_COMPRESS_MAX))
status = GIMP_PDB_CALLING_ERROR;
if((dds_write_vals.compression < DDS_COMPRESS_NONE) || if ((dds_write_vals.mipmaps < DDS_MIPMAP_NONE) ||
(dds_write_vals.compression >= DDS_COMPRESS_MAX)) (dds_write_vals.mipmaps >= DDS_MIPMAP_MAX))
status = GIMP_PDB_CALLING_ERROR; status = GIMP_PDB_CALLING_ERROR;
if((dds_write_vals.mipmaps < DDS_MIPMAP_NONE) || if ((dds_write_vals.savetype < DDS_SAVE_SELECTED_LAYER) ||
(dds_write_vals.mipmaps >= DDS_MIPMAP_MAX)) (dds_write_vals.savetype >= DDS_SAVE_MAX))
status = GIMP_PDB_CALLING_ERROR; status = GIMP_PDB_CALLING_ERROR;
if((dds_write_vals.savetype < DDS_SAVE_SELECTED_LAYER) || if ((dds_write_vals.format < DDS_FORMAT_DEFAULT) ||
(dds_write_vals.savetype >= DDS_SAVE_MAX)) (dds_write_vals.format >= DDS_FORMAT_MAX))
status = GIMP_PDB_CALLING_ERROR; status = GIMP_PDB_CALLING_ERROR;
if((dds_write_vals.format < DDS_FORMAT_DEFAULT) || if ((dds_write_vals.mipmap_filter < DDS_MIPMAP_FILTER_DEFAULT) ||
(dds_write_vals.format >= DDS_FORMAT_MAX)) (dds_write_vals.mipmap_filter >= DDS_MIPMAP_FILTER_MAX))
status = GIMP_PDB_CALLING_ERROR; status = GIMP_PDB_CALLING_ERROR;
if((dds_write_vals.mipmap_filter < DDS_MIPMAP_FILTER_DEFAULT) || if ((dds_write_vals.mipmap_wrap < DDS_MIPMAP_WRAP_DEFAULT) ||
(dds_write_vals.mipmap_filter >= DDS_MIPMAP_FILTER_MAX)) (dds_write_vals.mipmap_wrap >= DDS_MIPMAP_WRAP_MAX))
status = GIMP_PDB_CALLING_ERROR; status = GIMP_PDB_CALLING_ERROR;
if((dds_write_vals.mipmap_wrap < DDS_MIPMAP_WRAP_DEFAULT) || }
(dds_write_vals.mipmap_wrap >= DDS_MIPMAP_WRAP_MAX)) break;
status = GIMP_PDB_CALLING_ERROR; case GIMP_RUN_WITH_LAST_VALS:
} gimp_get_data (SAVE_PROC, &dds_write_vals);
break; break;
case GIMP_RUN_WITH_LAST_VALS: default:
gimp_get_data(SAVE_PROC, &dds_write_vals); break;
interactive_dds = 0; }
break;
default: if (dds_write_vals.gamma < 1e-04f)
break; /* gimp_gamma () got removed and was always returning 2.2 anyway.
}
if(dds_write_vals.gamma < 1e-04f)
/* gimp_gamma() got removed and was always returning 2.2 anyway.
* XXX Review this piece of code if we expect gamma value could * XXX Review this piece of code if we expect gamma value could
* be parameterized. * be parameterized.
*/ */
dds_write_vals.gamma = 2.2; dds_write_vals.gamma = 2.2;
if(status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)
{ {
status = write_dds(param[3].data.d_string, imageID, drawableID); status = write_dds (param[3].data.d_string, imageID, drawableID,
if(status == GIMP_PDB_SUCCESS) run_mode == GIMP_RUN_INTERACTIVE);
gimp_set_data(SAVE_PROC, &dds_write_vals, sizeof(dds_write_vals)); if (status == GIMP_PDB_SUCCESS)
} gimp_set_data (SAVE_PROC, &dds_write_vals, sizeof (dds_write_vals));
}
if(export == GIMP_EXPORT_EXPORT)
gimp_image_delete(imageID); if (export == GIMP_EXPORT_EXPORT)
} gimp_image_delete (imageID);
else if(!strcmp(name, DECODE_YCOCG_PROC)) }
{ else if (!strcmp (name, DECODE_YCOCG_PROC))
imageID = param[1].data.d_int32; {
drawableID = param[2].data.d_int32; imageID = param[1].data.d_int32;
drawableID = param[2].data.d_int32;
decode_ycocg_image(drawableID, TRUE);
decode_ycocg_image (drawableID, TRUE);
status = GIMP_PDB_SUCCESS; status = GIMP_PDB_SUCCESS;
if(run_mode != GIMP_RUN_NONINTERACTIVE) if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush(); gimp_displays_flush ();
} }
else if(!strcmp(name, DECODE_YCOCG_SCALED_PROC)) else if (!strcmp (name, DECODE_YCOCG_SCALED_PROC))
{ {
imageID = param[1].data.d_int32; imageID = param[1].data.d_int32;
drawableID = param[2].data.d_int32; drawableID = param[2].data.d_int32;
decode_ycocg_scaled_image(drawableID, TRUE); decode_ycocg_scaled_image (drawableID, TRUE);
status = GIMP_PDB_SUCCESS; status = GIMP_PDB_SUCCESS;
if(run_mode != GIMP_RUN_NONINTERACTIVE) if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush(); gimp_displays_flush ();
} }
else if(!strcmp(name, DECODE_ALPHA_EXP_PROC)) else if (!strcmp (name, DECODE_ALPHA_EXP_PROC))
{ {
imageID = param[1].data.d_int32; imageID = param[1].data.d_int32;
drawableID = param[2].data.d_int32; drawableID = param[2].data.d_int32;
decode_alpha_exp_image(drawableID, TRUE); decode_alpha_exp_image (drawableID, TRUE);
status = GIMP_PDB_SUCCESS; status = GIMP_PDB_SUCCESS;
if(run_mode != GIMP_RUN_NONINTERACTIVE) if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush(); gimp_displays_flush ();
} }
else else
status = GIMP_PDB_CALLING_ERROR; status = GIMP_PDB_CALLING_ERROR;
values[0].data.d_status = status; values[0].data.d_status = status;
} }
/* /*
DDS GIMP plugin * DDS GIMP plugin
*
Copyright (C) 2004-2012 Shawn Kirst <skirst@gmail.com>, * Copyright (C) 2004-2012 Shawn Kirst <skirst@gmail.com>,
with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified. * with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified.
*
This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public * modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. * version 2 of the License, or (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. * General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to * along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor * the Free Software Foundation, 51 Franklin Street, Fifth Floor
Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef DDS_H #ifndef DDS_H
#define DDS_H #define DDS_H
......
/* /*
DDS GIMP plugin * DDS GIMP plugin
*
Copyright (C) 2004-2012 Shawn Kirst <skirst@gmail.com>, * Copyright (C) 2004-2012 Shawn Kirst <skirst@gmail.com>,
with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified. * with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified.
*
This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public * modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. * version 2 of the License, or (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. * General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to * along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor * the Free Software Foundation, 51 Franklin Street, Fifth Floor
Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __DDSPLUGIN_H #ifndef __DDSPLUGIN_H
#define __DDSPLUGIN_H #define __DDSPLUGIN_H
...@@ -34,44 +34,45 @@ ...@@ -34,44 +34,45 @@
typedef struct typedef struct
{ {
int compression; int compression;
int mipmaps; int mipmaps;
int savetype; int savetype;
int format; int format;
int transindex; int transindex;
int mipmap_filter; int mipmap_filter;
int mipmap_wrap; int mipmap_wrap;
int gamma_correct; int gamma_correct;
int srgb; int srgb;
float gamma; float gamma;
int perceptual_metric; int perceptual_metric;
int show_adv_opt; int show_adv_opt;
int preserve_alpha_coverage; int preserve_alpha_coverage;
float alpha_test_threshold; float alpha_test_threshold;
} DDSWriteVals; } DDSWriteVals;
typedef struct typedef struct
{ {
int mipmaps; int mipmaps;
int decode_images; int decode_images;
} DDSReadVals; } DDSReadVals;
extern DDSWriteVals dds_write_vals; extern DDSWriteVals dds_write_vals;
extern DDSReadVals dds_read_vals; extern DDSReadVals dds_read_vals;
extern GimpPDBStatusType read_dds(gchar *filename, gint32 *imageID); extern GimpPDBStatusType read_dds (gchar *filename,
extern GimpPDBStatusType write_dds(gchar *, gint32, gint32); gint32 *imageID,
gboolean interactive_dds);
extern GimpPDBStatusType write_dds (gchar *filename,
gint32 image_id,
gint32 drawable_id,
gboolean interactive_dds);
extern gint interactive_dds;
extern gchar *prog_name;
extern gchar *filename;
extern FILE *errorFile;
#define LOAD_PROC "file-dds-load" #define LOAD_PROC "file-dds-load"
#define SAVE_PROC "file-dds-save" #define SAVE_PROC "file-dds-save"
#define DECODE_YCOCG_PROC "color-decode-ycocg" #define DECODE_YCOCG_PROC "color-decode-ycocg"
#define DECODE_YCOCG_SCALED_PROC "color-decode-ycocg-scaled" #define DECODE_YCOCG_SCALED_PROC "color-decode-ycocg-scaled"
#define DECODE_ALPHA_EXP_PROC "color-decode-alpha-exp" #define DECODE_ALPHA_EXP_PROC "color-decode-alpha-exp"
#endif #endif
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment