PIKApp/app/core/pikabrush.h

157 lines
8.4 KiB
C
Raw Permalink Normal View History

2023-09-26 00:35:21 +02:00
/* 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
*
* 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_BRUSH_H__
#define __PIKA_BRUSH_H__
#include "pikadata.h"
#define PIKA_TYPE_BRUSH (pika_brush_get_type ())
#define PIKA_BRUSH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_BRUSH, PikaBrush))
#define PIKA_BRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_BRUSH, PikaBrushClass))
#define PIKA_IS_BRUSH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_BRUSH))
#define PIKA_IS_BRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_BRUSH))
#define PIKA_BRUSH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_BRUSH, PikaBrushClass))
typedef struct _PikaBrushPrivate PikaBrushPrivate;
typedef struct _PikaBrushClass PikaBrushClass;
struct _PikaBrush
{
PikaData parent_instance;
PikaBrushPrivate *priv;
};
struct _PikaBrushClass
{
PikaDataClass parent_class;
/* virtual functions */
void (* begin_use) (PikaBrush *brush);
void (* end_use) (PikaBrush *brush);
PikaBrush * (* select_brush) (PikaBrush *brush,
const PikaCoords *last_coords,
const PikaCoords *current_coords);
gboolean (* want_null_motion) (PikaBrush *brush,
const PikaCoords *last_coords,
const PikaCoords *current_coords);
void (* transform_size) (PikaBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gboolean reflect,
gint *width,
gint *height);
PikaTempBuf * (* transform_mask) (PikaBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gboolean reflect,
gdouble hardness);
PikaTempBuf * (* transform_pixmap) (PikaBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gboolean reflect,
gdouble hardness);
PikaBezierDesc * (* transform_boundary) (PikaBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gboolean reflect,
gdouble hardness,
gint *width,
gint *height);
/* signals */
void (* spacing_changed) (PikaBrush *brush);
};
GType pika_brush_get_type (void) G_GNUC_CONST;
PikaData * pika_brush_new (PikaContext *context,
const gchar *name);
PikaData * pika_brush_get_standard (PikaContext *context);
void pika_brush_begin_use (PikaBrush *brush);
void pika_brush_end_use (PikaBrush *brush);
PikaBrush * pika_brush_select_brush (PikaBrush *brush,
const PikaCoords *last_coords,
const PikaCoords *current_coords);
gboolean pika_brush_want_null_motion (PikaBrush *brush,
const PikaCoords *last_coords,
const PikaCoords *current_coords);
/* Gets width and height of a transformed mask of the brush, for
* provided parameters.
*/
void pika_brush_transform_size (PikaBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gboolean reflect,
gint *width,
gint *height);
const PikaTempBuf * pika_brush_transform_mask (PikaBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gboolean reflect,
gdouble hardness);
const PikaTempBuf * pika_brush_transform_pixmap (PikaBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gboolean reflect,
gdouble hardness);
const PikaBezierDesc * pika_brush_transform_boundary (PikaBrush *brush,
gdouble scale,
gdouble aspect_ratio,
gdouble angle,
gboolean reflect,
gdouble hardness,
gint *width,
gint *height);
PikaTempBuf * pika_brush_get_mask (PikaBrush *brush);
PikaTempBuf * pika_brush_get_pixmap (PikaBrush *brush);
gint pika_brush_get_width (PikaBrush *brush);
gint pika_brush_get_height (PikaBrush *brush);
gint pika_brush_get_spacing (PikaBrush *brush);
void pika_brush_set_spacing (PikaBrush *brush,
gint spacing);
PikaVector2 pika_brush_get_x_axis (PikaBrush *brush);
PikaVector2 pika_brush_get_y_axis (PikaBrush *brush);
void pika_brush_flush_blur_caches (PikaBrush *brush);
gdouble pika_brush_get_blur_hardness (PikaBrush *brush);
#endif /* __PIKA_BRUSH_H__ */