本文整理匯總了C++中GIMP_IMAGE_MAP_TOOL函數的典型用法代碼示例。如果您正苦於以下問題:C++ GIMP_IMAGE_MAP_TOOL函數的具體用法?C++ GIMP_IMAGE_MAP_TOOL怎麽用?C++ GIMP_IMAGE_MAP_TOOL使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GIMP_IMAGE_MAP_TOOL函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: gimp_curves_tool_color_picked
static void
gimp_curves_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
gdouble x,
gdouble y,
const Babl *sample_format,
gpointer pixel,
const GimpRGB *color)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (color_tool);
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (color_tool);
GimpCurvesConfig *config = GIMP_CURVES_CONFIG (im_tool->config);
GimpDrawable *drawable;
drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
tool->picked_color[GIMP_HISTOGRAM_RED] = color->r;
tool->picked_color[GIMP_HISTOGRAM_GREEN] = color->g;
tool->picked_color[GIMP_HISTOGRAM_BLUE] = color->b;
if (gimp_drawable_has_alpha (drawable))
tool->picked_color[GIMP_HISTOGRAM_ALPHA] = color->a;
else
tool->picked_color[GIMP_HISTOGRAM_ALPHA] = -1;
tool->picked_color[GIMP_HISTOGRAM_VALUE] = MAX (MAX (color->r, color->g),
color->b);
gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
tool->picked_color[config->channel]);
}
示例2: gimp_image_map_tool_edit_as
void
gimp_image_map_tool_edit_as (GimpImageMapTool *im_tool,
const gchar *new_tool_id,
GimpConfig *config)
{
GimpDisplay *display;
GimpContext *user_context;
GimpToolInfo *tool_info;
GimpTool *new_tool;
g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (im_tool));
g_return_if_fail (new_tool_id);
g_return_if_fail (GIMP_IS_CONFIG (config));
display = GIMP_TOOL (im_tool)->display;
user_context = gimp_get_user_context (display->gimp);
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (display->gimp->tool_info_list,
new_tool_id);
gimp_context_set_tool (user_context, tool_info);
tool_manager_initialize_active (display->gimp, display);
new_tool = tool_manager_get_active (display->gimp);
GIMP_IMAGE_MAP_TOOL (new_tool)->default_config = g_object_ref (config);
gimp_image_map_tool_reset (GIMP_IMAGE_MAP_TOOL (new_tool));
}
示例3: gimp_image_map_tool_options_notify
static void
gimp_image_map_tool_options_notify (GimpTool *tool,
GimpToolOptions *options,
const GParamSpec *pspec)
{
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (tool);
GimpImageMapOptions *im_options = GIMP_IMAGE_MAP_OPTIONS (options);
if (! strcmp (pspec->name, "preview") &&
image_map_tool->image_map)
{
if (im_options->preview)
{
gimp_tool_control_push_preserve (tool->control, TRUE);
gimp_image_map_tool_map (image_map_tool);
gimp_tool_control_pop_preserve (tool->control);
}
else
{
gimp_tool_control_push_preserve (tool->control, TRUE);
gimp_image_map_abort (image_map_tool->image_map);
gimp_tool_control_pop_preserve (tool->control);
}
}
else if (! strcmp (pspec->name, "region") &&
image_map_tool->image_map)
{
gimp_image_map_set_region (image_map_tool->image_map, im_options->region);
gimp_image_map_tool_preview (image_map_tool);
}
}
示例4: gimp_colorize_tool_config_notify
static void
gimp_colorize_tool_config_notify (GObject *object,
GParamSpec *pspec,
GimpColorizeTool *col_tool)
{
GimpColorizeConfig *config = GIMP_COLORIZE_CONFIG (object);
if (! col_tool->hue_data)
return;
if (! strcmp (pspec->name, "hue"))
{
gtk_adjustment_set_value (col_tool->hue_data,
config->hue * 360.0);
}
else if (! strcmp (pspec->name, "saturation"))
{
gtk_adjustment_set_value (col_tool->saturation_data,
config->saturation * 100.0);
}
else if (! strcmp (pspec->name, "lightness"))
{
gtk_adjustment_set_value (col_tool->lightness_data,
config->lightness * 100.0);
}
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (col_tool));
}
示例5: gimp_colorize_tool_initialize
static gboolean
gimp_colorize_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (tool);
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
if (! drawable)
return FALSE;
if (! gimp_drawable_is_rgb (drawable))
{
g_set_error (error, 0, 0,
_("Colorize operates only on RGB color layers."));
return FALSE;
}
gimp_config_reset (GIMP_CONFIG (col_tool->config));
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
return TRUE;
}
示例6: gimp_desaturate_tool_initialize
static gboolean
gimp_desaturate_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (tool);
GimpDrawable *drawable;
drawable = gimp_image_get_active_drawable (display->image);
if (! drawable)
return FALSE;
if (! gimp_drawable_is_rgb (drawable))
{
g_set_error (error, 0, 0,
_("Desaturate does only operate on RGB layers."));
return FALSE;
}
gimp_config_reset (GIMP_CONFIG (desaturate_tool->config));
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (desaturate_tool->button),
desaturate_tool->config->mode);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (desaturate_tool));
return TRUE;
}
示例7: gimp_operation_tool_dialog
static void
gimp_operation_tool_dialog (GimpImageMapTool *image_map_tool)
{
GimpOperationTool *tool = GIMP_OPERATION_TOOL (image_map_tool);
GtkWidget *main_vbox;
main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool);
/* The options vbox */
tool->options_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (main_vbox), tool->options_box,
FALSE, FALSE, 0);
gtk_widget_show (tool->options_box);
if (tool->options_table)
{
gtk_container_add (GTK_CONTAINER (tool->options_box),
tool->options_table);
gtk_widget_show (tool->options_table);
}
if (tool->undo_desc)
g_object_set (GIMP_IMAGE_MAP_TOOL (tool)->dialog,
"description", tool->undo_desc,
NULL);
}
示例8: gimp_curves_tool_color_picked
static void
gimp_curves_tool_color_picked (GimpColorTool *color_tool,
GimpColorPickState pick_state,
GimpImageType sample_type,
GimpRGB *color,
gint color_index)
{
GimpCurvesTool *tool = GIMP_CURVES_TOOL (color_tool);
GimpDrawable *drawable;
drawable = GIMP_IMAGE_MAP_TOOL (tool)->drawable;
tool->picked_color[GIMP_HISTOGRAM_RED] = color->r;
tool->picked_color[GIMP_HISTOGRAM_GREEN] = color->g;
tool->picked_color[GIMP_HISTOGRAM_BLUE] = color->b;
if (gimp_drawable_has_alpha (drawable))
tool->picked_color[GIMP_HISTOGRAM_ALPHA] = color->a;
tool->picked_color[GIMP_HISTOGRAM_VALUE] = MAX (MAX (color->r, color->g),
color->b);
gimp_curve_view_set_xpos (GIMP_CURVE_VIEW (tool->graph),
tool->picked_color[tool->config->channel]);
}
示例9: gimp_posterize_tool_initialize
static gboolean
gimp_posterize_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
GimpPosterizeTool *posterize_tool = GIMP_POSTERIZE_TOOL (tool);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable;
drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
if (gimp_drawable_is_indexed (drawable))
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("Posterize does not operate on indexed layers."));
return FALSE;
}
gimp_config_reset (GIMP_CONFIG (posterize_tool->config));
if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
{
return FALSE;
}
gtk_adjustment_set_value (posterize_tool->levels_data,
posterize_tool->config->levels);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (posterize_tool));
return TRUE;
}
示例10: brightness_contrast_config_notify
static void
brightness_contrast_config_notify (GObject *object,
GParamSpec *pspec,
GimpBrightnessContrastTool *bc_tool)
{
GimpBrightnessContrastConfig *config;
config = GIMP_BRIGHTNESS_CONTRAST_CONFIG (object);
if (! bc_tool->brightness_data)
return;
if (! strcmp (pspec->name, "brightness"))
{
gtk_adjustment_set_value (bc_tool->brightness_data,
config->brightness * 127.0);
}
else if (! strcmp (pspec->name, "contrast"))
{
gtk_adjustment_set_value (bc_tool->contrast_data,
config->contrast * 127.0);
}
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (bc_tool));
}
示例11: gimp_threshold_tool_initialize
static gboolean
gimp_threshold_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (tool);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! drawable)
return FALSE;
gimp_config_reset (GIMP_CONFIG (t_tool->config));
if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
{
return FALSE;
}
gimp_drawable_calculate_histogram (drawable, t_tool->histogram);
gimp_histogram_view_set_histogram (t_tool->histogram_box->view,
t_tool->histogram);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (t_tool));
return TRUE;
}
示例12: gimp_levels_tool_color_picker_new
static GtkWidget *
gimp_levels_tool_color_picker_new (GimpLevelsTool *tool,
guint value)
{
const gchar *stock_id;
const gchar *help;
switch (value & 0xF)
{
case PICK_LOW_INPUT:
stock_id = GIMP_STOCK_COLOR_PICKER_BLACK;
help = _("Pick black point");
break;
case PICK_GAMMA:
stock_id = GIMP_STOCK_COLOR_PICKER_GRAY;
help = _("Pick gray point");
break;
case PICK_HIGH_INPUT:
stock_id = GIMP_STOCK_COLOR_PICKER_WHITE;
help = _("Pick white point");
break;
default:
return NULL;
}
return gimp_image_map_tool_add_color_picker (GIMP_IMAGE_MAP_TOOL (tool),
GUINT_TO_POINTER (value),
stock_id,
help);
}
示例13: gimp_image_map_tool_key_press
static gboolean
gimp_image_map_tool_key_press (GimpTool *tool,
GdkEventKey *kevent,
GimpDisplay *display)
{
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (tool);
if (display == tool->display)
{
switch (kevent->keyval)
{
case GDK_Return:
case GDK_KP_Enter:
case GDK_ISO_Enter:
gimp_image_map_tool_response (NULL, GTK_RESPONSE_OK, image_map_tool);
return TRUE;
case GDK_BackSpace:
gimp_image_map_tool_response (NULL, RESPONSE_RESET, image_map_tool);
return TRUE;
case GDK_Escape:
gimp_image_map_tool_response (NULL, GTK_RESPONSE_CANCEL, image_map_tool);
return TRUE;
}
}
return FALSE;
}
示例14: gimp_gegl_tool_config_notify
static void
gimp_gegl_tool_config_notify (GObject *object,
GParamSpec *pspec,
GimpGeglTool *tool)
{
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
}
示例15: gimp_operation_tool_aux_input_notify
static void
gimp_operation_tool_aux_input_notify (GimpBufferSourceBox *box,
const GParamSpec *pspec,
GimpOperationTool *tool)
{
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
}