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


#include "libpikabase/pikabasetypes.h"
#include "libpikamath/pikamathtypes.h"
#include "libpikacolor/pikacolortypes.h"
#include "libpikamodule/pikamoduletypes.h"
#include "libpikathumb/pikathumb-types.h"

#include "config/config-types.h"

#include "core/core-enums.h"


/*  former base/ defines  */

#define MAX_CHANNELS  4

#define RED           0
#define GREEN         1
#define BLUE          2
#define ALPHA         3

#define GRAY          0
#define ALPHA_G       1

#define INDEXED       0
#define ALPHA_I       1


/*  defines  */

#define PIKA_COORDS_MIN_PRESSURE      0.0
#define PIKA_COORDS_MAX_PRESSURE      1.0
#define PIKA_COORDS_DEFAULT_PRESSURE  1.0

#define PIKA_COORDS_MIN_TILT         -1.0
#define PIKA_COORDS_MAX_TILT          1.0
#define PIKA_COORDS_DEFAULT_TILT      0.0

#define PIKA_COORDS_MIN_WHEEL         0.0
#define PIKA_COORDS_MAX_WHEEL         1.0
#define PIKA_COORDS_DEFAULT_WHEEL     0.5

#define PIKA_COORDS_DEFAULT_DISTANCE  0.0
#define PIKA_COORDS_DEFAULT_ROTATION  0.0
#define PIKA_COORDS_DEFAULT_SLIDER    0.0

#define PIKA_COORDS_DEFAULT_VELOCITY  0.0

#define PIKA_COORDS_DEFAULT_DIRECTION 0.0

#define PIKA_COORDS_DEFAULT_XSCALE    1.0
#define PIKA_COORDS_DEFAULT_YSCALE    1.0

#define PIKA_COORDS_DEFAULT_VALUES    { 0.0, 0.0, \
                                        PIKA_COORDS_DEFAULT_PRESSURE, \
                                        PIKA_COORDS_DEFAULT_TILT,     \
                                        PIKA_COORDS_DEFAULT_TILT,     \
                                        PIKA_COORDS_DEFAULT_WHEEL,    \
                                        PIKA_COORDS_DEFAULT_DISTANCE, \
                                        PIKA_COORDS_DEFAULT_ROTATION, \
                                        PIKA_COORDS_DEFAULT_SLIDER,   \
                                        PIKA_COORDS_DEFAULT_VELOCITY, \
                                        PIKA_COORDS_DEFAULT_DIRECTION,\
                                        PIKA_COORDS_DEFAULT_XSCALE,   \
                                        PIKA_COORDS_DEFAULT_YSCALE }


/*  base classes  */

typedef struct _PikaObject                      PikaObject;
typedef struct _PikaViewable                    PikaViewable;
typedef struct _PikaFilter                      PikaFilter;
typedef struct _PikaItem                        PikaItem;
typedef struct _PikaAuxItem                     PikaAuxItem;

typedef struct _Pika                            Pika;
typedef struct _PikaImage                       PikaImage;

typedef struct _PikaDisplay                     PikaDisplay;


/*  containers  */

typedef struct _PikaContainer                   PikaContainer;
typedef struct _PikaList                        PikaList;
typedef struct _PikaDocumentList                PikaDocumentList;
typedef struct _PikaDrawableStack               PikaDrawableStack;
typedef struct _PikaFilteredContainer           PikaFilteredContainer;
typedef struct _PikaFilterStack                 PikaFilterStack;
typedef struct _PikaItemList                    PikaItemList;
typedef struct _PikaItemStack                   PikaItemStack;
typedef struct _PikaLayerStack                  PikaLayerStack;
typedef struct _PikaTaggedContainer             PikaTaggedContainer;
typedef struct _PikaTreeProxy                   PikaTreeProxy;


/*  not really a container  */

typedef struct _PikaItemTree                    PikaItemTree;


