/* 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_DRAWABLE_FILTER_H__
#define __PIKA_DRAWABLE_FILTER_H__


#include "pikafilter.h"


#define PIKA_TYPE_DRAWABLE_FILTER            (pika_drawable_filter_get_type ())
#define PIKA_DRAWABLE_FILTER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_DRAWABLE_FILTER, PikaDrawableFilter))
#define PIKA_DRAWABLE_FILTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_DRAWABLE_FILTER, PikaDrawableFilterClass))
#define PIKA_IS_DRAWABLE_FILTER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_DRAWABLE_FILTER))
#define PIKA_IS_DRAWABLE_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_DRAWABLE_FILTER))
#define PIKA_DRAWABLE_FILTER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_DRAWABLE_FILTER, PikaDrawableFilterClass))


typedef struct _PikaDrawableFilterClass  PikaDrawableFilterClass;

struct _PikaDrawableFilterClass
{
  PikaFilterClass  parent_class;

  void (* flush) (PikaDrawableFilter *filter);
};


/*  Drawable Filter functions  */

/*  Successive apply() functions can be called, but eventually MUST be
 *  followed with an commit() or an abort() call, both of which will
 *  remove the live filter from the drawable.
 */

GType      pika_drawable_filter_get_type       (void) G_GNUC_CONST;

PikaDrawableFilter *
           pika_drawable_filter_new            (PikaDrawable        *drawable,
                                                const gchar         *undo_desc,
                                                GeglNode            *operation,
                                                const gchar         *icon_name);

PikaDrawable *
           pika_drawable_filter_get_drawable   (PikaDrawableFilter  *filter);
GeglNode * pika_drawable_filter_get_operation  (PikaDrawableFilter  *filter);

void       pika_drawable_filter_set_clip       (PikaDrawableFilter  *filter,
                                                gboolean             clip);
void       pika_drawable_filter_set_region     (PikaDrawableFilter  *filter,
                                                PikaFilterRegion     region);
void       pika_drawable_filter_set_crop       (PikaDrawableFilter  *filter,
                                                const GeglRectangle *rect,
                                                gboolean             update);
void       pika_drawable_filter_set_preview    (PikaDrawableFilter  *filter,
                                                gboolean             enabled);
void       pika_drawable_filter_set_preview_split
                                               (PikaDrawableFilter  *filter,
                                                gboolean             enabled,
                                                PikaAlignmentType    alignment,
                                                gint                 split_position);
void       pika_drawable_filter_set_opacity    (PikaDrawableFilter  *filter,
                                                gdouble              opacity);
void       pika_drawable_filter_set_mode       (PikaDrawableFilter  *filter,
                                                PikaLayerMode        paint_mode,
                                                PikaLayerColorSpace  blend_space,
                                                PikaLayerColorSpace  composite_space,
                                                PikaLayerCompositeMode composite_mode);
void       pika_drawable_filter_set_add_alpha  (PikaDrawableFilter  *filter,
                                                gboolean             add_alpha);

void       pika_drawable_filter_set_gamma_hack (PikaDrawableFilter  *filter,
                                                gboolean             gamma_hack);

void       pika_drawable_filter_set_override_constraints
                                               (PikaDrawableFilter  *filter,
                                                gboolean             override_constraints);

const Babl *
           pika_drawable_filter_get_format     (PikaDrawableFilter  *filter);

void       pika_drawable_filter_apply          (PikaDrawableFilter  *filter,
                                                const GeglRectangle *area);

gboolean   pika_drawable_filter_commit         (PikaDrawableFilter  *filter,
                                                PikaProgress        *progress,
                                                gboolean             cancellable);
void       pika_drawable_filter_abort          (PikaDrawableFilter  *filter);


#endif /* __PIKA_DRAWABLE_FILTER_H__ */
