static void gimp_display_shell_dnd_bucket_fill (GimpDisplayShell *shell, GimpBucketFillMode fill_mode, const GimpRGB *color, GimpPattern *pattern) { GimpImage *image = gimp_display_get_image (shell->display); GimpDrawable *drawable; if (shell->display->gimp->busy) return; if (! image) return; drawable = gimp_image_get_active_drawable (image); if (! drawable) return; if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable))) { gimp_message_literal (shell->display->gimp, G_OBJECT (shell->display), GIMP_MESSAGE_ERROR, _("Cannot modify the pixels of layer groups.")); return; } if (gimp_item_is_content_locked (GIMP_ITEM (drawable))) { gimp_message_literal (shell->display->gimp, G_OBJECT (shell->display), GIMP_MESSAGE_ERROR, _("The active layer's pixels are locked.")); return; } /* FIXME: there should be a virtual method for this that the * GimpTextLayer can override. */ if (color && gimp_item_is_text_layer (GIMP_ITEM (drawable))) { gimp_text_layer_set (GIMP_TEXT_LAYER (drawable), NULL, "color", color, NULL); } else { gimp_edit_fill_full (image, drawable, color, pattern, GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE, pattern ? C_("undo-type", "Drop pattern to layer") : C_("undo-type", "Drop color to layer")); } gimp_display_shell_dnd_flush (shell, image); }
static void gimp_display_shell_dnd_fill (GimpDisplayShell *shell, GimpFillOptions *options, const gchar *undo_desc) { GimpImage *image = gimp_display_get_image (shell->display); GimpDrawable *drawable; if (shell->display->gimp->busy) return; if (! image) return; drawable = gimp_image_get_active_drawable (image); if (! drawable) return; if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable))) { gimp_message_literal (shell->display->gimp, G_OBJECT (shell->display), GIMP_MESSAGE_ERROR, _("Cannot modify the pixels of layer groups.")); return; } if (gimp_item_is_content_locked (GIMP_ITEM (drawable))) { gimp_message_literal (shell->display->gimp, G_OBJECT (shell->display), GIMP_MESSAGE_ERROR, _("The active layer's pixels are locked.")); return; } /* FIXME: there should be a virtual method for this that the * GimpTextLayer can override. */ if (gimp_fill_options_get_style (options) == GIMP_FILL_STYLE_SOLID && gimp_item_is_text_layer (GIMP_ITEM (drawable))) { GimpRGB color; gimp_context_get_foreground (GIMP_CONTEXT (options), &color); gimp_text_layer_set (GIMP_TEXT_LAYER (drawable), NULL, "color", &color, NULL); } else { gimp_edit_fill (image, drawable, options, undo_desc); } gimp_display_shell_dnd_flush (shell, image); }
static void gimp_display_shell_dnd_bucket_fill (GimpDisplayShell *shell, GimpBucketFillMode fill_mode, const GimpRGB *color, GimpPattern *pattern) { GimpImage *image = shell->display->image; GimpDrawable *drawable; if (shell->display->gimp->busy) return; if (! image) return; drawable = gimp_image_get_active_drawable (image); if (! drawable) return; /* FIXME: there should be a virtual method for this that the * GimpTextLayer can override. */ if (color && gimp_drawable_is_text_layer (drawable)) { gimp_text_layer_set (GIMP_TEXT_LAYER (drawable), NULL, "color", color, NULL); } else { gimp_drawable_bucket_fill_full (drawable, fill_mode, GIMP_NORMAL_MODE, GIMP_OPACITY_OPAQUE, FALSE, /* no seed fill */ FALSE, /* don't fill transp */ GIMP_SELECT_CRITERION_COMPOSITE, 0.0, FALSE, /* fill params */ 0.0, 0.0, /* ignored */ color, pattern); } gimp_display_shell_dnd_flush (shell, image); }
static gboolean gimp_text_layer_set_transformation (GimpTextLayer *layer, GimpMatrix3 *matrix) { GimpMatrix2 trafo; if (! gimp_matrix3_is_affine (matrix)) return FALSE; trafo.coeff[0][0] = matrix->coeff[0][0]; trafo.coeff[0][1] = matrix->coeff[0][1]; trafo.coeff[1][0] = matrix->coeff[1][0]; trafo.coeff[1][1] = matrix->coeff[1][1]; gimp_text_layer_set (GIMP_TEXT_LAYER (layer), NULL, "transformation", &trafo, "offset-x", matrix->coeff[0][2], "offset-y", matrix->coeff[1][2], NULL); return TRUE; }