/*  context objects  */

typedef struct _PikaContext                     PikaContext;
typedef struct _PikaFillOptions                 PikaFillOptions;
typedef struct _PikaStrokeOptions               PikaStrokeOptions;
typedef struct _PikaToolOptions                 PikaToolOptions;


/*  info objects  */

typedef struct _PikaPaintInfo                   PikaPaintInfo;
typedef struct _PikaToolGroup                   PikaToolGroup;
typedef struct _PikaToolInfo                    PikaToolInfo;
typedef struct _PikaToolItem                    PikaToolItem;


/*  data objects  */

typedef struct _PikaDataFactory                 PikaDataFactory;
typedef struct _PikaDataLoaderFactory           PikaDataLoaderFactory;
typedef struct _PikaResource                    PikaResource;
typedef struct _PikaData                        PikaData;
typedef struct _PikaBrush                       PikaBrush;
typedef struct _PikaBrushCache                  PikaBrushCache;
typedef struct _PikaBrushClipboard              PikaBrushClipboard;
typedef struct _PikaBrushGenerated              PikaBrushGenerated;
typedef struct _PikaBrushPipe                   PikaBrushPipe;
typedef struct _PikaCurve                       PikaCurve;
typedef struct _PikaDynamics                    PikaDynamics;
typedef struct _PikaDynamicsOutput              PikaDynamicsOutput;
typedef struct _PikaGradient                    PikaGradient;
typedef struct _PikaMybrush                     PikaMybrush;
typedef struct _PikaPalette                     PikaPalette;
typedef struct _PikaPaletteMru                  PikaPaletteMru;
typedef struct _PikaPattern                     PikaPattern;
typedef struct _PikaPatternClipboard            PikaPatternClipboard;
typedef struct _PikaToolPreset                  PikaToolPreset;
typedef struct _PikaTagCache                    PikaTagCache;


/*  drawable objects  */

typedef struct _PikaDrawable                    PikaDrawable;
typedef struct _PikaChannel                     PikaChannel;
typedef struct _PikaLayerMask                   PikaLayerMask;
typedef struct _PikaSelection                   PikaSelection;
typedef struct _PikaLayer                       PikaLayer;
typedef struct _PikaGroupLayer                  PikaGroupLayer;


/*  auxiliary image items  */

typedef struct _PikaGuide                       PikaGuide;
typedef struct _PikaSamplePoint                 PikaSamplePoint;


/*  undo objects  */

typedef struct _PikaUndo                        PikaUndo;
typedef struct _PikaUndoStack                   PikaUndoStack;
typedef struct _PikaUndoAccumulator             PikaUndoAccumulator;


/* Symmetry transformations */

typedef struct _PikaSymmetry                    PikaSymmetry;
typedef struct _PikaMirror                      PikaMirror;
typedef struct _PikaTiling                      PikaTiling;
typedef struct _PikaMandala                     PikaMandala;


/*  misc objects  */

typedef struct _PikaAsync                       PikaAsync;
typedef struct _PikaAsyncSet                    PikaAsyncSet;
typedef struct _PikaBuffer                      PikaBuffer;
typedef struct _PikaDrawableFilter              PikaDrawableFilter;
typedef struct _PikaEnvironTable                PikaEnvironTable;
typedef struct _PikaExtension                   PikaExtension;
typedef struct _PikaExtensionManager            PikaExtensionManager;
typedef struct _PikaHistogram                   PikaHistogram;
typedef struct _PikaIdTable                     PikaIdTable;
typedef struct _PikaImagefile                   PikaImagefile;
typedef struct _PikaImageProxy                  PikaImageProxy;
typedef struct _PikaInterpreterDB               PikaInterpreterDB;
typedef struct _PikaLineArt                     PikaLineArt;
typedef struct _PikaObjectQueue                 PikaObjectQueue;
typedef struct _PikaParasiteList                PikaParasiteList;
typedef struct _PikaPdbProgress                 PikaPdbProgress;
typedef struct _PikaProjection                  PikaProjection;
typedef struct _PikaSettings                    PikaSettings;
typedef struct _PikaSubProgress                 PikaSubProgress;
typedef struct _PikaTag                         PikaTag;
typedef struct _PikaTreeHandler                 PikaTreeHandler;
typedef struct _PikaTriviallyCancelableWaitable PikaTriviallyCancelableWaitable;
typedef struct _PikaUncancelableWaitable        PikaUncancelableWaitable;


