1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
/* cbmplugs -- Plugins to enable handling of Commodore 64 images in The GIMP
*
* Copyright © 2002-2007 David Weinehall <tao@acc.umu.se>
*
* These plugins are based off of work
*
* Copyright © 1999 Maurits Rijk <lpeek.mrijk@consunet.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include <libgimp/gimp.h>
#include "cbmplugs.h"
_runheader
{
static GimpParam values[2];
GimpRunMode run_mode;
gint32 image_ID;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_CALLING_ERROR;
if (nparams < 2)
return;
run_mode = param[0].data.d_int32;
if (strcmp(name, "file_interpaint_hires_load") == 0) {
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
image_ID = load_image(param[1].data.d_string, IP64H);
if (image_ID != -1) {
*nreturn_vals = 2;
values[0].data.d_status = GIMP_PDB_SUCCESS;
values[1].type = GIMP_PDB_IMAGE;
values[1].data.d_image = image_ID;
}
} else if (strcmp(name, "file_interpaint_hires_save") == 0) {
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
if (!save_image(param[3].data.d_string, param[1].data.d_image,
IP64H)) {
*nreturn_vals = 1;
values[0].data.d_status = GIMP_PDB_SUCCESS;
}
}
}
static void query(void)
{
static GimpParamDef load_args[] = {
{
GIMP_PDB_INT32,
"run_mode",
"Interactive, non-interactive"
},
{
GIMP_PDB_STRING,
"filename",
"The name of the file to load"
},
{
GIMP_PDB_STRING,
"raw_filename",
"The name of the file to load"
},
};
static GimpParamDef load_return_vals[] = {
{
GIMP_PDB_IMAGE,
"image",
"Output image"
},
};
static int nload_args = sizeof (load_args) / sizeof (load_args[0]);
static int nload_return_vals = sizeof (load_return_vals) /
sizeof (load_return_vals[0]);
static GimpParamDef save_args[] = {
{
GIMP_PDB_INT32,
"run_mode",
"Interactive, non-interactive"
},
{
GIMP_PDB_IMAGE,
"image",
"Input image"
},
{
GIMP_PDB_DRAWABLE,
"drawable",
"Drawable to save"
},
{
GIMP_PDB_STRING,
"filename",
"The name of the file to save the image in"
},
{
GIMP_PDB_STRING,
"raw_filename",
"The name of the file to save the image in"
},
};
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
gimp_install_procedure("file_interpaint_hires_load",
"loads images in Interpaint Hires file format",
"This plug-in loads images in Interpaint Hires file format.",
"David Weinehall <tao@acc.umu.se>",
"David Weinehall",
"2002",
"<Load>/Interpaint Hires",
NULL,
GIMP_PLUGIN,
nload_args,
nload_return_vals,
load_args,
load_return_vals);
gimp_register_load_handler("file_interpaint_hires_load", "ip64h", "");
gimp_install_procedure("file_interpaint_hires_save",
"saves images in Interpaint Hires file format",
"This plug-in saves images in Interpaint Hires file format.",
"David Weinehall <tao@acc.umu.se>",
"David Weinehall",
"2002",
"<Save>/Interpaint Hires",
"INDEXED",
GIMP_PLUGIN,
nsave_args,
0,
save_args,
NULL);
gimp_register_save_handler("file_interpaint_hires_save", "ip64h", "");
}
GimpPlugInInfo PLUG_IN_INFO = {
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
MAIN();
|