62
static GimpParamDef load_args[] =
65
static const GimpParamDef load_args[] =
64
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
67
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
65
68
{ GIMP_PDB_STRING, "filename", "The name of the file to load" },
66
{ GIMP_PDB_STRING, "raw_filename", "The name entered" }
69
{ GIMP_PDB_STRING, "raw-filename", "The name entered" }
68
static GimpParamDef load_return_vals[] =
71
static const GimpParamDef load_return_vals[] =
70
73
{ GIMP_PDB_IMAGE, "image", "Output image" },
73
static GimpParamDef save_args[] =
75
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
76
static const GimpParamDef thumb_args[] =
78
{ GIMP_PDB_STRING, "filename", "The name of the file to load" },
79
{ GIMP_PDB_INT32, "thumb-size", "Preferred thumbnail size" }
81
static const GimpParamDef thumb_return_vals[] =
83
{ GIMP_PDB_IMAGE, "image", "Thumbnail image" },
84
{ GIMP_PDB_INT32, "image-width", "Width of full-sized image" },
85
{ GIMP_PDB_INT32, "image-height", "Height of full-sized image" }
88
static const GimpParamDef save_args[] =
90
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
76
91
{ GIMP_PDB_IMAGE, "image", "Input image" },
77
92
{ GIMP_PDB_DRAWABLE, "drawable", "Drawable to save" },
78
93
{ GIMP_PDB_STRING, "filename", "The name of the file to save the image in" },
79
{ GIMP_PDB_STRING, "raw_filename", "The name entered" },
94
{ GIMP_PDB_STRING, "raw-filename", "The name entered" },
82
gimp_install_procedure ("file_ico_load",
97
gimp_install_procedure (LOAD_PROC,
83
98
"Loads files of Windows ICO file format",
84
99
"Loads files of Windows ICO file format",
85
100
"Christian Kreibich <christian@whoop.org>",
92
107
G_N_ELEMENTS (load_return_vals),
93
108
load_args, load_return_vals);
95
gimp_register_file_handler_mime ("file_ico_load", "image/x-ico");
96
gimp_register_magic_load_handler ("file_ico_load",
110
gimp_register_file_handler_mime (LOAD_PROC, "image/x-ico");
111
gimp_register_magic_load_handler (LOAD_PROC,
99
114
"0,string,\\000\\001\\000\\000,0,string,\\000\\002\\000\\000");
101
gimp_install_procedure ("file_ico_save",
116
gimp_install_procedure (LOAD_THUMB_PROC,
117
"Loads a preview from an Windows ICO file",
119
"Dom Lachowicz, Sven Neumann",
120
"Sven Neumann <sven@gimp.org>",
125
G_N_ELEMENTS (thumb_args),
126
G_N_ELEMENTS (thumb_return_vals),
127
thumb_args, thumb_return_vals);
129
gimp_register_thumbnail_loader (LOAD_PROC, LOAD_THUMB_PROC);
131
gimp_install_procedure (SAVE_PROC,
102
132
"Saves files in Windows ICO file format",
103
133
"Saves files in Windows ICO file format",
104
134
"Christian Kreibich <christian@whoop.org>",
110
140
G_N_ELEMENTS (save_args), 0,
111
141
save_args, NULL);
113
gimp_register_file_handler_mime ("file_ico_save", "image/x-ico");
114
gimp_register_save_handler ("file_ico_save", "ico", "");
143
gimp_register_file_handler_mime (SAVE_PROC, "image/x-ico");
144
gimp_register_save_handler (SAVE_PROC, "ico", "");
172
else if (strcmp (name, "file_ico_save") == 0)
202
else if (strcmp (name, LOAD_THUMB_PROC) == 0)
206
status = GIMP_PDB_CALLING_ERROR;
210
const gchar *filename = param[0].data.d_string;
211
gint width = param[1].data.d_int32;
212
gint height = param[1].data.d_int32;
215
image_ID = ico_load_thumbnail_image (filename, &width, &height);
221
values[1].type = GIMP_PDB_IMAGE;
222
values[1].data.d_image = image_ID;
223
values[2].type = GIMP_PDB_INT32;
224
values[2].data.d_int32 = width;
225
values[3].type = GIMP_PDB_INT32;
226
values[3].data.d_int32 = height;
230
status = GIMP_PDB_EXECUTION_ERROR;
234
else if (strcmp (name, SAVE_PROC) == 0)
174
236
gchar *file_name;
217
ico_alloc_map (gint width,
279
ico_rowstride (gint width,
228
285
if ((width % 32) == 0)
229
len = (width * height / 8);
231
len = 4 * ((width/32 + 1) * height);
288
return 4 * (width/32 + 1);
235
292
if ((width % 8) == 0)
236
len = (width * height / 2);
238
len = 4 * ((width/8 + 1) * height);
295
return 4 * (width/8 + 1);
242
299
if ((width % 4) == 0)
243
len = width * height;
245
len = 4 * ((width/4 + 1) * height);
302
return 4 * (width/4 + 1);
306
if (((width*3) % 4) == 0)
309
return 4 * (width*3/4+1);
249
len = width * height * (bpp/8);
315
g_warning ("invalid bitrate: %d\n", bpp);
316
g_assert_not_reached ();
317
return width * (bpp/8);
322
ico_alloc_map (gint width,
330
len = ico_rowstride (width, bpp) * height;
253
333
map = g_new0 (guint8, len);