3
3
* by Tim Newsome <drz@froody.bloke.com>
6
/* The GIMP -- an image manipulation program
6
/* GIMP - The GNU Image Manipulation Program
7
7
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
9
9
* This program is free software; you can redistribute it and/or modify
30
30
#include "libgimp/stdplugins-intl.h"
33
#define AUTOCROP_PROC "plug-in-autocrop"
34
#define AUTOCROP_LAYER_PROC "plug-in-autocrop-layer"
33
37
/* Declare local functions. */
34
38
static void query (void);
35
39
static void run (const gchar *name,
72
static GimpParamDef args[] =
76
static const GimpParamDef args[] =
74
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
75
{ GIMP_PDB_IMAGE, "image", "Input image" },
76
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
78
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
79
{ GIMP_PDB_IMAGE, "image", "Input image" },
80
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
79
gimp_install_procedure ("plug_in_autocrop",
80
"Automagically crops an image.",
85
N_("_Autocrop Image"),
86
"RGB*, GRAY*, INDEXED*",
88
G_N_ELEMENTS (args), 0,
91
gimp_plugin_menu_register ("plug_in_autocrop", "<Image>/Image/Crop");
93
gimp_install_procedure ("plug_in_autocrop_layer",
94
"Automagically crops a layer.",
99
N_("_Autocrop Layer"),
100
"RGB*, GRAY*, INDEXED*",
102
G_N_ELEMENTS (args), 0,
105
gimp_plugin_menu_register ("plug_in_autocrop_layer", "<Image>/Layer/Crop");
83
gimp_install_procedure (AUTOCROP_PROC,
84
N_("Remove empty borders from the image"),
89
N_("Autocrop Imag_e"),
90
"RGB*, GRAY*, INDEXED*",
92
G_N_ELEMENTS (args), 0,
95
gimp_plugin_menu_register (AUTOCROP_PROC, "<Image>/Image/Crop");
97
gimp_install_procedure (AUTOCROP_LAYER_PROC,
98
N_("Remove empty borders from the layer"),
103
N_("Autocrop Lay_er"),
104
"RGB*, GRAY*, INDEXED*",
106
G_N_ELEMENTS (args), 0,
109
gimp_plugin_menu_register (AUTOCROP_LAYER_PROC, "<Image>/Layer/Crop");
141
145
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
142
146
gimp_drawable_is_gray (drawable->drawable_id) ||
143
147
gimp_drawable_is_indexed (drawable->drawable_id))
146
gimp_progress_init (_("Cropping..."));
148
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width() + 1));
150
autocrop (drawable, image_id, interactive,
151
! strcmp (name, "plug_in_autocrop_layer"));
154
gimp_displays_flush ();
150
gimp_progress_init (_("Cropping"));
152
gimp_tile_cache_ntiles (MAX (drawable->width / gimp_tile_width (),
153
drawable->height / gimp_tile_height ()) + 1);
155
autocrop (drawable, image_id, interactive,
156
strcmp (name, AUTOCROP_LAYER_PROC) == 0);
159
gimp_displays_flush ();
158
163
status = GIMP_PDB_EXECUTION_ERROR;
162
167
values[0].type = GIMP_PDB_STATUS;