PIKApp/app/operations/pikacageconfig.h

113 lines
5.6 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):
*
* pikacageconfig.h
* Copyright (C) 2010 Michael Muré <batolettre@gmail.com>
*
* 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_CAGE_CONFIG_H__
#define __PIKA_CAGE_CONFIG_H__
#include "pikaoperationsettings.h"
struct _PikaCagePoint
{
PikaVector2 src_point;
PikaVector2 dest_point;
PikaVector2 edge_normal;
gdouble edge_scaling_factor;
gboolean selected;
};
#define PIKA_TYPE_CAGE_CONFIG (pika_cage_config_get_type ())
#define PIKA_CAGE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_CAGE_CONFIG, PikaCageConfig))
#define PIKA_CAGE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_CAGE_CONFIG, PikaCageConfigClass))
#define PIKA_IS_CAGE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_CAGE_CONFIG))
#define PIKA_IS_CAGE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_CAGE_CONFIG))
#define PIKA_CAGE_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_CAGE_CONFIG, PikaCageConfigClass))
typedef struct _PikaCageConfigClass PikaCageConfigClass;
struct _PikaCageConfig
{
PikaOperationSettings parent_instance;
GArray *cage_points;
gdouble displacement_x;
gdouble displacement_y;
PikaCageMode cage_mode; /* Cage mode, used to commit displacement */
};
struct _PikaCageConfigClass
{
PikaOperationSettingsClass parent_class;
};
GType pika_cage_config_get_type (void) G_GNUC_CONST;
guint pika_cage_config_get_n_points (PikaCageConfig *gcc);
void pika_cage_config_add_cage_point (PikaCageConfig *gcc,
gdouble x,
gdouble y);
void pika_cage_config_insert_cage_point (PikaCageConfig *gcc,
gint point_number,
gdouble x,
gdouble y);
void pika_cage_config_remove_last_cage_point (PikaCageConfig *gcc);
void pika_cage_config_remove_cage_point (PikaCageConfig *gcc,
gint point_number);
void pika_cage_config_remove_selected_points (PikaCageConfig *gcc);
PikaVector2 pika_cage_config_get_point_coordinate (PikaCageConfig *gcc,
PikaCageMode mode,
gint point_number);
void pika_cage_config_add_displacement (PikaCageConfig *gcc,
PikaCageMode mode,
gdouble x,
gdouble y);
void pika_cage_config_commit_displacement (PikaCageConfig *gcc);
void pika_cage_config_reset_displacement (PikaCageConfig *gcc);
GeglRectangle pika_cage_config_get_bounding_box (PikaCageConfig *gcc);
void pika_cage_config_reverse_cage_if_needed (PikaCageConfig *gcc);
void pika_cage_config_reverse_cage (PikaCageConfig *gcc);
gboolean pika_cage_config_point_inside (PikaCageConfig *gcc,
gfloat x,
gfloat y);
void pika_cage_config_select_point (PikaCageConfig *gcc,
gint point_number);
void pika_cage_config_select_area (PikaCageConfig *gcc,
PikaCageMode mode,
GeglRectangle area);
void pika_cage_config_select_add_area (PikaCageConfig *gcc,
PikaCageMode mode,
GeglRectangle area);
void pika_cage_config_toggle_point_selection (PikaCageConfig *gcc,
gint point_number);
void pika_cage_config_deselect_points (PikaCageConfig *gcc);
gboolean pika_cage_config_point_is_selected (PikaCageConfig *gcc,
gint point_number);
#endif /* __PIKA_CAGE_CONFIG_H__ */