152 lines
7.3 KiB
C
152 lines
7.3 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 Spencer Kimball and Peter Mattis
|
||
|
*
|
||
|
* pikacanvasitem.h
|
||
|
* Copyright (C) 2010 Michael Natterer <mitch@gimp.org>
|
||
|
*
|
||
|
* 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_CANVAS_ITEM_H__
|
||
|
#define __PIKA_CANVAS_ITEM_H__
|
||
|
|
||
|
|
||
|
#include "core/pikaobject.h"
|
||
|
|
||
|
|
||
|
#define PIKA_TYPE_CANVAS_ITEM (pika_canvas_item_get_type ())
|
||
|
#define PIKA_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_CANVAS_ITEM, PikaCanvasItem))
|
||
|
#define PIKA_CANVAS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_CANVAS_ITEM, PikaCanvasItemClass))
|
||
|
#define PIKA_IS_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_CANVAS_ITEM))
|
||
|
#define PIKA_IS_CANVAS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_CANVAS_ITEM))
|
||
|
#define PIKA_CANVAS_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_CANVAS_ITEM, PikaCanvasItemClass))
|
||
|
|
||
|
|
||
|
typedef struct _PikaCanvasItemPrivate PikaCanvasItemPrivate;
|
||
|
typedef struct _PikaCanvasItemClass PikaCanvasItemClass;
|
||
|
|
||
|
struct _PikaCanvasItem
|
||
|
{
|
||
|
PikaObject parent_instance;
|
||
|
|
||
|
PikaCanvasItemPrivate *private;
|
||
|
};
|
||
|
|
||
|
struct _PikaCanvasItemClass
|
||
|
{
|
||
|
PikaObjectClass parent_class;
|
||
|
|
||
|
/* signals */
|
||
|
void (* update) (PikaCanvasItem *item,
|
||
|
cairo_region_t *region);
|
||
|
|
||
|
/* virtual functions */
|
||
|
void (* draw) (PikaCanvasItem *item,
|
||
|
cairo_t *cr);
|
||
|
cairo_region_t * (* get_extents) (PikaCanvasItem *item);
|
||
|
|
||
|
void (* stroke) (PikaCanvasItem *item,
|
||
|
cairo_t *cr);
|
||
|
void (* fill) (PikaCanvasItem *item,
|
||
|
cairo_t *cr);
|
||
|
|
||
|
gboolean (* hit) (PikaCanvasItem *item,
|
||
|
gdouble x,
|
||
|
gdouble y);
|
||
|
};
|
||
|
|
||
|
|
||
|
GType pika_canvas_item_get_type (void) G_GNUC_CONST;
|
||
|
|
||
|
PikaDisplayShell * pika_canvas_item_get_shell (PikaCanvasItem *item);
|
||
|
PikaImage * pika_canvas_item_get_image (PikaCanvasItem *item);
|
||
|
GtkWidget * pika_canvas_item_get_canvas (PikaCanvasItem *item);
|
||
|
|
||
|
void pika_canvas_item_draw (PikaCanvasItem *item,
|
||
|
cairo_t *cr);
|
||
|
cairo_region_t * pika_canvas_item_get_extents (PikaCanvasItem *item);
|
||
|
|
||
|
gboolean pika_canvas_item_hit (PikaCanvasItem *item,
|
||
|
gdouble x,
|
||
|
gdouble y);
|
||
|
|
||
|
void pika_canvas_item_set_visible (PikaCanvasItem *item,
|
||
|
gboolean visible);
|
||
|
gboolean pika_canvas_item_get_visible (PikaCanvasItem *item);
|
||
|
|
||
|
void pika_canvas_item_set_line_cap (PikaCanvasItem *item,
|
||
|
cairo_line_cap_t line_cap);
|
||
|
|
||
|
void pika_canvas_item_set_highlight (PikaCanvasItem *item,
|
||
|
gboolean highlight);
|
||
|
gboolean pika_canvas_item_get_highlight (PikaCanvasItem *item);
|
||
|
|
||
|
void pika_canvas_item_begin_change (PikaCanvasItem *item);
|
||
|
void pika_canvas_item_end_change (PikaCanvasItem *item);
|
||
|
|
||
|
void pika_canvas_item_suspend_stroking (PikaCanvasItem *item);
|
||
|
void pika_canvas_item_resume_stroking (PikaCanvasItem *item);
|
||
|
|
||
|
void pika_canvas_item_suspend_filling (PikaCanvasItem *item);
|
||
|
void pika_canvas_item_resume_filling (PikaCanvasItem *item);
|
||
|
|
||
|
void pika_canvas_item_transform (PikaCanvasItem *item,
|
||
|
cairo_t *cr);
|
||
|
void pika_canvas_item_transform_xy (PikaCanvasItem *item,
|
||
|
gdouble x,
|
||
|
gdouble y,
|
||
|
gint *tx,
|
||
|
gint *ty);
|
||
|
void pika_canvas_item_transform_xy_f (PikaCanvasItem *item,
|
||
|
gdouble x,
|
||
|
gdouble y,
|
||
|
gdouble *tx,
|
||
|
gdouble *ty);
|
||
|
gdouble pika_canvas_item_transform_distance
|
||
|
(PikaCanvasItem *item,
|
||
|
gdouble x1,
|
||
|
gdouble y1,
|
||
|
gdouble x2,
|
||
|
gdouble y2);
|
||
|
gdouble pika_canvas_item_transform_distance_square
|
||
|
(PikaCanvasItem *item,
|
||
|
gdouble x1,
|
||
|
gdouble y1,
|
||
|
gdouble x2,
|
||
|
gdouble y2);
|
||
|
void pika_canvas_item_untransform_viewport
|
||
|
(PikaCanvasItem *item,
|
||
|
gint *x,
|
||
|
gint *y,
|
||
|
gint *w,
|
||
|
gint *h);
|
||
|
|
||
|
|
||
|
/* protected */
|
||
|
|
||
|
void _pika_canvas_item_update (PikaCanvasItem *item,
|
||
|
cairo_region_t *region);
|
||
|
gboolean _pika_canvas_item_needs_update (PikaCanvasItem *item);
|
||
|
void _pika_canvas_item_stroke (PikaCanvasItem *item,
|
||
|
cairo_t *cr);
|
||
|
void _pika_canvas_item_fill (PikaCanvasItem *item,
|
||
|
cairo_t *cr);
|
||
|
|
||
|
|
||
|
#endif /* __PIKA_CANVAS_ITEM_H__ */
|