Commit 0bfa402c authored by Michael Natterer's avatar Michael Natterer 😴

Argh, this was meant to be squashed into the previous commit...

parent cc928879
......@@ -164,7 +164,6 @@ gimpconsoleldadd = \
$(GEGL_LIBS) \
$(GLIB_LIBS) \
$(GEXIV2_LIBS) \
$(LCMS_LIBS) \
$(Z_LIBS) \
$(JSON_C_LIBS) \
$(LIBMYPAINT_LIBS) \
......
......@@ -110,7 +110,6 @@ test_config_LDADD = \
$(libgimpmath) \
$(libgimpconfig) \
$(libgimpbase) \
$(LCMS_LIBS) \
$(PANGOCAIRO_LIBS) \
$(HARFBUZZ_LIBS) \
$(GDK_PIXBUF_LIBS) \
......
......@@ -16,9 +16,8 @@ AM_CPPFLAGS = \
$(CAIRO_CFLAGS) \
$(GEGL_CFLAGS) \
$(GDK_PIXBUF_CFLAGS) \
$(LIBMYPAINT_CFLAGS) \
$(LIBMYPAINT_CFLAGS) \
$(GEXIV2_CFLAGS) \
$(LCMS_CFLAGS) \
-I$(includedir) \
$(xobjective_c)
......
......@@ -21,7 +21,6 @@
#include "config.h"
#include <string.h>
#include <lcms2.h>
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
......@@ -664,13 +663,12 @@ _gimp_image_update_color_profile (GimpImage *image,
if (private->color_profile)
{
GimpColorProfile *srgb_profile;
cmsUInt32Number flags;
GimpColorProfile *srgb_profile;
GimpColorTransformFlags flags = 0;
srgb_profile = gimp_color_profile_new_rgb_srgb ();
flags = cmsFLAGS_NOOPTIMIZE;
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
private->transform_to_srgb_u8 =
gimp_color_transform_new (private->color_profile,
......@@ -785,20 +783,22 @@ gimp_image_convert_profile_colormap (GimpImage *image,
gboolean bpc,
GimpProgress *progress)
{
GimpColorTransform *transform;
guchar *cmap;
gint n_colors;
GimpColorTransform *transform;
GimpColorTransformFlags flags = 0;
guchar *cmap;
gint n_colors;
n_colors = gimp_image_get_colormap_size (image);
cmap = g_memdup (gimp_image_get_colormap (image), n_colors * 3);
if (bpc)
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
transform = gimp_color_transform_new (src_profile,
babl_format ("R'G'B' u8"),
dest_profile,
babl_format ("R'G'B' u8"),
intent,
cmsFLAGS_NOOPTIMIZE |
(bpc ? cmsFLAGS_BLACKPOINTCOMPENSATION : 0));
intent, flags);
if (transform)
{
......
......@@ -6,7 +6,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir)/app \
-I$(top_srcdir)/app \
$(LCMS_CFLAGS) \
$(GEGL_CFLAGS) \
$(GTK_CFLAGS) \
-I$(includedir)
......
......@@ -17,8 +17,6 @@
#include "config.h"
#include <lcms2.h>
#include <gegl.h>
#include <gtk/gtk.h>
......
......@@ -9,7 +9,6 @@ AM_CPPFLAGS = \
$(CAIRO_CFLAGS) \
$(GEGL_CFLAGS) \
$(GDK_PIXBUF_CFLAGS) \
$(LCMS_CFLAGS) \
-I$(includedir)
noinst_LIBRARIES = libappgegl.a
......
......@@ -20,8 +20,6 @@
#include "config.h"
#include <lcms2.h>
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
......@@ -710,10 +708,10 @@ gimp_gegl_convert_color_profile (GeglBuffer *src_buffer,
gboolean bpc,
GimpProgress *progress)
{
GimpColorTransform *transform;
const Babl *src_format;
const Babl *dest_format;
cmsUInt32Number flags;
GimpColorTransform *transform;
GimpColorTransformFlags flags = 0;
const Babl *src_format;
const Babl *dest_format;
src_format = gegl_buffer_get_format (src_buffer);
dest_format = gegl_buffer_get_format (dest_buffer);
......@@ -725,10 +723,8 @@ gimp_gegl_convert_color_profile (GeglBuffer *src_buffer,
return;
}
flags = cmsFLAGS_NOOPTIMIZE;
if (bpc)
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
transform = gimp_color_transform_new (src_profile, src_format,
dest_profile, dest_format,
......
......@@ -10,7 +10,6 @@ AM_CPPFLAGS = \
$(CAIRO_CFLAGS) \
$(GEGL_CFLAGS) \
$(GDK_PIXBUF_CFLAGS) \
$(LCMS_CFLAGS) \
-I$(includedir)
noinst_LIBRARIES = \
......
......@@ -16,18 +16,13 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Ported from the threshold-alpha plug-in
* Copyright (C) 1997 Shuji Narazaki <narazaki@InetQ.or.jp>
*/
#include "config.h"
#include <cairo.h>
#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gegl.h>
#include <lcms2.h>
#include "libgimpconfig/gimpconfig.h"
#include "libgimpcolor/gimpcolor.h"
......@@ -250,10 +245,10 @@ gimp_operation_profile_transform_prepare (GeglOperation *operation)
if (self->src_profile && self->dest_profile)
{
cmsUInt32Number flags = cmsFLAGS_NOOPTIMIZE;
GimpColorTransformFlags flags = 0;
if (self->bpc)
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
self->transform = gimp_color_transform_new (self->src_profile, format,
self->dest_profile, format,
......
......@@ -122,7 +122,6 @@ LDADD = \
$(GEGL_LIBS) \
$(GIO_LIBS) \
$(GEXIV2_LIBS) \
$(LCMS_LIBS) \
$(Z_LIBS) \
$(JSON_C_LIBS) \
$(LIBMYPAINT_LIBS) \
......
......@@ -8,7 +8,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir)/app \
-I$(top_srcdir)/app \
$(LCMS_CFLAGS) \
$(GEGL_CFLAGS) \
$(GTK_CFLAGS) \
-I$(includedir)
......
......@@ -23,8 +23,6 @@
#include <string.h>
#include <lcms2.h>
#include <gegl.h>
#include <gtk/gtk.h>
......
......@@ -165,7 +165,7 @@ gimp_color_transform_new (GimpColorProfile *src_profile,
GimpColorProfile *dest_profile,
const Babl *dest_format,
GimpColorRenderingIntent rendering_intent,
guint32 flags)
GimpColorTransformFlags flags)
{
GimpColorTransform *transform;
GimpColorTransformPrivate *priv;
......@@ -194,7 +194,7 @@ gimp_color_transform_new (GimpColorProfile *src_profile,
priv->transform = cmsCreateTransform (src_lcms, lcms_src_format,
dest_lcms, lcms_dest_format,
rendering_intent,
flags);
flags | cmsFLAGS_NOOPTIMIZE);
return transform;
}
......@@ -224,7 +224,7 @@ gimp_color_transform_new_proofing (GimpColorProfile *src_profile,
GimpColorProfile *proof_profile,
GimpColorRenderingIntent proof_intent,
GimpColorRenderingIntent display_intent,
guint32 flags)
GimpColorTransformFlags flags)
{
GimpColorTransform *transform;
GimpColorTransformPrivate *priv;
......
......@@ -32,6 +32,13 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
typedef enum
{
GIMP_COLOR_TRANSFORM_FLAGS_GAMUT_CHECK = 0x1000,
GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION = 0x2000,
} GimpColorTransformFlags;
#define GIMP_TYPE_COLOR_TRANSFORM (gimp_color_transform_get_type ())
#define GIMP_COLOR_TRANSFORM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_TRANSFORM, GimpColorTransform))
#define GIMP_COLOR_TRANSFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_TRANSFORM, GimpColorTransformClass))
......@@ -74,7 +81,7 @@ GimpColorTransform *
GimpColorProfile *dest_profile,
const Babl *dest_format,
GimpColorRenderingIntent rendering_intent,
guint32 flags);
GimpColorTransformFlags flags);
GimpColorTransform *
gimp_color_transform_new_proofing (GimpColorProfile *src_profile,
......@@ -84,7 +91,7 @@ GimpColorTransform *
GimpColorProfile *proof_profile,
GimpColorRenderingIntent proof_intent,
GimpColorRenderingIntent display_intent,
guint32 flags);
GimpColorTransformFlags flags);
void gimp_color_transform_process_pixels (GimpColorTransform *transform,
const Babl *src_format,
......
......@@ -21,8 +21,6 @@
#include "config.h"
#include <lcms2.h>
#include <gegl.h>
#include <gtk/gtk.h>
......
......@@ -19,7 +19,6 @@
#include "config.h"
#include <string.h>
#include <lcms2.h>
#include <gegl.h>
#include <gtk/gtk.h>
......
......@@ -513,18 +513,18 @@ gimp_widget_get_color_transform (GtkWidget *widget,
if (proof_profile)
{
cmsUInt32Number softproof_flags = cmsFLAGS_SOFTPROOFING;
GimpColorTransformFlags flags = 0;
if (config->simulation_use_black_point_compensation)
{
softproof_flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
}
if (config->simulation_gamut_check)
{
guchar r, g, b;
softproof_flags |= cmsFLAGS_GAMUTCHECK;
flags |= GIMP_COLOR_TRANSFORM_FLAGS_GAMUT_CHECK;
gimp_rgb_get_uchar (&config->out_of_gamut_color, &r, &g, &b);
......@@ -540,23 +540,23 @@ gimp_widget_get_color_transform (GtkWidget *widget,
proof_profile,
config->simulation_intent,
config->display_intent,
softproof_flags);
flags);
g_object_unref (proof_profile);
}
else if (! gimp_color_profile_is_equal (src_profile, dest_profile))
{
guint32 display_flags = 0;
GimpColorTransformFlags flags = 0;
if (config->display_use_black_point_compensation)
{
display_flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
}
transform = gimp_color_transform_new (src_profile, src_format,
dest_profile, dest_format,
config->display_intent,
display_flags);
flags);
}
g_object_unref (dest_profile);
......
......@@ -53,8 +53,7 @@ controller_libadd = $(modules_libadd)
libcolor_selector_cmyk_la_SOURCES = color-selector-cmyk.c
libcolor_selector_cmyk_la_LDFLAGS = -avoid-version -module $(no_undefined)
libcolor_selector_cmyk_la_CFLAGS = $(LCMS_CFLAGS)
libcolor_selector_cmyk_la_LIBADD = $(libgimpconfig) $(color_selector_libadd) $(LCMS_LIBS)
libcolor_selector_cmyk_la_LIBADD = $(libgimpconfig) $(color_selector_libadd)
libcolor_selector_water_la_SOURCES = color-selector-water.c
libcolor_selector_water_la_LDFLAGS = -avoid-version -module $(no_undefined)
......@@ -77,18 +76,12 @@ libdisplay_filter_high_contrast_la_LDFLAGS = -avoid-version -module $(no_undefin
libdisplay_filter_high_contrast_la_LIBADD = $(display_filter_libadd)
libdisplay_filter_lcms_la_SOURCES = display-filter-lcms.c
libdisplay_filter_lcms_la_CFLAGS = $(LCMS_CFLAGS)
libdisplay_filter_lcms_la_LDFLAGS = -avoid-version -module $(no_undefined)
libdisplay_filter_lcms_la_LIBADD = $(display_filter_libadd) $(LCMS_LIBS)
if PLATFORM_WIN32
libdisplay_filter_lcms_la_LIBADD += -lgdi32
endif
libdisplay_filter_lcms_la_LIBADD = $(display_filter_libadd)
libdisplay_filter_proof_la_SOURCES = display-filter-proof.c
libdisplay_filter_proof_la_CFLAGS = $(LCMS_CFLAGS)
libdisplay_filter_proof_la_LDFLAGS = -avoid-version -module $(no_undefined)
libdisplay_filter_proof_la_LIBADD = $(display_filter_libadd) $(LCMS_LIBS)
libdisplay_filter_proof_la_LIBADD = $(display_filter_libadd)
libcontroller_linux_input_la_SOURCES = \
gimpinputdevicestore-gudev.c \
......
......@@ -17,8 +17,6 @@
#include "config.h"
#include <lcms2.h>
#include <gegl.h>
#include <gtk/gtk.h>
......@@ -44,17 +42,17 @@ typedef struct _ColorselCmykClass ColorselCmykClass;
struct _ColorselCmyk
{
GimpColorSelector parent_instance;
GimpColorSelector parent_instance;
GimpColorConfig *config;
cmsHTRANSFORM rgb2cmyk;
cmsHTRANSFORM cmyk2rgb;
GimpColorConfig *config;
GimpColorTransform *rgb2cmyk;
GimpColorTransform *cmyk2rgb;
GimpCMYK cmyk;
GtkAdjustment *adj[4];
GtkWidget *name_label;
GimpCMYK cmyk;
GtkAdjustment *adj[4];
GtkWidget *name_label;
gboolean in_destruction;
gboolean in_destruction;
};
struct _ColorselCmykClass
......@@ -228,7 +226,12 @@ colorsel_cmyk_set_color (GimpColorSelector *selector,
rgb_values[1] = rgb->g;
rgb_values[2] = rgb->b;
cmsDoTransform (module->rgb2cmyk, rgb_values, cmyk_values, 1);
gimp_color_transform_process_pixels (module->rgb2cmyk,
babl_format ("R'G'B' double"),
rgb_values,
babl_format ("CMYK double"),
cmyk_values,
1);
module->cmyk.c = cmyk_values[0] / 100.0;
module->cmyk.m = cmyk_values[1] / 100.0;
......@@ -331,7 +334,12 @@ colorsel_cmyk_adj_update (GtkAdjustment *adj,
cmyk_values[2] = module->cmyk.y * 100.0;
cmyk_values[3] = module->cmyk.k * 100.0;
cmsDoTransform (module->cmyk2rgb, cmyk_values, rgb_values, 1);
gimp_color_transform_process_pixels (module->rgb2cmyk,
babl_format ("CMYK double"),
cmyk_values,
babl_format ("R'G'B' double"),
rgb_values,
1);
selector->rgb.r = rgb_values[0];
selector->rgb.g = rgb_values[1];
......@@ -350,24 +358,22 @@ colorsel_cmyk_adj_update (GtkAdjustment *adj,
static void
colorsel_cmyk_config_changed (ColorselCmyk *module)
{
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module);
GimpColorConfig *config = module->config;
cmsUInt32Number flags = 0;
GimpColorProfile *rgb_profile = NULL;
GimpColorProfile *cmyk_profile = NULL;
cmsHPROFILE rgb_lcms;
cmsHPROFILE cmyk_lcms;
gchar *text;
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module);
GimpColorConfig *config = module->config;
GimpColorTransformFlags flags = 0;
GimpColorProfile *rgb_profile = NULL;
GimpColorProfile *cmyk_profile = NULL;
gchar *text;
if (module->rgb2cmyk)
{
cmsDeleteTransform (module->rgb2cmyk);
g_object_unref (module->rgb2cmyk);
module->rgb2cmyk = NULL;
}
if (module->cmyk2rgb)
{
cmsDeleteTransform (module->cmyk2rgb);
g_object_unref (module->cmyk2rgb);
module->cmyk2rgb = NULL;
}
......@@ -392,23 +398,24 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
gimp_color_profile_get_summary (cmyk_profile),
NULL);
rgb_lcms = gimp_color_profile_get_lcms_profile (rgb_profile);
cmyk_lcms = gimp_color_profile_get_lcms_profile (cmyk_profile);
if (config->display_intent ==
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC)
{
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
}
module->rgb2cmyk = cmsCreateTransform (rgb_lcms, TYPE_RGB_DBL,
cmyk_lcms, TYPE_CMYK_DBL,
config->display_intent,
flags);
module->cmyk2rgb = cmsCreateTransform (cmyk_lcms, TYPE_CMYK_DBL,
rgb_lcms, TYPE_RGB_DBL,
config->display_intent,
flags);
module->rgb2cmyk = gimp_color_transform_new (rgb_profile,
babl_format ("R'G'B' double"),
cmyk_profile,
babl_format ("CMYK double"),
config->display_intent,
flags);
module->cmyk2rgb = gimp_color_transform_new (cmyk_profile,
babl_format ("CMYK double"),
rgb_profile,
babl_format ("R'G'B' double"),
config->display_intent,
flags);
out:
......
......@@ -21,14 +21,6 @@
#include <string.h>
#ifdef G_OS_WIN32
#define STRICT
#include <windows.h>
#define LCMS_WIN_TYPES_ALREADY_DEFINED
#endif
#include <lcms2.h>
#include <gegl.h>
#include <gtk/gtk.h>
......
......@@ -17,8 +17,6 @@
#include "config.h"
#include <lcms2.h>
#include <gegl.h>
#include <gtk/gtk.h>
......@@ -43,13 +41,13 @@ typedef struct _CdisplayProofClass CdisplayProofClass;
struct _CdisplayProof
{
GimpColorDisplay parent_instance;
GimpColorDisplay parent_instance;
gint intent;
gboolean bpc;
gchar *profile;
gint intent;
gboolean bpc;
gchar *profile;
cmsHTRANSFORM transform;
GimpColorTransform *transform;
};
struct _CdisplayProofClass
......@@ -182,7 +180,7 @@ cdisplay_proof_finalize (GObject *object)
if (proof->transform)
{
cmsDeleteTransform (proof->transform);
g_object_unref (proof->transform);
proof->transform = NULL;
}
......@@ -247,22 +245,12 @@ cdisplay_proof_convert_buffer (GimpColorDisplay *display,
GeglBuffer *buffer,
GeglRectangle *area)
{
CdisplayProof *proof = CDISPLAY_PROOF (display);
GeglBufferIterator *iter;
if (! proof->transform)
return;
iter = gegl_buffer_iterator_new (buffer, area, 0,
babl_format ("R'G'B'A float"),
GEGL_ACCESS_READWRITE, GEGL_ABYSS_NONE);
while (gegl_buffer_iterator_next (iter))
{
gfloat *data = iter->data[0];
CdisplayProof *proof = CDISPLAY_PROOF (display);
cmsDoTransform (proof->transform, data, data, iter->length);
}
if (proof->transform)
gimp_color_transform_process_buffer (proof->transform,
buffer, area,
buffer, area);
}
static void
......@@ -351,7 +339,7 @@ cdisplay_proof_changed (GimpColorDisplay *display)
if (proof->transform)
{
cmsDeleteTransform (proof->transform);
g_object_unref (proof->transform);
proof->transform = NULL;
}
......@@ -366,22 +354,20 @@ cdisplay_proof_changed (GimpColorDisplay *display)
if (proof_profile)
{
cmsHPROFILE rgb_lcms;
cmsHPROFILE proof_lcms;
cmsUInt32Number flags = cmsFLAGS_SOFTPROOFING;
rgb_lcms = gimp_color_profile_get_lcms_profile (rgb_profile);
proof_lcms = gimp_color_profile_get_lcms_profile (proof_profile);
GimpColorTransformFlags flags = 0;
if (proof->bpc)
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
proof->transform = cmsCreateProofingTransform (rgb_lcms, TYPE_RGBA_FLT,
rgb_lcms, TYPE_RGBA_FLT,
proof_lcms,
proof->intent,
proof->intent,
flags);
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
proof->transform =
gimp_color_transform_new_proofing (rgb_profile,
babl_format ("R'G'B'A float"),
rgb_profile,
babl_format ("R'G'B'A float"),
proof_profile,
proof->intent,
proof->intent,
flags);
g_object_unref (proof_profile);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment