217 lines
12 KiB
C
217 lines
12 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_DRAW_TOOL_H__
|
|
#define __PIKA_DRAW_TOOL_H__
|
|
|
|
|
|
#include "pikatool.h"
|
|
|
|
|
|
#define PIKA_TOOL_HANDLE_SIZE_CIRCLE 13
|
|
#define PIKA_TOOL_HANDLE_SIZE_CROSS 15
|
|
#define PIKA_TOOL_HANDLE_SIZE_CROSSHAIR 43
|
|
#define PIKA_TOOL_HANDLE_SIZE_LARGE 25
|
|
#define PIKA_TOOL_HANDLE_SIZE_SMALL 7
|
|
|
|
|
|
#define PIKA_TYPE_DRAW_TOOL (pika_draw_tool_get_type ())
|
|
#define PIKA_DRAW_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_DRAW_TOOL, PikaDrawTool))
|
|
#define PIKA_DRAW_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_DRAW_TOOL, PikaDrawToolClass))
|
|
#define PIKA_IS_DRAW_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_DRAW_TOOL))
|
|
#define PIKA_IS_DRAW_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_DRAW_TOOL))
|
|
#define PIKA_DRAW_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_DRAW_TOOL, PikaDrawToolClass))
|
|
|
|
|
|
typedef struct _PikaDrawToolClass PikaDrawToolClass;
|
|
|
|
struct _PikaDrawTool
|
|
{
|
|
PikaTool parent_instance;
|
|
|
|
PikaDisplay *display; /* The display we are drawing to (may be
|
|
* a different one than tool->display)
|
|
*/
|
|
|
|
gint paused_count; /* count to keep track of multiple pauses */
|
|
guint draw_timeout; /* draw delay timeout ID */
|
|
guint64 last_draw_time; /* time of last draw(), monotonically */
|
|
|
|
PikaToolWidget *widget;
|
|
gchar *default_status;
|
|
PikaCanvasItem *preview;
|
|
PikaCanvasItem *item;
|
|
GList *group_stack;
|
|
};
|
|
|
|
struct _PikaDrawToolClass
|
|
{
|
|
PikaToolClass parent_class;
|
|
|
|
/* virtual function */
|
|
|
|
void (* draw) (PikaDrawTool *draw_tool);
|
|
};
|
|
|
|
|
|
GType pika_draw_tool_get_type (void) G_GNUC_CONST;
|
|
|
|
void pika_draw_tool_start (PikaDrawTool *draw_tool,
|
|
PikaDisplay *display);
|
|
void pika_draw_tool_stop (PikaDrawTool *draw_tool);
|
|
|
|
gboolean pika_draw_tool_is_active (PikaDrawTool *draw_tool);
|
|
|
|
void pika_draw_tool_pause (PikaDrawTool *draw_tool);
|
|
void pika_draw_tool_resume (PikaDrawTool *draw_tool);
|
|
|
|
gdouble pika_draw_tool_calc_distance (PikaDrawTool *draw_tool,
|
|
PikaDisplay *display,
|
|
gdouble x1,
|
|
gdouble y1,
|
|
gdouble x2,
|
|
gdouble y2);
|
|
gdouble pika_draw_tool_calc_distance_square (PikaDrawTool *draw_tool,
|
|
PikaDisplay *display,
|
|
gdouble x1,
|
|
gdouble y1,
|
|
gdouble x2,
|
|
gdouble y2);
|
|
|
|
void pika_draw_tool_set_widget (PikaDrawTool *draw_tool,
|
|
PikaToolWidget *widget);
|
|
void pika_draw_tool_set_default_status (PikaDrawTool *draw_tool,
|
|
const gchar *status);
|
|
|
|
void pika_draw_tool_add_preview (PikaDrawTool *draw_tool,
|
|
PikaCanvasItem *item);
|
|
void pika_draw_tool_remove_preview (PikaDrawTool *draw_tool,
|
|
PikaCanvasItem *item);
|
|
|
|
void pika_draw_tool_add_item (PikaDrawTool *draw_tool,
|
|
PikaCanvasItem *item);
|
|
void pika_draw_tool_remove_item (PikaDrawTool *draw_tool,
|
|
PikaCanvasItem *item);
|
|
|
|
PikaCanvasGroup* pika_draw_tool_add_stroke_group (PikaDrawTool *draw_tool);
|
|
PikaCanvasGroup* pika_draw_tool_add_fill_group (PikaDrawTool *draw_tool);
|
|
|
|
void pika_draw_tool_push_group (PikaDrawTool *draw_tool,
|
|
PikaCanvasGroup *group);
|
|
void pika_draw_tool_pop_group (PikaDrawTool *draw_tool);
|
|
|
|
PikaCanvasItem * pika_draw_tool_add_line (PikaDrawTool *draw_tool,
|
|
gdouble x1,
|
|
gdouble y1,
|
|
gdouble x2,
|
|
gdouble y2);
|
|
PikaCanvasItem * pika_draw_tool_add_guide (PikaDrawTool *draw_tool,
|
|
PikaOrientationType orientation,
|
|
gint position,
|
|
PikaGuideStyle style);
|
|
PikaCanvasItem * pika_draw_tool_add_crosshair (PikaDrawTool *draw_tool,
|
|
gint position_x,
|
|
gint position_y);
|
|
PikaCanvasItem * pika_draw_tool_add_sample_point (PikaDrawTool *draw_tool,
|
|
gint x,
|
|
gint y,
|
|
gint index);
|
|
PikaCanvasItem * pika_draw_tool_add_rectangle (PikaDrawTool *draw_tool,
|
|
gboolean filled,
|
|
gdouble x,
|
|
gdouble y,
|
|
gdouble width,
|
|
gdouble height);
|
|
PikaCanvasItem * pika_draw_tool_add_arc (PikaDrawTool *draw_tool,
|
|
gboolean filled,
|
|
gdouble x,
|
|
gdouble y,
|
|
gdouble width,
|
|
gdouble height,
|
|
gdouble start_angle,
|
|
gdouble slice_angle);
|
|
PikaCanvasItem * pika_draw_tool_add_transform_preview(PikaDrawTool *draw_tool,
|
|
PikaPickable *pickable,
|
|
const PikaMatrix3 *transform,
|
|
gdouble x1,
|
|
gdouble y1,
|
|
gdouble x2,
|
|
gdouble y2);
|
|
|
|
PikaCanvasItem * pika_draw_tool_add_handle (PikaDrawTool *draw_tool,
|
|
PikaHandleType type,
|
|
gdouble x,
|
|
gdouble y,
|
|
gint width,
|
|
gint height,
|
|
PikaHandleAnchor anchor);
|
|
|
|
PikaCanvasItem * pika_draw_tool_add_lines (PikaDrawTool *draw_tool,
|
|
const PikaVector2 *points,
|
|
gint n_points,
|
|
PikaMatrix3 *transform,
|
|
gboolean filled);
|
|
|
|
PikaCanvasItem * pika_draw_tool_add_strokes (PikaDrawTool *draw_tool,
|
|
const PikaCoords *points,
|
|
gint n_points,
|
|
PikaMatrix3 *transform,
|
|
gboolean filled);
|
|
|
|
PikaCanvasItem * pika_draw_tool_add_pen (PikaDrawTool *draw_tool,
|
|
const PikaVector2 *points,
|
|
gint n_points,
|
|
PikaContext *context,
|
|
PikaActiveColor color,
|
|
gint width);
|
|
|
|
PikaCanvasItem * pika_draw_tool_add_boundary (PikaDrawTool *draw_tool,
|
|
const PikaBoundSeg *bound_segs,
|
|
gint n_bound_segs,
|
|
PikaMatrix3 *transform,
|
|
gdouble offset_x,
|
|
gdouble offset_y);
|
|
|
|
PikaCanvasItem * pika_draw_tool_add_text_cursor (PikaDrawTool *draw_tool,
|
|
PangoRectangle *cursor,
|
|
gboolean overwrite,
|
|
PikaTextDirection direction);
|
|
|
|
PikaCanvasItem * pika_draw_tool_add_text (PikaDrawTool *draw_tool,
|
|
gdouble x,
|
|
gdouble y,
|
|
gdouble font_size,
|
|
gchar *text);
|
|
|
|
gboolean pika_draw_tool_on_handle (PikaDrawTool *draw_tool,
|
|
PikaDisplay *display,
|
|
gdouble x,
|
|
gdouble y,
|
|
PikaHandleType type,
|
|
gdouble handle_x,
|
|
gdouble handle_y,
|
|
gint width,
|
|
gint height,
|
|
PikaHandleAnchor anchor);
|
|
|
|
|
|
#endif /* __PIKA_DRAW_TOOL_H__ */
|