void gimp_image_map_tool_create_map (GimpImageMapTool *tool) { Gimp *gimp; gboolean use_gegl; g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (tool)); gimp = GIMP_TOOL (tool)->tool_info->gimp; if (tool->image_map) { gimp_image_map_clear (tool->image_map); g_object_unref (tool->image_map); } g_assert (tool->operation || tool->apply_func); use_gegl = gimp_use_gegl (gimp) || ! tool->apply_func; tool->image_map = gimp_image_map_new (tool->drawable, GIMP_TOOL (tool)->tool_info->blurb, use_gegl ? tool->operation : NULL, tool->apply_func, tool->apply_data); g_signal_connect (tool->image_map, "flush", G_CALLBACK (gimp_image_map_tool_flush), tool); }
void gimp_drawable_brightness_contrast (GimpDrawable *drawable, GimpProgress *progress, gint brightness, gint contrast) { GimpBrightnessContrastConfig *config; g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); g_return_if_fail (! gimp_drawable_is_indexed (drawable)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable))); config = g_object_new (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG, "brightness", brightness / 127.0, "contrast", contrast / 127.0, NULL); if (gimp_use_gegl (gimp_item_get_image (GIMP_ITEM (drawable))->gimp)) { GeglNode *node; node = g_object_new (GEGL_TYPE_NODE, "operation", "gimp:brightness-contrast", "config", config, NULL); gimp_drawable_apply_operation (drawable, progress, C_("undo-type", "Brightness-Contrast") , node, TRUE); g_object_unref (node); } else { GimpLut *lut; lut = brightness_contrast_lut_new (config->brightness / 2.0, config->contrast, gimp_drawable_bytes (drawable)); gimp_drawable_process_lut (drawable, progress, C_("undo-type", "Brightness-Contrast"), lut); gimp_lut_free (lut); } g_object_unref (config); }
void gimp_drawable_posterize (GimpDrawable *drawable, GimpProgress *progress, gint levels) { GimpPosterizeConfig *config; g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); g_return_if_fail (! gimp_drawable_is_indexed (drawable)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable))); config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG, "levels", levels, NULL); if (gimp_use_gegl (gimp_item_get_image (GIMP_ITEM (drawable))->gimp)) { GeglNode *node; node = g_object_new (GEGL_TYPE_NODE, "operation", "gimp:posterize", NULL); gegl_node_set (node, "config", config, NULL); gimp_drawable_apply_operation (drawable, progress, _("Posterize"), node, TRUE); g_object_unref (node); } else { GimpLut *lut; lut = posterize_lut_new (config->levels, gimp_drawable_bytes (drawable)); gimp_drawable_process_lut (drawable, progress, _("Posterize"), lut); gimp_lut_free (lut); } g_object_unref (config); }
static void gimp_drawable_curves (GimpDrawable *drawable, GimpProgress *progress, GimpCurvesConfig *config) { if (gimp_use_gegl (gimp_item_get_image (GIMP_ITEM (drawable))->gimp)) { GeglNode *node; node = g_object_new (GEGL_TYPE_NODE, "operation", "gimp:curves", NULL); gegl_node_set (node, "config", config, NULL); gimp_drawable_apply_operation (drawable, progress, C_("undo-type", "Curves"), node, TRUE); g_object_unref (node); } else { GimpLut *lut = gimp_lut_new (); Curves cruft; gimp_curves_config_to_cruft (config, &cruft, gimp_drawable_is_rgb (drawable)); gimp_lut_setup (lut, (GimpLutFunc) curves_lut_func, &cruft, gimp_drawable_bytes (drawable)); gimp_drawable_process_lut (drawable, progress, C_("undo-type", "Curves"), lut); gimp_lut_free (lut); } }