mirror of https://github.com/GNOME/gimp.git
app: "Bend the text along the currently active path" multi-layer aware.
It still only requires one single path selected to work, but I updated the internal API used.
This commit is contained in:
parent
b9eb289b5c
commit
566e55e72e
|
@ -26,6 +26,7 @@
|
|||
#include "actions-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
@ -178,8 +179,16 @@ text_tool_text_along_path_cmd_callback (GimpAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
|
||||
GError *error = NULL;
|
||||
|
||||
gimp_text_tool_create_vectors_warped (text_tool);
|
||||
if (! gimp_text_tool_create_vectors_warped (text_tool, &error))
|
||||
{
|
||||
gimp_message (text_tool->image->gimp, G_OBJECT (text_tool),
|
||||
GIMP_MESSAGE_ERROR,
|
||||
_("Test along path failed: %s"),
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -2327,27 +2327,43 @@ gimp_text_tool_create_vectors (GimpTextTool *text_tool)
|
|||
gimp_image_flush (text_tool->image);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool)
|
||||
gboolean
|
||||
gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool,
|
||||
GError **error)
|
||||
{
|
||||
GimpVectors *vectors0;
|
||||
GList *vectors0;
|
||||
GimpVectors *vectors;
|
||||
gdouble box_width;
|
||||
gdouble box_height;
|
||||
GimpTextDirection dir;
|
||||
gdouble offset = 0.0;
|
||||
|
||||
g_return_if_fail (GIMP_IS_TEXT_TOOL (text_tool));
|
||||
g_return_val_if_fail (GIMP_IS_TEXT_TOOL (text_tool), FALSE);
|
||||
|
||||
if (! text_tool->text || ! text_tool->image || ! text_tool->layer)
|
||||
return;
|
||||
{
|
||||
if (! text_tool->text)
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("Text is required."));
|
||||
if (! text_tool->image)
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("No image."));
|
||||
if (! text_tool->layer)
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("No layer."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
box_width = gimp_item_get_width (GIMP_ITEM (text_tool->layer));
|
||||
box_height = gimp_item_get_height (GIMP_ITEM (text_tool->layer));
|
||||
|
||||
vectors0 = gimp_image_get_active_vectors (text_tool->image);
|
||||
if (! vectors0)
|
||||
return;
|
||||
vectors0 = gimp_image_get_selected_vectors (text_tool->image);
|
||||
if (g_list_length (vectors0) != 1)
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
_("Exactly one path must be selected."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
vectors = gimp_text_vectors_new (text_tool->image, text_tool->text);
|
||||
|
||||
|
@ -2376,7 +2392,7 @@ gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool)
|
|||
break;
|
||||
}
|
||||
|
||||
gimp_vectors_warp_vectors (vectors0, vectors, offset);
|
||||
gimp_vectors_warp_vectors (vectors0->data, vectors, offset);
|
||||
|
||||
gimp_item_set_visible (GIMP_ITEM (vectors), TRUE, FALSE);
|
||||
|
||||
|
@ -2384,6 +2400,8 @@ gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool)
|
|||
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
||||
|
||||
gimp_image_flush (text_tool->image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GimpTextDirection
|
||||
|
|
|
@ -106,27 +106,28 @@ void gimp_text_tool_register (GimpToolRegisterCallback call
|
|||
|
||||
GType gimp_text_tool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gboolean gimp_text_tool_set_layer (GimpTextTool *text_tool,
|
||||
GimpLayer *layer);
|
||||
gboolean gimp_text_tool_set_layer (GimpTextTool *text_tool,
|
||||
GimpLayer *layer);
|
||||
|
||||
gboolean gimp_text_tool_get_has_text_selection (GimpTextTool *text_tool);
|
||||
gboolean gimp_text_tool_get_has_text_selection (GimpTextTool *text_tool);
|
||||
|
||||
void gimp_text_tool_delete_selection (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_cut_clipboard (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_copy_clipboard (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_paste_clipboard (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_delete_selection (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_cut_clipboard (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_copy_clipboard (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_paste_clipboard (GimpTextTool *text_tool);
|
||||
|
||||
void gimp_text_tool_create_vectors (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_create_vectors (GimpTextTool *text_tool);
|
||||
gboolean gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool,
|
||||
GError **error);
|
||||
|
||||
GimpTextDirection
|
||||
gimp_text_tool_get_direction (GimpTextTool *text_tool);
|
||||
gimp_text_tool_get_direction (GimpTextTool *text_tool);
|
||||
|
||||
/* only for the text editor */
|
||||
void gimp_text_tool_clear_layout (GimpTextTool *text_tool);
|
||||
gboolean gimp_text_tool_ensure_layout (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_apply (GimpTextTool *text_tool,
|
||||
gboolean push_undo);
|
||||
void gimp_text_tool_clear_layout (GimpTextTool *text_tool);
|
||||
gboolean gimp_text_tool_ensure_layout (GimpTextTool *text_tool);
|
||||
void gimp_text_tool_apply (GimpTextTool *text_tool,
|
||||
gboolean push_undo);
|
||||
|
||||
|
||||
#endif /* __GIMP_TEXT_TOOL_H__ */
|
||||
|
|
Loading…
Reference in New Issue