1267 lines
46 KiB
Diff
1267 lines
46 KiB
Diff
diff -up cinepaint-0.22-1/app/cms.c.oy19 cinepaint-0.22-1/app/cms.c
|
|
--- cinepaint-0.22-1/app/cms.c.oy19 2007-05-10 22:18:31.000000000 +0200
|
|
+++ cinepaint-0.22-1/app/cms.c 2009-03-09 15:39:36.000000000 +0100
|
|
@@ -38,9 +38,18 @@
|
|
|
|
#ifdef HAVE_OY
|
|
#include <oyranos/oyranos.h>
|
|
+#ifndef OYRANOS_VERSION
|
|
+#define OYRANOS_VERSION 0
|
|
+#endif
|
|
+#if OYRANOS_VERSION < 108
|
|
+#include <arpa/inet.h> /* ntohl */
|
|
#include <oyranos/oyranos_monitor.h>
|
|
+#else
|
|
+#include <oyranos/oyranos_alpha.h>
|
|
+#endif
|
|
#endif
|
|
|
|
+#include "config.h"
|
|
#include "../lib/version.h"
|
|
#include "libgimp/gimpintl.h"
|
|
#include "depth/float16.h"
|
|
@@ -49,6 +58,7 @@
|
|
#include "general.h"
|
|
#include "gdisplay.h"
|
|
#include "gimage_cmds.h"
|
|
+#include "interface.h"
|
|
#include "pixelarea.h"
|
|
#include "pixelrow.h"
|
|
#include "rc.h"
|
|
@@ -104,12 +114,14 @@ struct _CMSProfile
|
|
cmsHPROFILE handle;
|
|
char *data; /* save original data for profile i/o */
|
|
size_t size;
|
|
+ char cspace[8];
|
|
};
|
|
|
|
/* same for transform */
|
|
struct _CMSTransform
|
|
{ gchar *cache_key;
|
|
- Tag tag;
|
|
+ Tag src_tag;
|
|
+ Tag dest_tag;
|
|
cmsHTRANSFORM handle;
|
|
icColorSpaceSignature colourspace_in; /*!< source/image colour space */
|
|
DWORD lcms_input_format; /*!< put information about alpha ... */
|
|
@@ -263,7 +275,7 @@ void cms_init()
|
|
|
|
/* sanity checks of settings, remove failed settings */
|
|
/* suppress lcms errors while checking */
|
|
- cmsErrorAction(LCMS_ERROR_IGNORE);
|
|
+ cmsErrorAction(LCMS_ERROR_IGNORE);
|
|
|
|
/* 1. image profile */
|
|
if (cms_default_image_profile_name != NULL)
|
|
@@ -334,6 +346,77 @@ void* my_alloc_func( size_t size )
|
|
{ return calloc(1, size);
|
|
}
|
|
|
|
+#ifdef HAVE_OY
|
|
+# if OYRANOS_VERSION > 107
|
|
+int iccMessageFunc( int code, const oyStruct_s * context, const char * format, ... )
|
|
+{
|
|
+ char* text = 0, *pos = 0;
|
|
+ va_list list;
|
|
+ const char * type_name = "";
|
|
+ int id = -1;
|
|
+
|
|
+ if(code == oyMSG_DBG)
|
|
+ return 0;
|
|
+
|
|
+
|
|
+ if(context && oyOBJECT_NONE < context->type_)
|
|
+ {
|
|
+ type_name = oyStruct_TypeToText( context );
|
|
+ id = oyObject_GetId( context->oy_ );
|
|
+ }
|
|
+
|
|
+ text = (char*)calloc(sizeof(char), 4096);
|
|
+ if(!text)
|
|
+ return 1;
|
|
+ text[0] = 0;
|
|
+
|
|
+ switch(code)
|
|
+ {
|
|
+ case oyMSG_WARN:
|
|
+ sprintf( &text[strlen(text)], _("WARNING: "));
|
|
+ break;
|
|
+ case oyMSG_ERROR:
|
|
+ sprintf( &text[strlen(text)], _("!!! ERROR: "));
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ va_start( list, format);
|
|
+ vsnprintf( &text[strlen(text)], 4096 - strlen(text), format, list);
|
|
+ va_end ( list );
|
|
+
|
|
+
|
|
+ snprintf( &text[strlen(text)], 4096 - strlen(text), "%s[%d] ",type_name,id );
|
|
+
|
|
+ pos = &text[strlen(text)];
|
|
+ *pos = '\n';
|
|
+ pos++;
|
|
+ *pos = 0;
|
|
+
|
|
+#ifndef DEBUG
|
|
+ if(code == oyMSG_WARN)
|
|
+ {
|
|
+ int i = 0;
|
|
+ while(text[i])
|
|
+ fputc(text[i++], stderr);
|
|
+ fprintf( stderr, "\n" );
|
|
+ } else
|
|
+#endif
|
|
+ message_box( text, NULL, NULL );
|
|
+
|
|
+ free( text );
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+/* just a wrapper */
|
|
+int lcmsMessageFunc( int code, const char * txt )
|
|
+{
|
|
+ iccMessageFunc( code, 0, txt );
|
|
+ return 0;
|
|
+}
|
|
+# endif
|
|
+#endif
|
|
+
|
|
+
|
|
void cms_init_oyranos()
|
|
{
|
|
#ifdef HAVE_OY
|
|
@@ -341,6 +424,12 @@ void cms_init_oyranos()
|
|
size_t test_size = 0; /* profile size */
|
|
char *p_name = NULL; /* profile name */
|
|
|
|
+ /* messages */
|
|
+# if OYRANOS_VERSION > 107
|
|
+ oyMessageFuncSet( iccMessageFunc );
|
|
+ cmsSetErrorHandler( lcmsMessageFunc );
|
|
+# endif
|
|
+
|
|
/* we dont touch or save the hand made settings */
|
|
|
|
/* 1. assumed image profile */
|
|
@@ -374,6 +463,8 @@ void cms_init_oyranos()
|
|
const char *display_name = gdk_get_display ();
|
|
|
|
test = oyGetMonitorProfile( display_name, &test_size, my_alloc_func );
|
|
+ printf("%s:%d %s() monitor profile size: %d\n",__FILE__,__LINE__,__func__,
|
|
+ test_size );
|
|
|
|
if (test == NULL || !test_size)
|
|
{
|
|
@@ -666,6 +757,7 @@ cms_get_long_profile_info(cmsHPROFILE h
|
|
{ static char profile_info[4096];
|
|
|
|
gchar *text;
|
|
+ const char*tmp = NULL;
|
|
cmsCIEXYZ WhitePt;
|
|
int first = FALSE,
|
|
min_len = 24, /* formatting */
|
|
@@ -683,56 +775,71 @@ cms_get_long_profile_info(cmsHPROFILE h
|
|
#endif
|
|
profile_info[0] = '\000';
|
|
if (cmsIsTag(hProfile, icSigProfileDescriptionTag)) {
|
|
+ tmp = cmsTakeProductDesc(hProfile);
|
|
+ if(tmp && strlen(tmp))
|
|
+ {
|
|
sprintf (text,_("Description: "));
|
|
- sprintf (profile_info,"%s%s %s",profile_info,text,
|
|
- cmsTakeProductDesc(hProfile));
|
|
+ sprintf (&profile_info[strlen(profile_info)],"%s %s", text, tmp);
|
|
if (!first) {
|
|
len = min_len - strlen (profile_info);
|
|
|
|
for (i=0; i < len * 2.2; i++) {
|
|
- sprintf (profile_info,"%s ",profile_info);
|
|
+ sprintf (&profile_info[strlen(profile_info)]," ");
|
|
}
|
|
}
|
|
- sprintf (profile_info,"%s\n",profile_info);
|
|
+ sprintf (&profile_info[strlen(profile_info)],"\n");
|
|
+ }
|
|
}
|
|
if (cmsIsTag(hProfile, icSigDeviceMfgDescTag)) {
|
|
+ tmp = cmsTakeProductName(hProfile);
|
|
+ if(tmp && strlen(tmp))
|
|
+ {
|
|
sprintf (text,_("Product: "));
|
|
- sprintf (profile_info,"%s%s %s\n",profile_info,text,
|
|
- cmsTakeProductName(hProfile));
|
|
+ sprintf (&profile_info[strlen(profile_info)],"%s %s\n", text, tmp);
|
|
+ }
|
|
}
|
|
#if LCMS_VERSION >= 112
|
|
if (cmsIsTag(hProfile, icSigDeviceMfgDescTag)) {
|
|
+ tmp = cmsTakeManufacturer(hProfile);
|
|
+ if(tmp && strlen(tmp))
|
|
+ {
|
|
sprintf (text,_("Manufacturer: "));
|
|
- sprintf (profile_info,"%s%s %s\n",profile_info,text,
|
|
- cmsTakeManufacturer(hProfile));
|
|
+ sprintf (&profile_info[strlen(profile_info)],"%s %s\n", text, tmp);
|
|
+ }
|
|
}
|
|
if (cmsIsTag(hProfile, icSigDeviceModelDescTag)) {
|
|
+ tmp = cmsTakeModel(hProfile);
|
|
+ if(tmp && strlen(tmp))
|
|
+ {
|
|
sprintf (text,_("Model: "));
|
|
- sprintf (profile_info,"%s%s %s\n",profile_info,text,
|
|
- cmsTakeModel(hProfile));
|
|
+ sprintf (&profile_info[strlen(profile_info)],"%s %s\n", text, tmp);
|
|
+ }
|
|
}
|
|
#endif
|
|
#if LCMS_VERSION >= 113
|
|
if (cmsIsTag(hProfile, icSigCopyrightTag)) {
|
|
+ tmp = cmsTakeCopyright(hProfile);
|
|
+ if(tmp && strlen(tmp))
|
|
+ {
|
|
sprintf (text,_("Copyright: "));
|
|
- sprintf (profile_info,"%s%s %s\n",profile_info,text,
|
|
- cmsTakeCopyright(hProfile));
|
|
+ sprintf (&profile_info[strlen(profile_info)],"%s %s\n", text, tmp);
|
|
+ }
|
|
}
|
|
#endif
|
|
- sprintf (profile_info,"%s\n",profile_info);
|
|
+ sprintf (&profile_info[strlen(profile_info)],"\n");
|
|
|
|
cmsTakeMediaWhitePoint (&WhitePt, hProfile);
|
|
_cmsIdentifyWhitePoint (text, &WhitePt);
|
|
- sprintf (profile_info, "%s%s\n", profile_info, text);
|
|
+ sprintf (&profile_info[strlen(profile_info)], "%s\n", text);
|
|
|
|
sprintf (text,_("Device Class: "));
|
|
- sprintf (profile_info,"%s%s %s\n",profile_info,text,
|
|
+ sprintf (&profile_info[strlen(profile_info)],"%s %s\n", text,
|
|
cms_get_device_class_name(hProfile));
|
|
sprintf (text,_("Color Space: "));
|
|
- sprintf (profile_info,"%s%s %s\n",profile_info,text,
|
|
+ sprintf (&profile_info[strlen(profile_info)],"%s %s\n", text,
|
|
cms_get_color_space_name(hProfile));
|
|
sprintf (text,_("PCS Space: "));
|
|
- sprintf (profile_info,"%s%s %s",profile_info,text,
|
|
+ sprintf (&profile_info[strlen(profile_info)],"%s %s", text,
|
|
cms_get_pcs_name(hProfile));
|
|
|
|
free (text);
|
|
@@ -814,8 +921,9 @@ cms_read_icc_profile_dir(gchar *path, ic
|
|
* profile class, class==CMS_ANY_PROFILECLASS gives all profiles, does not recur over dirs
|
|
* returns a list of char * or NULL in case of error
|
|
*/
|
|
+//#define DEBUG 1
|
|
GSList *
|
|
-cms_read_standard_profile_dirs(icProfileClassSignature class)
|
|
+cms_read_standard_profile_dirs(icColorSpaceSignature space)
|
|
{ /* the temporary list to hold the names */
|
|
GSList* return_list = NULL;
|
|
|
|
@@ -831,19 +939,49 @@ cms_read_standard_profile_dirs(icProfile
|
|
#ifdef HAVE_OY
|
|
if(cms_oyranos)
|
|
{
|
|
+# if OYRANOS_VERSION > 107
|
|
+ oyPROFILE_e type = oyDEFAULT_PROFILE_START;
|
|
+ int size, i;
|
|
+ oyProfile_s * temp_prof = 0;
|
|
+ oyProfiles_s * iccs = 0;
|
|
+
|
|
+ iccs = oyProfiles_ForStd( type, 0, 0 );
|
|
+
|
|
+ size = oyProfiles_Count( iccs );
|
|
+ for( i = 0; i < size; ++i)
|
|
+ {
|
|
+ temp_prof = oyProfiles_Get( iccs, i );
|
|
+# ifdef DEBUG
|
|
+ printf("%d: \"%s\" %s\n", i,
|
|
+ oyProfile_GetText( temp_prof, oyNAME_DESCRIPTION ),
|
|
+ oyProfile_GetFileName(temp_prof, 0));
|
|
+# endif
|
|
+ return_list = g_slist_append(return_list,
|
|
+ (gpointer) strdup(oyProfile_GetFileName(temp_prof, 0)));
|
|
+ oyProfile_Release( &temp_prof );
|
|
+ }
|
|
+ oyProfiles_Release( &iccs );
|
|
+# else
|
|
int count = 0, i;
|
|
- char** names = /*(const char**)*/ oyProfileListGet( 0, &count );
|
|
+ char profile_space[] = {0,0,0,0,0,0,0,0};
|
|
+ char** names = /*(const char**)*/ 0;
|
|
+
|
|
+ icColorSpaceSignature space_host = ntohl(space);
|
|
|
|
-# ifdef DEBUG
|
|
+ memcpy( profile_space, &space_host, 4 );
|
|
+ names = oyProfileListGet( profile_space, &count);
|
|
+
|
|
+# ifdef DEBUG
|
|
printf("profiles: %d\n", count);
|
|
-# endif
|
|
+# endif
|
|
for(i = 0; i < count; ++i)
|
|
{
|
|
-# ifdef DEBUG_
|
|
- printf("profiles: %d %s %s\n", i, names[i], oyGetPathFromProfileName(names[i], my_alloc_func));
|
|
-# endif
|
|
+# ifdef DEBUG
|
|
+ printf("%s profiles: %d %s %s\n", profile_space, i, names[i], oyGetPathFromProfileName(names[i], my_alloc_func));
|
|
+# endif
|
|
return_list = g_slist_append(return_list, (gpointer) names[i]);
|
|
}
|
|
+# endif
|
|
|
|
return return_list;
|
|
}
|
|
@@ -865,7 +1003,7 @@ cms_read_standard_profile_dirs(icProfile
|
|
{ path = strdup(token);
|
|
}
|
|
|
|
- sub_list = cms_read_icc_profile_dir(path, class);
|
|
+ sub_list = cms_read_icc_profile_dir(path, space);
|
|
return_list = g_slist_concat(return_list, sub_list);
|
|
|
|
g_free(path);
|
|
@@ -877,6 +1015,7 @@ cms_read_standard_profile_dirs(icProfile
|
|
|
|
return return_list;
|
|
}
|
|
+#undef DEBUG
|
|
|
|
/*
|
|
* gets meta information about the profile
|
|
@@ -888,31 +1027,48 @@ CMSProfileInfo *
|
|
cms_get_profile_info(CMSProfile *profile)
|
|
{
|
|
const char *dummy[] = {"","","",""};
|
|
+#if defined(HAVE_OY) && OYRANOS_VERSION > 107
|
|
+ char ** texts = 0;
|
|
+ int32_t texts_n = 0;
|
|
+ oyProfileTag_s * tag = 0;
|
|
+ oyProfile_s * p = oyProfile_FromMem( profile->size, profile->data, 0, 0 );
|
|
+#endif
|
|
|
|
+ profile_info_buffer->manufacturer = dummy[0];
|
|
+ profile_info_buffer->description = dummy[0];
|
|
+ profile_info_buffer->pcs = dummy[0];
|
|
+ profile_info_buffer->color_space_name = dummy[0];
|
|
+ profile_info_buffer->color_space_channel_names = &dummy[0];
|
|
+ profile_info_buffer->device_class_name = dummy[0];
|
|
+ profile_info_buffer->long_info = dummy[0];
|
|
+
|
|
+#if defined(HAVE_OY) && OYRANOS_VERSION > 107
|
|
+ tag = oyProfile_GetTagById( p, icSigDeviceMfgDescTag );
|
|
+ texts = oyProfileTag_GetText( tag, &texts_n, "", 0,0,0);
|
|
+ if(texts_n && texts && texts[0])
|
|
+ profile_info_buffer->manufacturer = texts[0];
|
|
+ if(texts) free(texts);
|
|
+ oyProfileTag_Release( &tag );
|
|
+
|
|
+ profile_info_buffer->description = strdup( oyProfile_GetText( p,
|
|
+ oyNAME_DESCRIPTION ));
|
|
+ oyProfile_Release( &p );
|
|
+#else
|
|
if(profile)
|
|
profile_info_buffer->manufacturer= cmsTakeManufacturer(profile->handle);
|
|
- if(!profile_info_buffer->manufacturer)
|
|
- profile_info_buffer->manufacturer = dummy[0];
|
|
|
|
if(profile)
|
|
profile_info_buffer->description = cmsTakeProductDesc(profile->handle);
|
|
- if(!profile_info_buffer->description)
|
|
- profile_info_buffer->description = dummy[0];
|
|
+#endif
|
|
|
|
if(profile)
|
|
profile_info_buffer->pcs = cms_get_pcs_name(profile->handle);
|
|
- if(!profile_info_buffer->pcs)
|
|
- profile_info_buffer->pcs = dummy[0];
|
|
|
|
if(profile)
|
|
profile_info_buffer->color_space_name = cms_get_color_space_name(profile->handle);
|
|
- if(!profile_info_buffer->color_space_name)
|
|
- profile_info_buffer->color_space_name = dummy[0];
|
|
|
|
if(profile)
|
|
profile_info_buffer->color_space_channel_names = cms_get_color_space_channel_names(profile->handle);
|
|
- if(!profile_info_buffer->color_space_channel_names)
|
|
- profile_info_buffer->color_space_channel_names = &dummy[0];
|
|
# ifdef DEBUG
|
|
/*printf("%s:%d ",__FILE__,__LINE__);
|
|
printf("%s\n",profile_info_buffer->color_space_channel_names[2]);*/
|
|
@@ -920,14 +1076,9 @@ cms_get_profile_info(CMSProfile *profile
|
|
|
|
if(profile)
|
|
profile_info_buffer->device_class_name = cms_get_device_class_name(profile->handle);
|
|
- if(!profile_info_buffer->device_class_name)
|
|
- profile_info_buffer->device_class_name = dummy[0];
|
|
|
|
if(profile)
|
|
profile_info_buffer->long_info = cms_get_long_profile_info(profile->handle);
|
|
- if(!profile_info_buffer->long_info)
|
|
- profile_info_buffer->long_info = dummy[0];
|
|
-
|
|
|
|
return profile_info_buffer;
|
|
}
|
|
@@ -950,8 +1101,10 @@ cms_get_lcms_format(Tag tag, CMSProfile
|
|
|
|
if (color_channels > num_channels)
|
|
{
|
|
- printf (_("Drawable cannot handle all colours."));
|
|
- //return 0;
|
|
+ printf ("%s:%d %s(): Drawable cannot handle all colours.\n",__FILE__,__LINE__,__func__);
|
|
+#ifndef DEBUG_
|
|
+ return 0;
|
|
+#endif
|
|
}
|
|
|
|
/* workaround for Lab float images and lcms <= 1.15
|
|
@@ -1036,6 +1189,14 @@ cms_load_profile_to_mem (char* filename,
|
|
}
|
|
|
|
/*
|
|
+ * obtain a four char string of the ICC colour space, e.g. "Lab"
|
|
+ */
|
|
+const char * cms_get_profile_cspace ( CMSProfile * profile )
|
|
+{
|
|
+ return profile->cspace;
|
|
+}
|
|
+
|
|
+/*
|
|
* get a handle to the profile in file filename
|
|
* either from the cache or from the file
|
|
* returns NULL on error
|
|
@@ -1050,6 +1211,9 @@ cms_get_profile_from_file(char *file_nam
|
|
char *fullFileName = file_name;
|
|
cmsHPROFILE profile = NULL;
|
|
|
|
+ if( !file_name || strcmp(file_name,_("[none]")) == 0 )
|
|
+ return NULL;
|
|
+
|
|
/* get profile information */
|
|
cmsErrorAction(LCMS_ERROR_IGNORE);
|
|
profile = cmsOpenProfileFromFile (file_name, "r");
|
|
@@ -1118,6 +1282,8 @@ cms_get_profile_from_file(char *file_nam
|
|
return_value = g_new(CMSProfile, 1);
|
|
return_value->cache_key = strdup(cms_get_profile_keyname(profile,mem));
|
|
return_value->handle = profile;
|
|
+ sprintf( return_value->cspace,
|
|
+ cms_get_color_space_name( return_value->handle ) );
|
|
|
|
/* save an copy of the original icc profile to mem */
|
|
return_value->size = 0;
|
|
@@ -1153,6 +1319,7 @@ cms_get_profile_from_mem(void *mem_point
|
|
return NULL;
|
|
}
|
|
|
|
+
|
|
/* check hash table for profile */
|
|
cache_entry = g_hash_table_lookup(profile_cache,
|
|
(gpointer) cms_get_profile_keyname(profile,mem_pointer));
|
|
@@ -1169,6 +1336,8 @@ cms_get_profile_from_mem(void *mem_point
|
|
return_value = g_new(CMSProfile, 1);
|
|
return_value->cache_key = strdup(cms_get_profile_keyname(profile,mem_pointer));
|
|
return_value->handle = profile;
|
|
+ sprintf( return_value->cspace,
|
|
+ cms_get_color_space_name( return_value->handle ) );
|
|
|
|
cache_entry = g_new(ProfileCacheEntry, 1);
|
|
cache_entry->ref_count = 1;
|
|
@@ -1383,7 +1552,7 @@ cms_return_profile(CMSProfile *profile)
|
|
* decreate ref_counter + possibly close profile
|
|
*/
|
|
if (profile == NULL)
|
|
- { g_warning("cms_return_profile: profile is NULL");
|
|
+ { /*g_warning("cms_return_profile: profile is NULL");*/
|
|
return FALSE;
|
|
}
|
|
|
|
@@ -1411,7 +1580,7 @@ CMSTransform *
|
|
cms_create_transform(cmsHPROFILE *profile_array, int num_profiles,
|
|
DWORD lcms_input_format, DWORD lcms_output_format,
|
|
int lcms_intent, DWORD lcms_flags, int proof_intent,
|
|
- Tag tag,
|
|
+ Tag src_tag, Tag dest_tag,
|
|
CMSTransform **expensive_transform,
|
|
int * set_expensive_transform_b)
|
|
{
|
|
@@ -1465,7 +1634,7 @@ cms_create_transform(cmsHPROFILE *profil
|
|
*set_expensive_transform_b = TRUE;
|
|
}
|
|
if (!transform)
|
|
- { g_warning ("%s:%d ICC profile not valid.",__FILE__,__LINE__);
|
|
+ { g_warning ("%s:%d ICC profile not valid?",__FILE__,__LINE__);
|
|
return NULL;
|
|
}
|
|
} else
|
|
@@ -1495,7 +1664,7 @@ CMSTransform *
|
|
cms_get_transform(GSList *profiles,
|
|
DWORD lcms_input_format, DWORD lcms_output_format,
|
|
int lcms_intent, DWORD lcms_flags, int proof_intent,
|
|
- Tag tag,
|
|
+ Tag src_tag, Tag dest_tag,
|
|
CMSTransform **expensive_transform)
|
|
{ /* turn profiles into an array as needed by lcms +
|
|
check all profiles are registered with the profile cache +
|
|
@@ -1557,10 +1726,10 @@ cms_get_transform(GSList *profiles,
|
|
iterator = g_slist_next(iterator);
|
|
}
|
|
|
|
- g_string_sprintfa(hash_key,"%d%d%d%d%d%d%d",
|
|
+ g_string_sprintfa(hash_key,"%d%d%d%d%d%d%d%d",
|
|
(int)lcms_input_format, (int)lcms_output_format,
|
|
lcms_intent, (int)lcms_flags, proof_intent, num_profiles,
|
|
- tag);
|
|
+ src_tag, dest_tag);
|
|
|
|
/* now check the cache */
|
|
cache_entry = g_hash_table_lookup(transform_cache, (gpointer) hash_key->str);
|
|
@@ -1607,7 +1776,7 @@ cms_get_transform(GSList *profiles,
|
|
transform = cms_create_transform( profile_array, num_profiles,
|
|
lcms_input_format, lcms_output_format,
|
|
lcms_intent, lcms_flags, proof_intent,
|
|
- tag, expensive_transform,
|
|
+ src_tag, dest_tag, expensive_transform,
|
|
&set_expensive_transform_b );
|
|
|
|
{
|
|
@@ -1618,7 +1787,8 @@ cms_get_transform(GSList *profiles,
|
|
cache_entry = g_new(TransformCacheEntry, 1);
|
|
cache_entry->ref_count = 1;
|
|
cache_entry->transform = g_new(CMSTransform, 1);
|
|
- cache_entry->transform->tag = tag;
|
|
+ cache_entry->transform->src_tag = src_tag;
|
|
+ cache_entry->transform->dest_tag = dest_tag;
|
|
cache_entry->transform->cache_key = hash_key->str;
|
|
cache_entry->transform->handle = transform;
|
|
cache_entry->device_link_file = NULL;
|
|
@@ -1668,7 +1838,7 @@ cms_get_transform(GSList *profiles,
|
|
transform = cms_create_transform( profile_array, num_profiles,
|
|
lcms_input_format, lcms_output_format,
|
|
lcms_intent, lcms_flags, proof_intent,
|
|
- tag, expensive_transform,
|
|
+ src_tag, dest_tag, expensive_transform,
|
|
&set_expensive_transform_b );
|
|
cache_entry->transform->handle = transform;
|
|
|
|
@@ -1705,7 +1875,7 @@ CMSTransform *
|
|
cms_get_canvas_transform(GSList *profiles, Tag src_tag, Tag dest_tag,
|
|
int lcms_intent, DWORD lcms_flags, int proof_intent,
|
|
CMSTransform **expensive_transform)
|
|
-{ Tag t = src_tag;
|
|
+{
|
|
DWORD lcms_format_in, lcms_format_out;
|
|
CMSTransform *transform = NULL;
|
|
|
|
@@ -1729,7 +1899,7 @@ cms_get_canvas_transform(GSList *profile
|
|
|
|
transform = cms_get_transform(profiles, lcms_format_in, lcms_format_out,
|
|
lcms_intent, lcms_flags, proof_intent,
|
|
- t, expensive_transform);
|
|
+ src_tag, dest_tag, expensive_transform);
|
|
|
|
return transform;
|
|
}
|
|
@@ -1826,12 +1996,12 @@ cms_transform_buffer (CMSTransform *tran
|
|
transform_func = cms_transform_float;
|
|
break;
|
|
default:
|
|
- g_warning ("cms_transform: precision not supported");
|
|
+ g_warning ("%s:%d %s(): precision not supported", __FILE__,__LINE__,__func__);
|
|
return;
|
|
}
|
|
|
|
if(src_data == dest_data &&
|
|
- tag_format(transform->tag) == FORMAT_GRAY)
|
|
+ tag_format(transform->dest_tag) == FORMAT_GRAY)
|
|
{
|
|
len = bytes * 4 * num_pixels;
|
|
dest_data_ = malloc( len );
|
|
@@ -1865,7 +2035,9 @@ cms_transform_area(CMSTransform *transfo
|
|
void *pag;
|
|
|
|
if (tag_precision(src_tag) != tag_precision(dest_tag))
|
|
- { g_warning("cms_transform: src and dest area have to have same precision");
|
|
+ {
|
|
+ int i; i = 0;
|
|
+ /*g_warning("cms_transform: src and dest area have to have same precision");*/
|
|
}
|
|
|
|
if (!transform || !transform->handle)
|
|
@@ -1885,12 +2057,12 @@ cms_transform_area(CMSTransform *transfo
|
|
transform_func = cms_transform_float;
|
|
break;
|
|
default:
|
|
- g_warning ("cms_transform: precision not supported");
|
|
+ g_warning ("%s:%d %s(): precision not supported", __FILE__,__LINE__,__func__);
|
|
return;
|
|
}
|
|
|
|
|
|
- for (pag = pixelarea_register (1, src_area, dest_area);
|
|
+ for (pag = pixelarea_register (2, src_area, dest_area);
|
|
pag != NULL;
|
|
pag = pixelarea_process (pag))
|
|
{ h = pixelarea_height(src_area);
|
|
@@ -1902,24 +2074,135 @@ cms_transform_area(CMSTransform *transfo
|
|
src_data = pixelrow_data(&src_row_buffer);
|
|
dest_data = pixelrow_data(&dest_row_buffer);
|
|
if (!dest_data || !src_data)
|
|
- g_warning ("%s:%d %s() buffer failed at hight %d\n",
|
|
- __FILE__,__LINE__,__func__, h);
|
|
+ g_warning ("%s:%d %s() buffer failed\n",
|
|
+ __FILE__,__LINE__,__func__);
|
|
(*transform_func) (transform, src_data, dest_data, num_pixels);
|
|
}
|
|
}
|
|
}
|
|
|
|
+#if 0
|
|
+void
|
|
+cms_transform_uint_extra(CMSTransform *transform, void *src_data, void *dest_data, int num_pixels)
|
|
+{
|
|
+ int cchan_in = T_CHANNELS( transform->lcms_input_format );
|
|
+ int cchan_out = T_CHANNELS( transform->lcms_output_format );
|
|
+ int chan_in = tag_num_channels( transform->src_tag );
|
|
+ int chan_out = tag_num_channels( transform->dest_tag );
|
|
+ int extra_in = chan_in - cchan_in;
|
|
+ int extra_out = chan_out - cchan_out;
|
|
+ Precision prec_in = tag_precision( transform->src_tag );
|
|
+ Precision prec_out = tag_precision( transform->dest_tag );
|
|
+ int dest_alpha = tag_alpha( transform->dest_tag ) == ALPHA_YES ? 1:0;
|
|
+ int i, j;
|
|
+ ShortsFloat u;
|
|
+
|
|
+ if(chan_out > cchan_out)
|
|
+ for(i = 0 ; i < num_pixels; ++i)
|
|
+ {
|
|
+ int pos_in = i * chan_in + cchan_in;
|
|
+ int pos_out = i * chan_out + cchan_out;
|
|
+
|
|
+ switch (prec_out)
|
|
+ {
|
|
+ case PRECISION_U8:
|
|
+ {
|
|
+ guint8 *dest = (guint8 *)dest_data;
|
|
+ float dest_white = 255;
|
|
+
|
|
+ for(j = 0; j < extra_in && j < extra_out; ++j)
|
|
+ switch( prec_in )
|
|
+ {
|
|
+ case PRECISION_U8:
|
|
+ {
|
|
+ guint8 *src = (guint8 *)src_data;
|
|
+ dest[pos_out + j] = src[pos_in + j];
|
|
+ }
|
|
+ break;
|
|
+ case PRECISION_U16:
|
|
+ {
|
|
+ guint16 * src = (guint16*)src_data;
|
|
+ dest[pos_out + j] = src[pos_in + j]/256;
|
|
+ }
|
|
+ break;
|
|
+ case PRECISION_FLOAT16:
|
|
+ {
|
|
+ guint16 * src = (guint16*)src_data;
|
|
+ dest[pos_out + j] = FLT(src[pos_in + j], u) * dest_white;
|
|
+ }
|
|
+ break;
|
|
+ case PRECISION_FLOAT:
|
|
+ {
|
|
+ float * src = (float*)src_data;
|
|
+ dest[pos_out + j] = src[pos_in + j] * dest_white;
|
|
+ }
|
|
+ break;
|
|
+ }
|
|
+ for(j = extra_in; j < extra_out; ++j)
|
|
+ dest[pos_out + j] = dest_white;
|
|
+ }
|
|
+ break;
|
|
+ case PRECISION_U16:
|
|
+ {
|
|
+ guint16 *dest = (guint16 *)dest_data;
|
|
+ float dest_white = 65535;
|
|
+
|
|
+ for(j = 0; j < extra_in && j < extra_out; ++j)
|
|
+ switch( prec_in )
|
|
+ {
|
|
+ case PRECISION_U8:
|
|
+ {
|
|
+ guint8 *src = (guint8 *)src_data;
|
|
+ dest[pos_out + j] = src[pos_in + j]*257;
|
|
+ }
|
|
+ break;
|
|
+ case PRECISION_U16:
|
|
+ {
|
|
+ guint16 * src = (guint16*)src_data;
|
|
+ dest[pos_out + j] = src[pos_in + j];
|
|
+ }
|
|
+ break;
|
|
+ case PRECISION_FLOAT16:
|
|
+ {
|
|
+ guint16 * src = (guint16*)src_data;
|
|
+ dest[pos_out + j] = FLT(src[pos_in + j], u) * dest_white;
|
|
+ }
|
|
+ break;
|
|
+ case PRECISION_FLOAT:
|
|
+ {
|
|
+ float * src = (float*)src_data;
|
|
+ dest[pos_out + j] = src[pos_in + j] * dest_white;
|
|
+ }
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ for(j = chan_in; j < chan_out; ++j)
|
|
+ if(dest_alpha && j+1 == chan_out)
|
|
+ dest[i*chan_out + j] = dest_white;
|
|
+ else
|
|
+ dest[i*chan_out + j] = dest[i*chan_out + j-1];
|
|
+ }
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+}
|
|
+#endif
|
|
|
|
void
|
|
cms_transform_uint(CMSTransform *transform, void *src_data, void *dest_data, int num_pixels)
|
|
{
|
|
int cchan_in = T_CHANNELS( transform->lcms_input_format );
|
|
int cchan_out = T_CHANNELS( transform->lcms_output_format );
|
|
- int chan = tag_num_channels( transform->tag );
|
|
- int extra_in = chan - cchan_in;
|
|
- int extra_out = chan - cchan_out;
|
|
- int alpha = tag_alpha( transform->tag ) == ALPHA_YES ? 1:0;
|
|
+ int alpha = tag_alpha( transform->dest_tag ) == ALPHA_YES ? 1:0;
|
|
+ int chan_in = tag_num_channels( transform->src_tag );
|
|
+ int chan_out = tag_num_channels( transform->dest_tag );
|
|
+ int extra_in = chan_in - cchan_in;
|
|
+ int extra_out = chan_out - cchan_out;
|
|
+ Precision prec_in = tag_precision( transform->src_tag );
|
|
+ Precision prec_out = tag_precision( transform->dest_tag );
|
|
+ int dest_alpha = tag_alpha( transform->dest_tag ) == ALPHA_YES ? 1:0;
|
|
int i, j;
|
|
+ ShortsFloat u;
|
|
|
|
/* easy, no previous conversion, lcms does it all */
|
|
if (!transform || !transform->handle)
|
|
@@ -1932,32 +2215,36 @@ cms_transform_uint(CMSTransform *transfo
|
|
/* easy, no previous conversion, lcms does it all */
|
|
cmsDoTransform(transform->handle,src_data,dest_data,num_pixels);
|
|
|
|
+# if 0
|
|
+ cms_transform_uint_extra( transform, src_data, dest_data, num_pixels );
|
|
+# else
|
|
for(i = 0 ; i < num_pixels; ++i)
|
|
{
|
|
- switch (tag_precision( transform->tag ))
|
|
+ switch (tag_precision( transform->dest_tag ))
|
|
{
|
|
case PRECISION_U8:
|
|
{
|
|
guint8 *dest = (guint8 *)dest_data;
|
|
for(j = cchan_out; j < cchan_in; ++j)
|
|
- if(alpha && j+1 == chan)
|
|
- dest[i*chan + j] = 255;
|
|
+ if(alpha && j+1 == chan_out)
|
|
+ dest[i*chan_out + j] = 255;
|
|
else
|
|
- dest[i*chan + j] = dest[i*chan + j-1];
|
|
+ dest[i*chan_out + j] = dest[i*chan_out + j-1];
|
|
}
|
|
break;
|
|
case PRECISION_U16:
|
|
{
|
|
guint16 *dest = (guint16 *)dest_data;
|
|
for(j = cchan_out; j < cchan_in; ++j)
|
|
- if(alpha && j+1 == chan)
|
|
- dest[i*chan + j] = 65535;
|
|
+ if(alpha && j+1 == chan_out)
|
|
+ dest[i*chan_out + j] = 65535;
|
|
else
|
|
- dest[i*chan + j] = dest[i*chan + j-1];
|
|
+ dest[i*chan_out + j] = dest[i*chan_out + j-1];
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
+# endif
|
|
}
|
|
|
|
void
|
|
@@ -1965,17 +2252,26 @@ cms_transform_float(CMSTransform *transf
|
|
{ /* need to convert data to double for lcms's convenience */
|
|
int cchan_in = T_CHANNELS( transform->lcms_input_format );
|
|
int cchan_out = T_CHANNELS( transform->lcms_output_format );
|
|
- int chan = tag_num_channels( transform->tag );
|
|
- int extra_in = chan - cchan_in;
|
|
- int extra_out = chan - cchan_out;
|
|
- int alpha = tag_alpha( transform->tag ) == ALPHA_YES ? 1:0;
|
|
+ int chan_in = tag_num_channels( transform->src_tag );
|
|
+ int chan_out = tag_num_channels( transform->dest_tag );
|
|
+ int chan = chan_out;
|
|
+ int alpha = tag_alpha( transform->dest_tag ) == ALPHA_YES ? 1:0;
|
|
+ /*int extra_in = chan_in - cchan_in;
|
|
+ int extra_out = chan_out - cchan_out; */
|
|
+ int src_alpha = tag_alpha( transform->src_tag ) == ALPHA_YES ? 1:0;
|
|
+ int dest_alpha = tag_alpha( transform->dest_tag ) == ALPHA_YES ? 1:0;
|
|
int i, j, pix;
|
|
float *src_fbuffer = (float *)src_data;
|
|
float *dest_fbuffer = (float *)dest_data;
|
|
guint16 *src_hbuffer = (guint16 *)src_data;
|
|
guint16 *dest_hbuffer = (guint16 *)dest_data;
|
|
- double *dbuffer = 0;
|
|
+ double *src_dbuffer = NULL,
|
|
+ *dest_dbuffer = NULL;
|
|
+ void * src_buffer = NULL,
|
|
+ * dest_buffer = NULL;
|
|
+ double* dbuffer = NULL;
|
|
ShortsFloat u;
|
|
+ Precision dest_p = tag_precision( transform->dest_tag );
|
|
|
|
if (!transform || !transform->handle)
|
|
g_warning ("%s:%d %s() transform not allocated\n",
|
|
@@ -1984,13 +2280,117 @@ cms_transform_float(CMSTransform *transf
|
|
g_warning ("%s:%d %s() array not allocated\n",
|
|
__FILE__,__LINE__,__func__);
|
|
|
|
+# if 1
|
|
+ src_dbuffer = malloc(sizeof(double) * num_pixels * 4);
|
|
+ if( dest_p == PRECISION_FLOAT16 ||
|
|
+ dest_p == PRECISION_FLOAT)
|
|
+ {
|
|
+ dest_dbuffer = malloc(sizeof(double) * num_pixels * 4);
|
|
+ dest_buffer = dest_dbuffer;
|
|
+ } else
|
|
+ dest_buffer = dest_data;
|
|
+ src_buffer = src_dbuffer;
|
|
+# else
|
|
dbuffer = malloc(sizeof(double) * num_pixels * 4);
|
|
+# endif
|
|
|
|
# ifdef DEBUG_
|
|
printf ("%s:%d %s() colourspace%d extra:%d channels:%d lcms_bytes%d \n", __FILE__,__LINE__,__func__, T_COLORSPACE(transform->lcms_input_format), T_EXTRA(transform->lcms_input_format), T_CHANNELS(transform->lcms_input_format), T_BYTES(transform->lcms_input_format) );
|
|
# endif
|
|
|
|
- switch (tag_precision( transform->tag ))
|
|
+#if 1
|
|
+ switch (tag_precision( transform->src_tag ))
|
|
+ {
|
|
+ case PRECISION_FLOAT16:
|
|
+ for (i=0; i < num_pixels * chan_in; ++i)
|
|
+ {
|
|
+ if(T_COLORSPACE(transform->lcms_input_format) == PT_CMYK)
|
|
+ src_dbuffer[i] = (double) FLT( src_hbuffer[i], u ) * 100.;
|
|
+ else
|
|
+ src_dbuffer[i] = (double) FLT( src_hbuffer[i], u );
|
|
+ }
|
|
+ break;
|
|
+ case PRECISION_FLOAT:
|
|
+# if 0
|
|
+ // Lab floating point makes no sense
|
|
+ if (transform->colourspace_in == icSigLabData)
|
|
+ {
|
|
+ for (pix=0; pix < num_pixels; ++pix)
|
|
+ { i = pix * chan_in;
|
|
+ /* The 100. multiplicator comes from PT_ANY in cms_get_lcms_format().
|
|
+ */
|
|
+ src_dbuffer[i+0] = (double) src_fbuffer[i+0]*100.;
|
|
+ src_dbuffer[i+1] = (double) src_fbuffer[i+1]*100.;
|
|
+ src_dbuffer[i+2] = (double) src_fbuffer[i+2]*100.;
|
|
+ if(src_alpha)
|
|
+ src_dbuffer[i+3] = (double) src_fbuffer[i+3];
|
|
+ }
|
|
+ } else {
|
|
+# endif
|
|
+ for (i=0; i < num_pixels * chan_in; ++i)
|
|
+# if 0
|
|
+ if(transform->colourspace_in == icSigCmykData)
|
|
+ src_dbuffer[i]=(double)src_fbuffer[i] * 100.;
|
|
+ else
|
|
+# endif
|
|
+ src_dbuffer[i]=(double)src_fbuffer[i];
|
|
+/* } */
|
|
+ break;
|
|
+ default:
|
|
+ dest_buffer = dest_data;
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ cmsDoTransform( transform->handle, src_buffer, dest_buffer, num_pixels );
|
|
+
|
|
+ /* and convert back */
|
|
+ switch (tag_precision( transform->dest_tag ))
|
|
+ {
|
|
+ case PRECISION_FLOAT16:
|
|
+ for (i=0; i < num_pixels; ++i)
|
|
+ {
|
|
+ for(j = 0; j < cchan_out; ++j)
|
|
+ /* copy colour channels */
|
|
+ if(T_COLORSPACE(transform->lcms_output_format) == PT_CMYK)
|
|
+ dest_hbuffer[i*chan_out + j] = (double) FLT16( dest_dbuffer[i*chan_out + j] / 100., u );
|
|
+ else
|
|
+ dest_hbuffer[i*chan_out + j] = (double) FLT16( dest_dbuffer[i*chan_out + j], u );
|
|
+ for(j = chan_in; j < chan_out; ++j)
|
|
+ if(dest_alpha && j+1 == chan_out)
|
|
+ /* set CinePaints alpha channel to opace */
|
|
+ dest_hbuffer[i*chan_out + j] = ONE_FLOAT16;
|
|
+ else
|
|
+ /* refill with previous values */
|
|
+ dest_hbuffer[i*chan_out + j] = dest_hbuffer[i*chan_out + j-1];
|
|
+ /* ignore other untouched channels */
|
|
+ }
|
|
+ break;
|
|
+ case PRECISION_FLOAT:
|
|
+ for (i=0; i < num_pixels; ++i)
|
|
+ {
|
|
+ for(j = 0; j < cchan_out; ++j)
|
|
+# if 0
|
|
+ if(T_COLORSPACE(transform->lcms_output_format) == PT_CMYK)
|
|
+ dest_fbuffer[i*chan_out + j] = dest_dbuffer[i*chan_out + j]/100.0;
|
|
+ else
|
|
+# endif
|
|
+ dest_fbuffer[i*chan_out + j] = dest_dbuffer[i*chan_out + j];
|
|
+ for(j = chan_in; j < chan_out; ++j)
|
|
+ if(dest_alpha && j+1 == chan_out)
|
|
+ dest_fbuffer[i*chan_out + j] = 1.0;
|
|
+ else
|
|
+ dest_fbuffer[i*chan_out + j] = dest_fbuffer[i*chan_out + j-1];
|
|
+ }
|
|
+ break;
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ if(dest_dbuffer) g_free(dest_dbuffer);
|
|
+ if(src_dbuffer) g_free(src_dbuffer);
|
|
+# else
|
|
+
|
|
+ switch (tag_precision( transform->dest_tag ))
|
|
{
|
|
case PRECISION_FLOAT16:
|
|
for (i=0; i < num_pixels * chan; ++i)
|
|
@@ -2030,7 +2430,7 @@ cms_transform_float(CMSTransform *transf
|
|
cmsDoTransform(transform->handle,dbuffer,dbuffer,num_pixels);
|
|
|
|
/* and convert back */
|
|
- switch (tag_precision( transform->tag ))
|
|
+ switch (tag_precision( transform->dest_tag ))
|
|
{
|
|
case PRECISION_FLOAT16:
|
|
for (i=0; i < num_pixels; ++i)
|
|
@@ -2069,6 +2469,7 @@ cms_transform_float(CMSTransform *transf
|
|
}
|
|
|
|
g_free(dbuffer);
|
|
+# endif
|
|
}
|
|
|
|
|
|
@@ -2286,19 +2687,35 @@ static GtkWidget *cms_profile_menu_new(G
|
|
GtkWidget *menuitem;
|
|
GtkWidget *optionmenu;
|
|
|
|
- GSList *profile_file_names = cms_read_standard_profile_dirs(CMS_ANY_PROFILECLASS);
|
|
- GSList *iterator = profile_file_names;
|
|
+ GSList *profile_file_names = 0;
|
|
+ GSList *iterator = 0;
|
|
gchar *current_filename;
|
|
CMSProfile *current_profile;
|
|
CMSProfileInfo *current_profile_info;
|
|
int pos = can_select_none ? 1 : 0, select_pos = -1;
|
|
+ gchar * label_text = 0, * temp_label_text = 0;
|
|
+ label_text = temp_label_text = calloc(1024,sizeof(char));
|
|
|
|
menu = gtk_menu_new ();
|
|
|
|
+ profile_file_names = cms_read_standard_profile_dirs(icSigInputClass);
|
|
+ iterator = cms_read_standard_profile_dirs(icSigDisplayClass);
|
|
+ profile_file_names = g_slist_concat( profile_file_names, iterator );
|
|
+ iterator = cms_read_standard_profile_dirs(icSigOutputClass);
|
|
+ profile_file_names = g_slist_concat( profile_file_names, iterator );
|
|
+ iterator = cms_read_standard_profile_dirs(icSigLinkClass);
|
|
+ profile_file_names = g_slist_concat( profile_file_names, iterator );
|
|
+ iterator = cms_read_standard_profile_dirs(icSigAbstractClass);
|
|
+ profile_file_names = g_slist_concat( profile_file_names, iterator );
|
|
+ iterator = cms_read_standard_profile_dirs(icSigColorSpaceClass);
|
|
+ profile_file_names = g_slist_concat( profile_file_names, iterator );
|
|
+
|
|
+ iterator = profile_file_names;
|
|
+
|
|
if (can_select_none)
|
|
{ menuitem = gtk_menu_item_new_with_label(_("[none]"));
|
|
- gtk_menu_append (GTK_MENU (menu), menuitem);
|
|
- gtk_object_set_data(GTK_OBJECT(menuitem), "value", NULL);
|
|
+ gtk_menu_append (GTK_MENU (menu), menuitem);
|
|
+ gtk_object_set_data(GTK_OBJECT(menuitem), "value", NULL);
|
|
}
|
|
|
|
while (iterator != NULL)
|
|
@@ -2309,8 +2726,8 @@ static GtkWidget *cms_profile_menu_new(G
|
|
if(prefered_name && strlen(prefered_name) &&
|
|
strcmp( current_filename, prefered_name ) == 0 )
|
|
select_pos = pos;
|
|
-
|
|
- menuitem = gtk_menu_item_new_with_label (current_profile_info->description);
|
|
+ sprintf(label_text, "%s (%s)", current_profile_info->description, current_filename);
|
|
+ menuitem = gtk_menu_item_new_with_label (label_text);
|
|
gtk_menu_append (GTK_MENU (menu), menuitem);
|
|
gtk_object_set_data_full(GTK_OBJECT(menuitem), "value", (gpointer)current_filename, g_free);
|
|
|
|
@@ -2322,6 +2739,7 @@ static GtkWidget *cms_profile_menu_new(G
|
|
if (profile_file_names != NULL)
|
|
{ g_slist_free(profile_file_names);
|
|
}
|
|
+ if(temp_label_text) free(temp_label_text);
|
|
|
|
if(select_pos >= 0)
|
|
gtk_menu_set_active (GTK_MENU (menu), select_pos);
|
|
@@ -2381,27 +2799,27 @@ cms_ok_cancel_buttons_new(GtkBox *action
|
|
GtkSignalFunc cancel_callback,
|
|
gpointer data)
|
|
{ GtkWidget *buttonbox = NULL;
|
|
- GtkWidget *button = NULL;
|
|
+ GtkWidget *button = NULL;
|
|
|
|
buttonbox = gtk_hbutton_box_new();
|
|
gtk_button_box_set_spacing(GTK_BUTTON_BOX(buttonbox), 4);
|
|
gtk_box_set_homogeneous(action_area, FALSE);
|
|
- gtk_box_pack_end (action_area, buttonbox, FALSE, FALSE, 0);
|
|
+ gtk_box_pack_end (action_area, buttonbox, FALSE, FALSE, 0);
|
|
|
|
button = gtk_button_new_with_label(_("OK"));
|
|
- gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
|
+ gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
|
GTK_SIGNAL_FUNC(ok_callback), data);
|
|
- gtk_box_pack_start (GTK_BOX (buttonbox), button, FALSE, FALSE, 0);
|
|
+ gtk_box_pack_start (GTK_BOX (buttonbox), button, FALSE, FALSE, 0);
|
|
|
|
button = gtk_button_new_with_label(_("Cancel"));
|
|
- gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
|
+ gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
|
GTK_SIGNAL_FUNC(cancel_callback), data);
|
|
- gtk_box_pack_start (GTK_BOX (buttonbox), button, FALSE, FALSE, 0);
|
|
+ gtk_box_pack_start (GTK_BOX (buttonbox), button, FALSE, FALSE, 0);
|
|
}
|
|
|
|
/*
|
|
- * CONVERT DIALOG
|
|
- * menu: Image>Convert using ICC Profile...
|
|
+ * CONVERT DIALOG
|
|
+ * menu: Image>Convert using ICC Profile...
|
|
*/
|
|
|
|
/* private types */
|
|
diff -up cinepaint-0.22-1/app/cms.h.oy19 cinepaint-0.22-1/app/cms.h
|
|
--- cinepaint-0.22-1/app/cms.h.oy19 2007-04-20 13:23:52.000000000 +0200
|
|
+++ cinepaint-0.22-1/app/cms.h 2009-03-09 15:39:36.000000000 +0100
|
|
@@ -79,7 +79,7 @@ GSList *cms_read_icc_profile_dir(gchar *
|
|
* profile class, class==CMS_ANY_PROFILECLASS gives all profiles, does not recur over dirs
|
|
* returns a list of char * or NULL in case of error
|
|
*/
|
|
-GSList *cms_read_standard_profile_dirs(icProfileClassSignature class);
|
|
+GSList *cms_read_standard_profile_dirs(icColorSpaceSignature class);
|
|
|
|
/*
|
|
* get a handle to the profile in file filename
|
|
@@ -133,6 +133,8 @@ gboolean cms_return_profile(CMSProfile *
|
|
*/
|
|
CMSProfileInfo *cms_get_profile_info(CMSProfile *profile);
|
|
|
|
+const char * cms_get_profile_cspace ( CMSProfile * profile );
|
|
+
|
|
/* returns the lcms format corresponding to this tag and profile */
|
|
DWORD cms_get_lcms_format(Tag tag, CMSProfile *profile);
|
|
|
|
@@ -154,7 +156,7 @@ CMSTransform *cms_get_transform(GSList *
|
|
DWORD lcms_output_format,
|
|
int lcms_intent, DWORD lcms_flags,
|
|
int proof_intent,
|
|
- Tag input,
|
|
+ Tag input, Tag output,
|
|
CMSTransform **expensive_transform);
|
|
|
|
/*
|
|
diff -up cinepaint-0.22-1/app/color_correction.c.oy19 cinepaint-0.22-1/app/color_correction.c
|
|
--- cinepaint-0.22-1/app/color_correction.c.oy19 2009-03-09 16:05:50.000000000 +0100
|
|
+++ cinepaint-0.22-1/app/color_correction.c 2009-03-09 16:06:05.000000000 +0100
|
|
@@ -115,11 +115,11 @@ color_correction_init_lab_transforms (GI
|
|
profiles = g_slist_append(profiles, image_profile);
|
|
profiles = g_slist_append(profiles, lab_profile);
|
|
lcms_format = cms_get_lcms_format(t, image_profile);
|
|
- color_correction_to_lab_transform = cms_get_transform(profiles, lcms_format, TYPE_Lab_16, INTENT_PERCEPTUAL, 0, 0, t, NULL);
|
|
+ color_correction_to_lab_transform = cms_get_transform(profiles, lcms_format, TYPE_Lab_16, INTENT_PERCEPTUAL, 0, 0, t, t, NULL);
|
|
|
|
profiles = g_slist_remove(profiles, image_profile);
|
|
profiles = g_slist_append(profiles, image_profile);
|
|
- color_correction_from_lab_transform = cms_get_transform(profiles, TYPE_Lab_16, lcms_format, INTENT_PERCEPTUAL, 0, 0, t, NULL);
|
|
+ color_correction_from_lab_transform = cms_get_transform(profiles, TYPE_Lab_16, lcms_format, INTENT_PERCEPTUAL, 0, 0, t, t, NULL);
|
|
|
|
g_slist_free(profiles);
|
|
}
|
|
diff -up cinepaint-0.22-1/app/convert.c.oy19 cinepaint-0.22-1/app/convert.c
|
|
--- cinepaint-0.22-1/app/convert.c.oy19 2009-03-09 16:07:14.000000000 +0100
|
|
+++ cinepaint-0.22-1/app/convert.c 2009-03-09 16:11:04.000000000 +0100
|
|
@@ -351,7 +351,7 @@ convert_image_colorspace (void *gimage_p
|
|
|
|
transform = cms_get_transform(profiles, lcms_format_in, lcms_format_out,
|
|
lcms_intent, cms_flags,
|
|
- 0, tag, NULL);
|
|
+ 0, tag, tag, NULL);
|
|
g_slist_free(profiles);
|
|
if(!transform)
|
|
{ g_warning("%s:%d %s(): transform failed", __FILE__,__LINE__,__func__);
|
|
diff -up cinepaint-0.22-1/app/look_profile.c.oy19 cinepaint-0.22-1/app/look_profile.c
|
|
--- cinepaint-0.22-1/app/look_profile.c.oy19 2009-03-09 16:14:14.000000000 +0100
|
|
+++ cinepaint-0.22-1/app/look_profile.c 2009-03-09 16:14:23.000000000 +0100
|
|
@@ -297,7 +297,8 @@ look_profile_create(GImage *image, gint
|
|
transform = cms_get_transform( profiles, TYPE_Lab_16,
|
|
lcms_format_out,
|
|
INTENT_PERCEPTUAL,
|
|
- cms_default_flags, 0,tag, NULL);
|
|
+ cms_default_flags, 0,
|
|
+ tag, tag, NULL);
|
|
g_slist_free(profiles);
|
|
|
|
/* iterate over Lab space, converting to rgb, filling into picture */
|
|
@@ -481,7 +482,8 @@ look_profile_save (LookProfile *profile,
|
|
profiles = g_slist_append(profiles, lab_profile);
|
|
sample_info->transform = cms_get_transform(profiles,
|
|
cms_get_lcms_format(t, input_profile),
|
|
- TYPE_Lab_16, intent, flags, 0, t, NULL);
|
|
+ TYPE_Lab_16, intent, flags, 0,
|
|
+ t, t, NULL);
|
|
|
|
pixelarea_init(&sample_info->sample_area,
|
|
profile->canvas,
|
|
@@ -884,7 +886,7 @@ _look_profile_gui_apply(_LookProfileGui
|
|
gdisplay_get_cms_intent(data->display),
|
|
gdisplay_get_cms_flags(data->display),
|
|
gdisplay_get_cms_proof_intent(data->display),
|
|
- tag, NULL);
|
|
+ tag, tag, NULL);
|
|
g_slist_free(profiles);
|
|
gimage_transform_colors(data->display->gimage, transform, TRUE);
|
|
cms_return_transform(transform);
|
|
@@ -929,7 +931,7 @@ _look_profile_gui_apply_flipbook (_LookP
|
|
gdisplay_get_cms_intent(data->display),
|
|
gdisplay_get_cms_flags(data->display),
|
|
gdisplay_get_cms_proof_intent(data->display),
|
|
- tag, NULL);
|
|
+ tag, tag, NULL);
|
|
g_slist_free(profiles);
|
|
|
|
/* create progress dialog */
|
|
diff -up cinepaint-0.22-1/app/main.c.oy19 cinepaint-0.22-1/app/main.c
|
|
--- cinepaint-0.22-1/app/main.c.oy19 2009-03-09 16:19:06.000000000 +0100
|
|
+++ cinepaint-0.22-1/app/main.c 2009-03-09 16:20:54.000000000 +0100
|
|
@@ -32,6 +32,10 @@
|
|
#include <signal.h>
|
|
#include <string.h>
|
|
#include <sys/types.h>
|
|
+/* check for directories */
|
|
+#include <sys/stat.h>
|
|
+#include <unistd.h>
|
|
+
|
|
|
|
#ifdef WIN32
|
|
extern int _fmode;
|
|
@@ -146,6 +150,7 @@ int WINAPI WinMain(
|
|
{
|
|
|
|
#else
|
|
+
|
|
int main (int argc, char **argv)
|
|
{
|
|
#endif
|
|
@@ -195,11 +200,14 @@ int main (int argc, char **argv)
|
|
{
|
|
#ifdef HAVE_OY
|
|
/* set a profile temporary path */
|
|
+ /* this is obsolete with the XDG paths being supported since v0.1.8 */
|
|
+#if (OYRANOS_VERSION < 108)
|
|
if(strcmp(text, GetDirPrefix()) != 0)
|
|
{
|
|
int n = oyPathsCount(), i, has_path = 0;
|
|
+
|
|
oyranos_temp_path = myAlloc (strlen(GetDirPrefix()) +
|
|
- sizeof(OY_ICCDIRNAME) + 64);
|
|
+ sizeof(OY_ICCDIRNAME) + strlen(text) + 64);
|
|
sprintf(oyranos_temp_path, "%s%sshare%scolor%s%s",
|
|
text, DIR_SEPARATOR, DIR_SEPARATOR, DIR_SEPARATOR, OY_ICCDIRNAME);
|
|
for(i = 0; i < n; ++i)
|
|
@@ -210,13 +218,23 @@ int main (int argc, char **argv)
|
|
if(temp) free(temp);
|
|
}
|
|
if(!has_path)
|
|
- oyPathAdd( oyranos_temp_path );
|
|
- else {
|
|
+ {
|
|
+ struct stat status;
|
|
+ int r = 0;
|
|
+
|
|
+ status.st_mode = 0;
|
|
+ r = stat (oyranos_temp_path, &status);
|
|
+ r = !r &&
|
|
+ ((status.st_mode & S_IFMT) & S_IFDIR);
|
|
+ if(!r)
|
|
+ oyPathAdd( oyranos_temp_path );
|
|
+ } else {
|
|
free( oyranos_temp_path );
|
|
oyranos_temp_path = NULL;
|
|
}
|
|
}
|
|
#endif
|
|
+#endif
|
|
SetDirPrefix( text );
|
|
fclose(fp);
|
|
}
|
|
@@ -483,7 +501,9 @@ int main (int argc, char **argv)
|
|
/* remove a profile temporary path */
|
|
if(oyranos_temp_path)
|
|
{
|
|
+#if (OYRANOS_VERSION < 108)
|
|
oyPathRemove( oyranos_temp_path );
|
|
+#endif
|
|
free( oyranos_temp_path );
|
|
}
|
|
#endif
|
|
@@ -674,13 +694,14 @@ fl_initialise_locale( const char *domain
|
|
// 1. get the locale info
|
|
CFLocaleRef userLocaleRef = CFLocaleCopyCurrent();
|
|
CFStringRef cfstring = CFLocaleGetIdentifier( userLocaleRef );
|
|
-
|
|
+ CFIndex gr = 36;
|
|
+ char text[36];
|
|
+ Boolean fehler = 0;
|
|
+
|
|
CFShow( cfstring );
|
|
|
|
// copy to a C buffer
|
|
- CFIndex gr = 36;
|
|
- char text[36];
|
|
- Boolean fehler = CFStringGetCString( cfstring, text, gr, kCFStringEncodingISOLatin1 );
|
|
+ fehler = CFStringGetCString( cfstring, text, gr, kCFStringEncodingISOLatin1 );
|
|
|
|
if(fehler) {
|
|
d_printf( "osX locale obtained: %s", text );
|
|
diff -up cinepaint-0.22-1/configure.in.oy19 cinepaint-0.22-1/configure.in
|
|
--- cinepaint-0.22-1/configure.in.oy19 2009-03-09 15:39:36.000000000 +0100
|
|
+++ cinepaint-0.22-1/configure.in 2009-03-09 15:39:36.000000000 +0100
|
|
@@ -475,8 +475,8 @@ AC_ARG_ENABLE(print, [ --disable-print
|
|
dnl Test for Oyranos; beku
|
|
AC_PATH_PROG(OY_CONFIG, oyranos-config, no)
|
|
if test "x$OY_CONFIG" != "xno"; then
|
|
- OYRANOS_LIBS="-DHAVE_OY `$OY_CONFIG --ld_x_flags | sed s/-O.\//`"
|
|
- OYRANOS_CFLAGS="-DHAVE_OY `$OY_CONFIG --cflags | sed s/-O.\//`"
|
|
+ OYRANOS_LIBS=" `$OY_CONFIG --ldflags` "
|
|
+ OYRANOS_CFLAGS="-DHAVE_OY `$OY_CONFIG --cflags` "
|
|
OYRANOS="`$OY_CONFIG --version`"
|
|
else
|
|
AC_MSG_WARN([
|