/*  interfaces  */

typedef struct _PikaCancelable                  PikaCancelable;  /* dummy typedef */
typedef struct _PikaPickable                    PikaPickable;    /* dummy typedef */
typedef struct _PikaProgress                    PikaProgress;    /* dummy typedef */
typedef struct _PikaProjectable                 PikaProjectable; /* dummy typedef */
typedef struct _PikaTagged                      PikaTagged;      /* dummy typedef */
typedef struct _PikaWaitable                    PikaWaitable;    /* dummy typedef */


/*  non-object types  */

typedef struct _PikaBacktrace                   PikaBacktrace;
typedef struct _PikaBoundSeg                    PikaBoundSeg;
typedef struct _PikaChunkIterator               PikaChunkIterator;
typedef struct _PikaCoords                      PikaCoords;
typedef struct _PikaGradientSegment             PikaGradientSegment;
typedef struct _PikaPaletteEntry                PikaPaletteEntry;
typedef struct _PikaScanConvert                 PikaScanConvert;
typedef struct _PikaTempBuf                     PikaTempBuf;
typedef         guint32                         PikaTattoo;

/* The following hack is made so that we can reuse the definition
 * the cairo definition of cairo_path_t without having to translate
 * between our own version of a bezier description and cairos version.
 *
 * to avoid having to include <cairo.h> in each and every file
 * including this file we only use the "real" definition when cairo.h
 * already has been included and use something else.
 *
 * Note that if you really want to work with PikaBezierDesc (except just
 * passing pointers to it around) you also need to include <cairo.h>.
 */
#ifdef CAIRO_VERSION
typedef cairo_path_t PikaBezierDesc;
#else
typedef void * PikaBezierDesc;
#endif


/*  functions  */

typedef void     (* PikaInitStatusFunc)    (const gchar *text1,
                                            const gchar *text2,
                                            gdouble      percentage);

typedef gboolean (* PikaObjectFilterFunc)  (PikaObject  *object,
                                            gpointer     user_data);

typedef gint64   (* PikaMemsizeFunc)       (gpointer     instance,
                                            gint64      *gui_size);

typedef void     (* PikaRunAsyncFunc)      (PikaAsync   *async,
                                            gpointer     user_data);


/*  structs  */

struct _PikaCoords
{
  /* axes as reported by the device */
  gdouble  x;
  gdouble  y;
  gdouble  pressure;
  gdouble  xtilt;
  gdouble  ytilt;
  gdouble  wheel;
  gdouble  distance;
  gdouble  rotation;
  gdouble  slider;

  /* synthetic axes */
  gdouble  velocity;
  gdouble  direction;

  /* view transform */
  gdouble  xscale;  /* the view scale                */
  gdouble  yscale;
  gdouble  angle;   /* the view rotation angle       */
  gboolean reflect; /* whether the view is reflected */
};

/*  temp hack as replacement for GdkSegment  */

typedef struct _PikaSegment PikaSegment;

struct _PikaSegment
{
  gint x1;
  gint y1;
  gint x2;
  gint y2;
};


#include "gegl/pika-gegl-types.h"
#include "paint/paint-types.h"
#include "text/text-types.h"
#include "vectors/vectors-types.h"
#include "pdb/pdb-types.h"
#include "plug-in/plug-in-types.h"


#endif /* __CORE_TYPES_H__ */
