Louise Hoffman wrote:
I am trying to make a GIMP plugin that can open a new drawable on the
screen. Just like when you make one from File->New.
You can't show a drawable by itself, it needs to be in an image. Also,
an image can't show itself, you must create a display for that. You are
also using the API in weird ways, for example, objects such as layers
and images are represented by integers in the plug-in context.
You are also saying that the plug-in takes the active image and drawable
as parameter, but since you are creating a new image, you are not
interested in those values (I assume) so there is no point in specifying
these as arguments to the hello-world procedure.
I have attached a rewritten version of main.c (called hello-world.c
since that is a name that doesn't conflict as much) that should do what
you want. You might also want to consider using a scripting language
like Scheme or Python for this.
My GIMP Blog:
"Reducing UI clutter, docking bars removed"
static GimpParamDef args =
"Displays \"Hello, world!\" in a dialog",
"Copyright David Neary",
G_N_ELEMENTS (args), 0,
run (const gchar *name,
const GimpParam *param,
static GimpParam values;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
/* Setting mandatory output values */
*nreturn_vals = 1;
*return_vals = values;
values.type = GIMP_PDB_STATUS;
values.data.d_status = status;
/* Getting run_mode - we won't display a dialog if
* we are in NONINTERACTIVE mode */
run_mode = param.data.d_int32;
image = gimp_image_new (800, 600, GIMP_RGB);
layer = gimp_layer_new (image,
gimp_image_add_layer (image, layer, 0);
display = gimp_display_new (image);
if (run_mode != GIMP_RUN_NONINTERACTIVE)
GimpPlugInInfo PLUG_IN_INFO =
Gimp-developer mailing list