PIKApp/app/tools/pikatransformgridtool.h

123 lines
5.8 KiB
C

/* PIKA - Photo and Image Kooker Application
* a rebranding of The GNU Image Manipulation Program (created with heckimp)
* A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
*
* Original copyright, applying to most contents (license remains unchanged):
* Copyright (C) 1995-2001 Spencer Kimball, Peter Mattis, and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __PIKA_TRANSFORM_GRID_TOOL_H__
#define __PIKA_TRANSFORM_GRID_TOOL_H__
#include "pikatransformtool.h"
/* This is not the number of items in the enum above, but the max size
* of the enums at the top of each transformation tool, stored in
* trans_info and related
*/
#define TRANS_INFO_SIZE 17
typedef gdouble TransInfo[TRANS_INFO_SIZE];
#define PIKA_TYPE_TRANSFORM_GRID_TOOL (pika_transform_grid_tool_get_type ())
#define PIKA_TRANSFORM_GRID_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_TRANSFORM_GRID_TOOL, PikaTransformGridTool))
#define PIKA_TRANSFORM_GRID_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_TRANSFORM_GRID_TOOL, PikaTransformGridToolClass))
#define PIKA_IS_TRANSFORM_GRID_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_TRANSFORM_GRID_TOOL))
#define PIKA_IS_TRANSFORM_GRID_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_TRANSFORM_GRID_TOOL))
#define PIKA_TRANSFORM_GRID_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_TRANSFORM_GRID_TOOL, PikaTransformGridToolClass))
#define PIKA_TRANSFORM_GRID_TOOL_GET_OPTIONS(t) (PIKA_TRANSFORM_GRID_OPTIONS (pika_tool_get_options (PIKA_TOOL (t))))
typedef struct _PikaTransformGridToolClass PikaTransformGridToolClass;
struct _PikaTransformGridTool
{
PikaTransformTool parent_instance;
TransInfo init_trans_info; /* initial transformation info */
TransInfo trans_infos[2]; /* forward/backward transformation info */
gdouble *trans_info; /* current transformation info */
GList *undo_list; /* list of all states,
head is current == prev_trans_info,
tail is original == old_trans_info */
GList *redo_list; /* list of all undone states,
NULL when nothing undone */
GList *hidden_objects; /* the objects that was hidden during
the transform */
PikaToolWidget *widget;
PikaToolWidget *grab_widget;
GList *previews;
PikaCanvasItem *boundary_in;
PikaCanvasItem *boundary_out;
GPtrArray *strokes;
GHashTable *filters;
GList *preview_drawables;
PikaToolGui *gui;
};
struct _PikaTransformGridToolClass
{
PikaTransformToolClass parent_class;
/* virtual functions */
gboolean (* info_to_matrix) (PikaTransformGridTool *tg_tool,
PikaMatrix3 *transform);
void (* matrix_to_info) (PikaTransformGridTool *tg_tool,
const PikaMatrix3 *transform);
void (* apply_info) (PikaTransformGridTool *tg_tool,
const TransInfo info);
gchar * (* get_undo_desc) (PikaTransformGridTool *tg_tool);
void (* dialog) (PikaTransformGridTool *tg_tool);
void (* dialog_update) (PikaTransformGridTool *tg_tool);
void (* prepare) (PikaTransformGridTool *tg_tool);
void (* readjust) (PikaTransformGridTool *tg_tool);
PikaToolWidget * (* get_widget) (PikaTransformGridTool *tg_tool);
void (* update_widget) (PikaTransformGridTool *tg_tool);
void (* widget_changed) (PikaTransformGridTool *tg_tool);
GeglBuffer * (* transform) (PikaTransformGridTool *tg_tool,
GList *objects,
GeglBuffer *orig_buffer,
gint orig_offset_x,
gint orig_offset_y,
PikaColorProfile **buffer_profile,
gint *new_offset_x,
gint *new_offset_y);
const gchar *ok_button_label;
};
GType pika_transform_grid_tool_get_type (void) G_GNUC_CONST;
gboolean pika_transform_grid_tool_info_to_matrix (PikaTransformGridTool *tg_tool,
PikaMatrix3 *transform);
void pika_transform_grid_tool_matrix_to_info (PikaTransformGridTool *tg_tool,
const PikaMatrix3 *transform);
void pika_transform_grid_tool_push_internal_undo (PikaTransformGridTool *tg_tool,
gboolean compress);
#endif /* __PIKA_TRANSFORM_GRID_TOOL_H__ */