本文整理匯總了C++中GIMP_IS_IMAGE函數的典型用法代碼示例。如果您正苦於以下問題:C++ GIMP_IS_IMAGE函數的具體用法?C++ GIMP_IS_IMAGE怎麽用?C++ GIMP_IS_IMAGE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GIMP_IS_IMAGE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: gimp_image_set_icc_profile
gboolean
gimp_image_set_icc_profile (GimpImage *image,
const guint8 *data,
gsize length,
GError **error)
{
GimpParasite *parasite = NULL;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (data == NULL || length != 0, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (data)
{
gboolean is_builtin;
parasite = gimp_parasite_new (GIMP_ICC_PROFILE_PARASITE_NAME,
GIMP_PARASITE_PERSISTENT |
GIMP_PARASITE_UNDOABLE,
length, data);
if (! gimp_image_validate_icc_parasite (image, parasite, &is_builtin,
error))
{
gimp_parasite_free (parasite);
return FALSE;
}
/* don't tag the image with the built-in profile */
if (is_builtin)
{
gimp_parasite_free (parasite);
parasite = NULL;
}
}
gimp_image_set_icc_parasite (image, parasite);
if (parasite)
gimp_parasite_free (parasite);
return TRUE;
}
示例2: gimp_image_validate_color_profile
gboolean
gimp_image_validate_color_profile (GimpImage *image,
GimpColorProfile *profile,
gboolean *is_builtin,
GError **error)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (gimp_image_get_base_type (image) == GIMP_GRAY)
{
if (! gimp_color_profile_is_gray (profile))
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("ICC profile validation failed: "
"Color profile is not for GRAY color space"));
return FALSE;
}
}
else
{
if (! gimp_color_profile_is_rgb (profile))
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
_("ICC profile validation failed: "
"Color profile is not for RGB color space"));
return FALSE;
}
}
if (is_builtin)
{
GimpColorProfile *builtin;
builtin = gimp_image_get_builtin_color_profile (image);
*is_builtin = gimp_color_profile_is_equal (profile, builtin);
}
return TRUE;
}
示例3: gimp_edit_copy
GimpObject *
gimp_edit_copy (GimpImage *image,
GimpDrawable *drawable,
GimpContext *context,
GError **error)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (GIMP_IS_LAYER (drawable) &&
gimp_channel_is_empty (gimp_image_get_mask (image)))
{
GimpImage *clip_image;
clip_image = gimp_image_new_from_drawable (image->gimp, drawable);
gimp_container_remove (image->gimp->images, GIMP_OBJECT (clip_image));
gimp_set_clipboard_image (image->gimp, clip_image);
g_object_unref (clip_image);
return GIMP_OBJECT (gimp_get_clipboard_image (image->gimp));
}
else
{
GimpBuffer *buffer;
buffer = gimp_edit_extract (image, GIMP_PICKABLE (drawable),
context, FALSE, error);
if (buffer)
{
gimp_set_clipboard_buffer (image->gimp, buffer);
g_object_unref (buffer);
return GIMP_OBJECT (gimp_get_clipboard_buffer (image->gimp));
}
}
return NULL;
}
示例4: gimp_image_pick_layer_by_bounds
GimpLayer *
gimp_image_pick_layer_by_bounds (const GimpImage *image,
gint x,
gint y)
{
GList *all_layers;
GList *list;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
all_layers = gimp_image_get_layer_list (image);
for (list = all_layers; list; list = g_list_next (list))
{
GimpLayer *layer = list->data;
if (gimp_item_get_visible (GIMP_ITEM (layer)))
{
gint off_x, off_y;
gint width, height;
gimp_item_get_offset (GIMP_ITEM (layer), &off_x, &off_y);
width = gimp_item_get_width (GIMP_ITEM (layer));
height = gimp_item_get_height (GIMP_ITEM (layer));
if (x >= off_x &&
y >= off_y &&
x < off_x + width &&
y < off_y + height)
{
g_list_free (all_layers);
return layer;
}
}
}
g_list_free (all_layers);
return NULL;
}
示例5: gimp_edit_fade
gboolean
gimp_edit_fade (GimpImage *image,
GimpContext *context)
{
GimpDrawableUndo *undo;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
undo = GIMP_DRAWABLE_UNDO (gimp_image_undo_get_fadeable (image));
if (undo && undo->applied_buffer)
{
GimpDrawable *drawable;
GeglBuffer *buffer;
drawable = GIMP_DRAWABLE (GIMP_ITEM_UNDO (undo)->item);
g_object_ref (undo);
buffer = g_object_ref (undo->applied_buffer);
gimp_image_undo (image);
gimp_drawable_apply_buffer (drawable, buffer,
GEGL_RECTANGLE (0, 0,
gegl_buffer_get_width (undo->buffer),
gegl_buffer_get_height (undo->buffer)),
TRUE,
gimp_object_get_name (undo),
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
NULL, undo->x, undo->y);
g_object_unref (buffer);
g_object_unref (undo);
return TRUE;
}
return FALSE;
}
示例6: gimp_image_add_colormap_entry
void
gimp_image_add_colormap_entry (GimpImage *image,
const GimpRGB *color)
{
g_return_if_fail (GIMP_IS_IMAGE (image));
g_return_if_fail (image->colormap != NULL);
g_return_if_fail (image->n_colors < 256);
g_return_if_fail (color != NULL);
gimp_image_undo_push_image_colormap (image,
_("Add Color to Colormap"));
gimp_rgb_get_uchar (color,
&image->colormap[image->n_colors * 3],
&image->colormap[image->n_colors * 3 + 1],
&image->colormap[image->n_colors * 3 + 2]);
image->n_colors++;
gimp_image_colormap_changed (image, -1);
}
示例7: gimp_image_undo_push_layer_mask_remove
GimpUndo *
gimp_image_undo_push_layer_mask_remove (GimpImage *image,
const gchar *undo_desc,
GimpLayer *layer,
GimpLayerMask *mask)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
g_return_val_if_fail (gimp_layer_mask_get_layer (mask) == layer, NULL);
g_return_val_if_fail (gimp_layer_get_mask (layer) == mask, NULL);
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_UNDO,
GIMP_UNDO_LAYER_MASK_REMOVE, undo_desc,
GIMP_DIRTY_IMAGE_STRUCTURE,
"item", layer,
"layer-mask", mask,
NULL);
}
示例8: gimp_image_get_builtin_color_profile
GimpColorProfile *
gimp_image_get_builtin_color_profile (GimpImage *image)
{
static GimpColorProfile *srgb_profile = NULL;
static GimpColorProfile *linear_rgb_profile = NULL;
const Babl *format;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
if (! srgb_profile)
{
srgb_profile = gimp_color_profile_new_srgb ();
linear_rgb_profile = gimp_color_profile_new_linear_rgb ();
}
format = gimp_image_get_layer_format (image, FALSE);
if (gimp_babl_format_get_linear (format))
{
if (! srgb_profile)
{
srgb_profile = gimp_color_profile_new_srgb ();
g_object_add_weak_pointer (G_OBJECT (srgb_profile),
(gpointer) &srgb_profile);
}
return linear_rgb_profile;
}
else
{
if (! linear_rgb_profile)
{
linear_rgb_profile = gimp_color_profile_new_linear_rgb ();
g_object_add_weak_pointer (G_OBJECT (linear_rgb_profile),
(gpointer) &linear_rgb_profile);
}
return srgb_profile;
}
}
示例9: gimp_vectors_export_file
/**
* gimp_vectors_export_file:
* @image: the #GimpImage from which to export vectors
* @vectors: a #GimpVectors object or %NULL to export all vectors in @image
* @filename: the name of the file to write
* @error: return location for errors
*
* Exports one or more vectors to a SVG file.
*
* Return value: %TRUE on success,
* %FALSE if there was an error writing the file
**/
gboolean
gimp_vectors_export_file (const GimpImage *image,
const GimpVectors *vectors,
const gchar *filename,
GError **error)
{
FILE *file;
GString *str;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (vectors == NULL || GIMP_IS_VECTORS (vectors), FALSE);
g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
file = g_fopen (filename, "w");
if (!file)
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for writing: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
return FALSE;
}
str = gimp_vectors_export (image, vectors);
fprintf (file, "%s", str->str);
g_string_free (str, TRUE);
if (fclose (file))
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Error while writing '%s': %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
return FALSE;
}
return TRUE;
}
示例10: gimp_image_set_colormap_entry
void
gimp_image_set_colormap_entry (GimpImage *image,
gint color_index,
const GimpRGB *color,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_IMAGE (image));
g_return_if_fail (image->colormap != NULL);
g_return_if_fail (color_index >= 0 && color_index < image->n_colors);
g_return_if_fail (color != NULL);
if (push_undo)
gimp_image_undo_push_image_colormap (image,
_("Change Colormap entry"));
gimp_rgb_get_uchar (color,
&image->colormap[color_index * 3],
&image->colormap[color_index * 3 + 1],
&image->colormap[color_index * 3 + 2]);
gimp_image_colormap_changed (image, color_index);
}
示例11: gimp_image_add_sample_point
void
gimp_image_add_sample_point (GimpImage *image,
GimpSamplePoint *sample_point,
gint x,
gint y)
{
g_return_if_fail (GIMP_IS_IMAGE (image));
g_return_if_fail (sample_point != NULL);
g_return_if_fail (x >= 0);
g_return_if_fail (y >= 0);
g_return_if_fail (x < gimp_image_get_width (image));
g_return_if_fail (y < gimp_image_get_height (image));
image->sample_points = g_list_append (image->sample_points, sample_point);
sample_point->x = x;
sample_point->y = y;
gimp_sample_point_ref (sample_point);
gimp_image_sample_point_added (image, sample_point);
gimp_image_update_sample_point (image, sample_point);
}
示例12: gimp_image_find_sample_point
GimpSamplePoint *
gimp_image_find_sample_point (GimpImage *image,
gdouble x,
gdouble y,
gdouble epsilon_x,
gdouble epsilon_y)
{
GList *list;
GimpSamplePoint *ret = NULL;
gdouble mindist = G_MAXDOUBLE;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (epsilon_x > 0 && epsilon_y > 0, NULL);
if (x < 0 || x >= gimp_image_get_width (image) ||
y < 0 || y >= gimp_image_get_height (image))
{
return NULL;
}
for (list = image->sample_points; list; list = g_list_next (list))
{
GimpSamplePoint *sample_point = list->data;
gdouble dist;
if (sample_point->x < 0 || sample_point->y < 0)
continue;
dist = hypot ((sample_point->x + 0.5) - x,
(sample_point->y + 0.5) - y);
if (dist < MIN (epsilon_y, mindist))
{
mindist = dist;
ret = sample_point;
}
}
return ret;
}
示例13: gimp_query_profile_policy
GimpColorProfilePolicy
gimp_query_profile_policy (Gimp *gimp,
GimpImage *image,
GimpContext *context,
GimpColorProfile **dest_profile,
GimpColorRenderingIntent *intent,
gboolean *bpc,
gboolean *dont_ask)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_COLOR_PROFILE_POLICY_KEEP);
g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_COLOR_PROFILE_POLICY_KEEP);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), GIMP_COLOR_PROFILE_POLICY_KEEP);
g_return_val_if_fail (dest_profile != NULL, GIMP_COLOR_PROFILE_POLICY_KEEP);
if (gimp->gui.query_profile_policy)
return gimp->gui.query_profile_policy (gimp, image, context,
dest_profile,
intent, bpc,
dont_ask);
return GIMP_COLOR_PROFILE_POLICY_KEEP;
}
示例14: gimp_pdb_image_get_sample_point
GimpSamplePoint *
gimp_pdb_image_get_sample_point (GimpImage *image,
gint sample_point_ID,
GError **error)
{
GimpSamplePoint *sample_point;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
sample_point = gimp_image_get_sample_point (image, sample_point_ID);
if (sample_point)
return sample_point;
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Image '%s' (%d) does not contain sample point with ID %d"),
gimp_image_get_display_name (image),
gimp_image_get_ID (image),
sample_point_ID);
return NULL;
}
示例15: gimp_pdb_image_is_precision
gboolean
gimp_pdb_image_is_precision (GimpImage *image,
GimpPrecision precision,
GError **error)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (gimp_image_get_precision (image) == precision)
return TRUE;
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Image '%s' (%d) has precision '%s', "
"but an image of precision '%s' is expected"),
gimp_image_get_display_name (image),
gimp_image_get_ID (image),
gimp_pdb_enum_value_get_nick (GIMP_TYPE_PRECISION,
gimp_image_get_precision (image)),
gimp_pdb_enum_value_get_nick (GIMP_TYPE_PRECISION, precision));
return FALSE;
}