1 /* LIBGIMP - The GIMP Library
2  * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
3  *
4  * gimpcolortransform.h
5  * Copyright (C) 2014  Michael Natterer <mitch@gimp.org>
6  *                     Elle Stone <ellestone@ninedegreesbelow.com>
7  *
8  * This library is free software: you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 3 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library.  If not, see
20  * <https://www.gnu.org/licenses/>.
21  */
22 
23 #if !defined (__GIMP_COLOR_H_INSIDE__) && !defined (GIMP_COLOR_COMPILATION)
24 #error "Only <libgimpcolor/gimpcolor.h> can be included directly."
25 #endif
26 
27 #ifndef __GIMP_COLOR_TRANSFORM_H__
28 #define __GIMP_COLOR_TRANSFORM_H__
29 
30 G_BEGIN_DECLS
31 
32 /* For information look into the C source or the html documentation */
33 
34 
35 /**
36  * GimpColorTransformFlags:
37  * @GIMP_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE: optimize for accuracy rather
38  *   than for speed
39  * @GIMP_COLOR_TRANSFORM_FLAGS_GAMUT_CHECK: mark out of gamut colors in the
40  *   transform result
41  * @GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION: do black point
42  *   compensation
43  *
44  * Flags for modifying #GimpColorTransform's behavior.
45  **/
46 typedef enum
47 {
48   GIMP_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE               = 0x0100,
49   GIMP_COLOR_TRANSFORM_FLAGS_GAMUT_CHECK              = 0x1000,
50   GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION = 0x2000,
51 } GimpColorTransformFlags;
52 
53 
54 #define GIMP_TYPE_COLOR_TRANSFORM            (gimp_color_transform_get_type ())
55 #define GIMP_COLOR_TRANSFORM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_TRANSFORM, GimpColorTransform))
56 #define GIMP_COLOR_TRANSFORM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_TRANSFORM, GimpColorTransformClass))
57 #define GIMP_IS_COLOR_TRANSFORM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_TRANSFORM))
58 #define GIMP_IS_COLOR_TRANSFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_TRANSFORM))
59 #define GIMP_COLOR_TRANSFORM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_TRANSFORM, GimpColorTransformClass))
60 
61 
62 typedef struct _GimpColorTransformClass   GimpColorTransformClass;
63 typedef struct _GimpColorTransformPrivate GimpColorTransformPrivate;
64 
65 struct _GimpColorTransform
66 {
67   GObject                    parent_instance;
68 
69   GimpColorTransformPrivate *priv;
70 };
71 
72 struct _GimpColorTransformClass
73 {
74   GObjectClass  parent_class;
75 
76   /* signals */
77   void (* progress) (GimpColorTransform *transform,
78                      gdouble             fraction);
79 
80   /* Padding for future expansion */
81   void (* _gimp_reserved1) (void);
82   void (* _gimp_reserved2) (void);
83   void (* _gimp_reserved3) (void);
84   void (* _gimp_reserved4) (void);
85 };
86 
87 
88 GType   gimp_color_transform_get_type (void) G_GNUC_CONST;
89 
90 GimpColorTransform *
91         gimp_color_transform_new              (GimpColorProfile         *src_profile,
92                                                const Babl               *src_format,
93                                                GimpColorProfile         *dest_profile,
94                                                const Babl               *dest_format,
95                                                GimpColorRenderingIntent  rendering_intent,
96                                                GimpColorTransformFlags   flags);
97 
98 GimpColorTransform *
99         gimp_color_transform_new_proofing     (GimpColorProfile         *src_profile,
100                                                const Babl               *src_format,
101                                                GimpColorProfile         *dest_profile,
102                                                const Babl               *dest_format,
103                                                GimpColorProfile         *proof_profile,
104                                                GimpColorRenderingIntent  proof_intent,
105                                                GimpColorRenderingIntent  display_intent,
106                                                GimpColorTransformFlags   flags);
107 
108 void    gimp_color_transform_process_pixels   (GimpColorTransform       *transform,
109                                                const Babl               *src_format,
110                                                gconstpointer             src_pixels,
111                                                const Babl               *dest_format,
112                                                gpointer                  dest_pixels,
113                                                gsize                     length);
114 
115 void    gimp_color_transform_process_buffer   (GimpColorTransform       *transform,
116                                                GeglBuffer               *src_buffer,
117                                                const GeglRectangle      *src_rect,
118                                                GeglBuffer               *dest_buffer,
119                                                const GeglRectangle      *dest_rect);
120 
121 gboolean gimp_color_transform_can_gegl_copy   (GimpColorProfile         *src_profile,
122                                                GimpColorProfile         *dest_profile);
123 
124 
125 G_END_DECLS
126 
127 #endif  /* __GIMP_COLOR_TRANSFORM_H__ */
128