157 lines
6.8 KiB
C
157 lines
6.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 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_CORE_H__
|
||
|
#define __PIKA_BRUSH_CORE_H__
|
||
|
|
||
|
|
||
|
#include "pikapaintcore.h"
|
||
|
|
||
|
|
||
|
#define BRUSH_CORE_SUBSAMPLE 4
|
||
|
#define BRUSH_CORE_SOLID_SUBSAMPLE 2
|
||
|
#define BRUSH_CORE_JITTER_LUTSIZE 360
|
||
|
|
||
|
|
||
|
#define PIKA_TYPE_BRUSH_CORE (pika_brush_core_get_type ())
|
||
|
#define PIKA_BRUSH_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_BRUSH_CORE, PikaBrushCore))
|
||
|
#define PIKA_BRUSH_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_BRUSH_CORE, PikaBrushCoreClass))
|
||
|
#define PIKA_IS_BRUSH_CORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_BRUSH_CORE))
|
||
|
#define PIKA_IS_BRUSH_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_BRUSH_CORE))
|
||
|
#define PIKA_BRUSH_CORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_BRUSH_CORE, PikaBrushCoreClass))
|
||
|
|
||
|
|
||
|
typedef struct _PikaBrushCoreClass PikaBrushCoreClass;
|
||
|
|
||
|
struct _PikaBrushCore
|
||
|
{
|
||
|
PikaPaintCore parent_instance;
|
||
|
|
||
|
PikaBrush *main_brush;
|
||
|
PikaBrush *brush;
|
||
|
PikaDynamics *dynamics;
|
||
|
gdouble spacing;
|
||
|
gdouble scale;
|
||
|
gdouble aspect_ratio;
|
||
|
gdouble angle;
|
||
|
gboolean reflect;
|
||
|
gdouble hardness;
|
||
|
|
||
|
gdouble symmetry_angle;
|
||
|
gboolean symmetry_reflect;
|
||
|
|
||
|
/* brush buffers */
|
||
|
PikaTempBuf *pressure_brush;
|
||
|
|
||
|
PikaTempBuf *solid_brushes[BRUSH_CORE_SOLID_SUBSAMPLE][BRUSH_CORE_SOLID_SUBSAMPLE];
|
||
|
const PikaTempBuf *last_solid_brush_mask;
|
||
|
gboolean solid_cache_invalid;
|
||
|
|
||
|
const PikaTempBuf *transform_brush;
|
||
|
const PikaTempBuf *transform_pixmap;
|
||
|
|
||
|
PikaTempBuf *subsample_brushes[BRUSH_CORE_SUBSAMPLE + 1][BRUSH_CORE_SUBSAMPLE + 1];
|
||
|
const PikaTempBuf *last_subsample_brush_mask;
|
||
|
gboolean subsample_cache_invalid;
|
||
|
|
||
|
gdouble jitter;
|
||
|
gdouble jitter_lut_x[BRUSH_CORE_JITTER_LUTSIZE];
|
||
|
gdouble jitter_lut_y[BRUSH_CORE_JITTER_LUTSIZE];
|
||
|
|
||
|
GRand *rand;
|
||
|
};
|
||
|
|
||
|
struct _PikaBrushCoreClass
|
||
|
{
|
||
|
PikaPaintCoreClass parent_class;
|
||
|
|
||
|
/* Set for tools that don't mind if the brush changes while painting */
|
||
|
gboolean handles_changing_brush;
|
||
|
|
||
|
/* Set for tools that don't mind if the brush scales while painting */
|
||
|
gboolean handles_transforming_brush;
|
||
|
|
||
|
/* Set for tools that don't mind if the brush scales mid stroke */
|
||
|
gboolean handles_dynamic_transforming_brush;
|
||
|
|
||
|
void (* set_brush) (PikaBrushCore *core,
|
||
|
PikaBrush *brush);
|
||
|
void (* set_dynamics) (PikaBrushCore *core,
|
||
|
PikaDynamics *brush);
|
||
|
};
|
||
|
|
||
|
|
||
|
GType pika_brush_core_get_type (void) G_GNUC_CONST;
|
||
|
|
||
|
void pika_brush_core_set_brush (PikaBrushCore *core,
|
||
|
PikaBrush *brush);
|
||
|
|
||
|
void pika_brush_core_set_dynamics (PikaBrushCore *core,
|
||
|
PikaDynamics *dynamics);
|
||
|
|
||
|
void pika_brush_core_paste_canvas (PikaBrushCore *core,
|
||
|
PikaDrawable *drawable,
|
||
|
const PikaCoords *coords,
|
||
|
gdouble brush_opacity,
|
||
|
gdouble image_opacity,
|
||
|
PikaLayerMode paint_mode,
|
||
|
PikaBrushApplicationMode brush_hardness,
|
||
|
gdouble dynamic_hardness,
|
||
|
PikaPaintApplicationMode mode);
|
||
|
void pika_brush_core_replace_canvas (PikaBrushCore *core,
|
||
|
PikaDrawable *drawable,
|
||
|
const PikaCoords *coords,
|
||
|
gdouble brush_opacity,
|
||
|
gdouble image_opacity,
|
||
|
PikaBrushApplicationMode brush_hardness,
|
||
|
gdouble dynamic_hardness,
|
||
|
PikaPaintApplicationMode mode);
|
||
|
|
||
|
void pika_brush_core_color_area_with_pixmap
|
||
|
(PikaBrushCore *core,
|
||
|
PikaDrawable *drawable,
|
||
|
const PikaCoords *coords,
|
||
|
GeglBuffer *area,
|
||
|
gint area_x,
|
||
|
gint area_y,
|
||
|
gboolean apply_mask);
|
||
|
|
||
|
const PikaTempBuf * pika_brush_core_get_brush_mask
|
||
|
(PikaBrushCore *core,
|
||
|
const PikaCoords *coords,
|
||
|
PikaBrushApplicationMode brush_hardness,
|
||
|
gdouble dynamic_hardness);
|
||
|
const PikaTempBuf * pika_brush_core_get_brush_pixmap
|
||
|
(PikaBrushCore *core);
|
||
|
|
||
|
void pika_brush_core_eval_transform_dynamics
|
||
|
(PikaBrushCore *core,
|
||
|
PikaImage *image,
|
||
|
PikaPaintOptions *paint_options,
|
||
|
const PikaCoords *coords);
|
||
|
void pika_brush_core_eval_transform_symmetry
|
||
|
(PikaBrushCore *core,
|
||
|
PikaSymmetry *symmetry,
|
||
|
gint stroke);
|
||
|
|
||
|
|
||
|
#endif /* __PIKA_BRUSH_CORE_H__ */
|