plug-ins: port map-object to GeglColor procedure arguments

Note that it still converts to GimpRGB
internally.
This commit is contained in:
Alx Sa 2024-02-15 13:10:23 +00:00
parent 9955c00076
commit e559c23c00
2 changed files with 22 additions and 7 deletions

View File

@ -338,6 +338,7 @@ copy_from_config (GimpProcedureConfig *config)
GimpDrawable *box_right = NULL;
GimpDrawable *cyl_top = NULL;
GimpDrawable *cyl_bottom = NULL;
GeglColor *color;
mapvals.maptype = gimp_procedure_config_get_choice_id (config, "map-type");
@ -360,7 +361,7 @@ copy_from_config (GimpProcedureConfig *config)
"rotation-angle-x", &mapvals.alpha,
"rotation-angle-y", &mapvals.beta,
"rotation-angle-z", &mapvals.gamma,
"light-color", &mapvals.lightsource.color,
"light-color", &color,
"light-position-x", &mapvals.lightsource.position.x,
"light-position-y", &mapvals.lightsource.position.y,
"light-position-z", &mapvals.lightsource.position.z,
@ -412,4 +413,12 @@ copy_from_config (GimpProcedureConfig *config)
mapvals.cylindermap_id[0] = gimp_item_get_id (GIMP_ITEM (cyl_top));
if (cyl_bottom)
mapvals.cylindermap_id[0] = gimp_item_get_id (GIMP_ITEM (cyl_bottom));
if (color == NULL)
color = gegl_color_new ("white");
/* TODO: Use GeglColor directly in this plug-in */
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"),
&mapvals.lightsource.color);
g_object_unref (color);
}

View File

@ -108,7 +108,11 @@ map_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
GimpRGB white = { 1.0, 1.0, 1.0, 1.0 };
GeglColor *default_color;
gegl_init (NULL, NULL);
default_color = gegl_color_new ("white");
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
@ -232,11 +236,11 @@ map_create_procedure (GimpPlugIn *plug_in,
"point-light",
G_PARAM_READWRITE);
GIMP_PROC_ARG_RGB (procedure, "light-color",
_("Light source _color"),
_("Light source color"),
TRUE, &white,
G_PARAM_READWRITE);
GIMP_PROC_ARG_COLOR (procedure, "light-color",
_("Light source _color"),
_("Light source color"),
TRUE, default_color,
G_PARAM_READWRITE);
GIMP_PROC_ARG_DOUBLE (procedure, "light-position-x",
_("Light position X"),
@ -423,6 +427,8 @@ map_create_procedure (GimpPlugIn *plug_in,
_("Cylinder length"),
0, G_MAXDOUBLE, 0.25,
G_PARAM_READWRITE);
g_object_unref (default_color);
}
return procedure;