/* LIBPIKA - The PIKA Library
 * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
 *
 * pikacolortransform.h
 * Copyright (C) 2014  Michael Natterer <mitch@gimp.org>
 *                     Elle Stone <ellestone@ninedegreesbelow.com>
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <https://www.gnu.org/licenses/>.
 */

#if !defined (__PIKA_COLOR_H_INSIDE__) && !defined (PIKA_COLOR_COMPILATION)
#error "Only <libpikacolor/pikacolor.h> can be included directly."
#endif

#ifndef __PIKA_COLOR_TRANSFORM_H__
#define __PIKA_COLOR_TRANSFORM_H__

G_BEGIN_DECLS

/* For information look into the C source or the html documentation */


/**
 * PikaColorTransformFlags:
 * @PIKA_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE: optimize for accuracy rather
 *   than for speed
 * @PIKA_COLOR_TRANSFORM_FLAGS_GAMUT_CHECK: mark out of gamut colors in the
 *   transform result
 * @PIKA_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION: do black point
 *   compensation
 *
 * Flags for modifying #PikaColorTransform's behavior.
 **/
typedef enum
{
  PIKA_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE               = 0x0100,
  PIKA_COLOR_TRANSFORM_FLAGS_GAMUT_CHECK              = 0x1000,
  PIKA_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION = 0x2000,
} PikaColorTransformFlags;


#define PIKA_TYPE_COLOR_TRANSFORM            (pika_color_transform_get_type ())
#define PIKA_COLOR_TRANSFORM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_COLOR_TRANSFORM, PikaColorTransform))
#define PIKA_COLOR_TRANSFORM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_COLOR_TRANSFORM, PikaColorTransformClass))
#define PIKA_IS_COLOR_TRANSFORM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_COLOR_TRANSFORM))
#define PIKA_IS_COLOR_TRANSFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_COLOR_TRANSFORM))
#define PIKA_COLOR_TRANSFORM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_COLOR_TRANSFORM, PikaColorTransformClass))


typedef struct _PikaColorTransformPrivate PikaColorTransformPrivate;
typedef struct _PikaColorTransformClass   PikaColorTransformClass;

struct _PikaColorTransform
{
  GObject                    parent_instance;

  PikaColorTransformPrivate *priv;
};

struct _PikaColorTransformClass
{
  GObjectClass  parent_class;

  /* signals */
  void (* progress) (PikaColorTransform *transform,
                     gdouble             fraction);

  /* Padding for future expansion */
  void (* _pika_reserved1) (void);
  void (* _pika_reserved2) (void);
  void (* _pika_reserved3) (void);
  void (* _pika_reserved4) (void);
  void (* _pika_reserved5) (void);
  void (* _pika_reserved6) (void);
  void (* _pika_reserved7) (void);
  void (* _pika_reserved8) (void);
};


GType   pika_color_transform_get_type (void) G_GNUC_CONST;

PikaColorTransform *
        pika_color_transform_new              (PikaColorProfile         *src_profile,
                                               const Babl               *src_format,
                                               PikaColorProfile         *dest_profile,
                                               const Babl               *dest_format,
                                               PikaColorRenderingIntent  rendering_intent,
                                               PikaColorTransformFlags   flags);

PikaColorTransform *
        pika_color_transform_new_proofing     (PikaColorProfile         *src_profile,
                                               const Babl               *src_format,
                                               PikaColorProfile         *dest_profile,
                                               const Babl               *dest_format,
                                               PikaColorProfile         *proof_profile,
                                               PikaColorRenderingIntent  proof_intent,
                                               PikaColorRenderingIntent  display_intent,
                                               PikaColorTransformFlags   flags);

void    pika_color_transform_process_pixels   (PikaColorTransform       *transform,
                                               const Babl               *src_format,
                                               gconstpointer             src_pixels,
                                               const Babl               *dest_format,
                                               gpointer                  dest_pixels,
                                               gsize                     length);

void    pika_color_transform_process_buffer   (PikaColorTransform       *transform,
                                               GeglBuffer               *src_buffer,
                                               const GeglRectangle      *src_rect,
                                               GeglBuffer               *dest_buffer,
                                               const GeglRectangle      *dest_rect);

gboolean pika_color_transform_can_gegl_copy   (PikaColorProfile         *src_profile,
                                               PikaColorProfile         *dest_profile);


G_END_DECLS

#endif  /* __PIKA_COLOR_TRANSFORM_H__ */
