diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2012-02-24 22:37:26 -0800 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2012-03-15 11:54:23 +0000 |
commit | 27227f25f3fc65dd6388981ae06e6b2f42d3ec03 (patch) | |
tree | 7d6d5741354ca6c9cc1597fe5f61ddefaa02b9bb | |
parent | ffd1dc7bccdf7b7f1332c1dca64cdbec91593d55 (diff) |
Movement of code for setting ICC system/user params into graphics lib.
The code that set the system/user params related to ICC profiles was
contained in the zusparam.c file. This file is not used with the
other languages (e.g. xps and pcl). The functions that do the actual
work have been moved to gsicc_manage reducing any code duplication for
the other languages.
-rw-r--r-- | gs/base/gsicc_manage.c | 311 | ||||
-rw-r--r-- | gs/base/gsicc_manage.h | 19 | ||||
-rw-r--r-- | gs/psi/zusparam.c | 249 |
3 files changed, 348 insertions, 231 deletions
diff --git a/gs/base/gsicc_manage.c b/gs/base/gsicc_manage.c index ce8e8f6e6..c473b3989 100644 --- a/gs/base/gsicc_manage.c +++ b/gs/base/gsicc_manage.c @@ -1956,3 +1956,314 @@ dump_icc_buffer(int buffersize, char filename[],byte *Buffer) fclose(fid); } #endif + +/* The following are for setting the system/user params */ +/* No default for the deviceN profile. */ +void +gs_currentdevicenicc(const gs_imager_state * pis, gs_param_string * pval) +{ + static const char *const rfs = ""; + + /*FIXME: This should return the entire list !!! */ + /* Just return the first one for now */ + pval->data = (const byte *)( (pis->icc_manager->device_n == NULL) ? + rfs : pis->icc_manager->device_n->head->iccprofile->name); + pval->size = strlen((const char *)pval->data); + pval->persistent = true; +} + +int +gs_setdevicenprofileicc(const gs_imager_state * pis, gs_param_string * pval) +{ + int code = 0; + char *pname, *pstr, *pstrend; + int namelen = (pval->size)+1; + gs_memory_t *mem = pis->memory; + + /* Check if it was "NULL" */ + if (pval->size != 0) { + /* The DeviceN name can have multiple files + in it. This way we can define all the + DeviceN color spaces with ICC profiles. + divide using , and ; delimeters as well as + remove leading and ending spaces (file names + can have internal spaces). */ + pname = (char *)gs_alloc_bytes(mem, namelen, + "set_devicen_profile_icc"); + memcpy(pname,pval->data,namelen-1); + pname[namelen-1] = 0; + pstr = strtok(pname, ",;"); + while (pstr != NULL) { + namelen = strlen(pstr); + /* Remove leading and trailing spaces from the name */ + while ( namelen > 0 && pstr[0] == 0x20) { + pstr++; + namelen--; + } + namelen = strlen(pstr); + pstrend = &(pstr[namelen-1]); + while ( namelen > 0 && pstrend[0] == 0x20) { + pstrend--; + namelen--; + } + code = gsicc_set_profile(pis->icc_manager, (const char*) pstr, namelen, DEVICEN_TYPE); + if (code < 0) + return gs_rethrow(code, "cannot find devicen icc profile"); + pstr = strtok(NULL, ",;"); + } + gs_free_object(mem, pname, + "set_devicen_profile_icc"); + return code; + } + return 0; +} + +void +gs_currentdefaultgrayicc(const gs_imager_state * pis, gs_param_string * pval) +{ + static const char *const rfs = DEFAULT_GRAY_ICC; + + pval->data = (const byte *)( (pis->icc_manager->default_gray == NULL) ? + rfs : pis->icc_manager->default_gray->name); + pval->size = strlen((const char *)pval->data); + pval->persistent = true; +} + +int +gs_setdefaultgrayicc(const gs_imager_state * pis, gs_param_string * pval) +{ + int code; + char *pname; + int namelen = (pval->size)+1; + gs_memory_t *mem = pis->memory; + bool not_initialized; + + /* Detect if this is our first time in here. If so, then we need to + reset up the default gray color spaces that are in the graphic state + to be ICC based. It was not possible to do it until after we get + the profile */ + not_initialized = (pis->icc_manager->default_gray == NULL); + + pname = (char *)gs_alloc_bytes(mem, namelen, + "set_default_gray_icc"); + memcpy(pname,pval->data,namelen-1); + pname[namelen-1] = 0; + code = gsicc_set_profile(pis->icc_manager, + (const char*) pname, namelen, DEFAULT_GRAY); + gs_free_object(mem, pname, + "set_default_gray_icc"); + if (code < 0) + return gs_rethrow(code, "cannot find default gray icc profile"); + /* if this is our first time in here then we need to properly install the + color spaces that were initialized in the graphic state at this time */ + if (not_initialized) { + code = gsicc_init_gs_colors((gs_state*) pis); + } + if (code < 0) + return gs_rethrow(code, "error initializing gstate color spaces to icc"); + return code; +} + +void +gs_currenticcdirectory(const gs_imager_state * pis, gs_param_string * pval) +{ + static const char *const rfs = DEFAULT_DIR_ICC; /* as good as any other */ + const gs_lib_ctx_t *lib_ctx = pis->memory->gs_lib_ctx; + + if (lib_ctx->profiledir == NULL) { + pval->data = (const byte *)rfs; + pval->size = strlen(rfs); + } else { + pval->data = (const byte *)(lib_ctx->profiledir); + pval->size = lib_ctx->profiledir_len; + } + pval->persistent = true; +} + +int +gs_seticcdirectory(const gs_imager_state * pis, gs_param_string * pval) +{ + char *pname; + int namelen = (pval->size)+1; + const gs_memory_t *mem = pis->memory; + + /* Check if it was "NULL" */ + if (pval->size != 0 ) { + pname = (char *)gs_alloc_bytes((gs_memory_t *)mem, namelen, + "set_icc_directory"); + if (pname == NULL) + return gs_rethrow(-1, "cannot allocate directory name"); + memcpy(pname,pval->data,namelen-1); + pname[namelen-1] = 0; + gs_lib_ctx_set_icc_directory(mem, (const char*) pname, namelen); + gs_free_object((gs_memory_t *)mem, pname, "set_icc_directory"); + } + return 0; +} + +void +gs_currentsrcgtagicc(const gs_imager_state * pis, gs_param_string * pval) +{ + if (pis->icc_manager->srcgtag_profile == NULL) { + pval->data = NULL; + pval->size = 0; + pval->persistent = true; + } else { + pval->data = (byte *)pis->icc_manager->srcgtag_profile->name; + pval->size = strlen((const char *)pval->data); + pval->persistent = true; + } +} + +int +gs_setsrcgtagicc(const gs_imager_state * pis, gs_param_string * pval) +{ + int code; + char *pname; + int namelen = (pval->size)+1; + gs_memory_t *mem = pis->memory; + + if (pval->size == 0) return 0; + pname = (char *)gs_alloc_bytes(mem, namelen, "set_srcgtag_icc"); + memcpy(pname,pval->data,namelen-1); + pname[namelen-1] = 0; + code = gsicc_set_srcgtag_struct(pis->icc_manager, (const char*) pname, + namelen); + gs_free_object(mem, pname, "set_srcgtag_icc"); + if (code < 0) + return gs_rethrow(code, "cannot find srctag file"); + return code; +} + +void +gs_currentdefaultrgbicc(const gs_imager_state * pis, gs_param_string * pval) +{ + static const char *const rfs = DEFAULT_RGB_ICC; + + pval->data = (const byte *)( (pis->icc_manager->default_rgb == NULL) ? + rfs : pis->icc_manager->default_rgb->name); + pval->size = strlen((const char *)pval->data); + pval->persistent = true; +} + +int +gs_setdefaultrgbicc(const gs_imager_state * pis, gs_param_string * pval) +{ + int code; + char *pname; + int namelen = (pval->size)+1; + gs_memory_t *mem = pis->memory; + + pname = (char *)gs_alloc_bytes(mem, namelen, + "set_default_rgb_icc"); + memcpy(pname,pval->data,namelen-1); + pname[namelen-1] = 0; + code = gsicc_set_profile(pis->icc_manager, + (const char*) pname, namelen, DEFAULT_RGB); + gs_free_object(mem, pname, + "set_default_rgb_icc"); + if (code < 0) + return gs_rethrow(code, "cannot find default rgb icc profile"); + return code; +} + +void +gs_currentnamedicc(const gs_imager_state * pis, gs_param_string * pval) +{ + static const char *const rfs = ""; + + pval->data = (const byte *)( (pis->icc_manager->device_named == NULL) ? + rfs : pis->icc_manager->device_named->name); + pval->size = strlen((const char *)pval->data); + pval->persistent = true; +} + +int +gs_setnamedprofileicc(const gs_imager_state * pis, gs_param_string * pval) +{ + int code; + char* pname; + int namelen = (pval->size)+1; + gs_memory_t *mem = pis->memory; + + /* Check if it was "NULL" */ + if (pval->size != 0) { + pname = (char *)gs_alloc_bytes(mem, namelen, + "set_named_profile_icc"); + memcpy(pname,pval->data,namelen-1); + pname[namelen-1] = 0; + code = gsicc_set_profile(pis->icc_manager, + (const char*) pname, namelen, NAMED_TYPE); + gs_free_object(mem, pname, + "set_named_profile_icc"); + if (code < 0) + return gs_rethrow(code, "cannot find named color icc profile"); + return code; + } + return 0; +} + +void +gs_currentdefaultcmykicc(const gs_imager_state * pis, gs_param_string * pval) +{ + static const char *const rfs = DEFAULT_CMYK_ICC; + + pval->data = (const byte *)( (pis->icc_manager->default_cmyk == NULL) ? + rfs : pis->icc_manager->default_cmyk->name); + pval->size = strlen((const char *)pval->data); + pval->persistent = true; +} + +int +gs_setdefaultcmykicc(const gs_imager_state * pis, gs_param_string * pval) +{ + int code; + char* pname; + int namelen = (pval->size)+1; + gs_memory_t *mem = pis->memory; + + pname = (char *)gs_alloc_bytes(mem, namelen, + "set_default_cmyk_icc"); + memcpy(pname,pval->data,namelen-1); + pname[namelen-1] = 0; + code = gsicc_set_profile(pis->icc_manager, + (const char*) pname, namelen, DEFAULT_CMYK); + gs_free_object(mem, pname, + "set_default_cmyk_icc"); + if (code < 0) + return gs_throw(code, "cannot find default cmyk icc profile"); + return code; +} + +void +gs_currentlabicc(const gs_imager_state * pis, gs_param_string * pval) +{ + static const char *const rfs = LAB_ICC; + + pval->data = (const byte *)( (pis->icc_manager->lab_profile == NULL) ? + rfs : pis->icc_manager->lab_profile->name); + pval->size = strlen((const char *)pval->data); + pval->persistent = true; +} + +int +gs_setlabicc(const gs_imager_state * pis, gs_param_string * pval) +{ + int code; + char* pname; + int namelen = (pval->size)+1; + gs_memory_t *mem = pis->memory; + + pname = (char *)gs_alloc_bytes(mem, namelen, + "set_lab_icc"); + memcpy(pname,pval->data,namelen-1); + pname[namelen-1] = 0; + code = gsicc_set_profile(pis->icc_manager, + (const char*) pname, namelen, LAB_TYPE); + gs_free_object(mem, pname, + "set_lab_icc"); + if (code < 0) + return gs_throw(code, "cannot find default lab icc profile"); + return code; +} + diff --git a/gs/base/gsicc_manage.h b/gs/base/gsicc_manage.h index 02d27912a..aef824309 100644 --- a/gs/base/gsicc_manage.h +++ b/gs/base/gsicc_manage.h @@ -119,6 +119,25 @@ cmm_profile_t* gsicc_set_iccsmaskprofile(const char *pname, int namelen, int gsicc_set_device_profile(gx_device * pdev, gs_memory_t * mem, char *file_name, gsicc_profile_types_t defaulttype); void gsicc_setrange_lab(cmm_profile_t *profile); +/* system and user params */ +void gs_currentdevicenicc(const gs_imager_state * pis, gs_param_string * pval); +int gs_setdevicenprofileicc(const gs_imager_state * pis, gs_param_string * pval); +void gs_currentdefaultgrayicc(const gs_imager_state * pis, gs_param_string * pval); +int gs_setdefaultgrayicc(const gs_imager_state * pis, gs_param_string * pval); +void gs_currenticcdirectory(const gs_imager_state * pis, gs_param_string * pval); +int gs_seticcdirectory(const gs_imager_state * pis, gs_param_string * pval); +void gs_currentsrcgtagicc(const gs_imager_state * pis, gs_param_string * pval); +int gs_setsrcgtagicc(const gs_imager_state * pis, gs_param_string * pval); +void gs_currentdefaultrgbicc(const gs_imager_state * pis, gs_param_string * pval); +int gs_setdefaultrgbicc(const gs_imager_state * pis, gs_param_string * pval); +void gs_currentnamedicc(const gs_imager_state * pis, gs_param_string * pval); +int gs_setnamedprofileicc(const gs_imager_state * pis, gs_param_string * pval); +void gs_currentdefaultcmykicc(const gs_imager_state * pis, gs_param_string * pval); +int gs_setdefaultcmykicc(const gs_imager_state * pis, gs_param_string * pval); +void gs_currentlabicc(const gs_imager_state * pis, gs_param_string * pval); +int gs_setlabicc(const gs_imager_state * pis, gs_param_string * pval); + + #if ICC_DUMP static void dump_icc_buffer(int buffersize, char filename[],byte *Buffer); diff --git a/gs/psi/zusparam.c b/gs/psi/zusparam.c index 8eccfa1cb..a86ed71dc 100644 --- a/gs/psi/zusparam.c +++ b/gs/psi/zusparam.c @@ -452,329 +452,116 @@ set_GridFitTT(i_ctx_t *i_ctx_p, long val) #undef ifont_dir -/* No default for the deviceN profile. */ - static void current_devicen_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - static const char *const rfs = ""; const gs_imager_state * pis = (gs_imager_state *) igs; - - /*FIXME: This should return the entire list !!! */ - /* Just return the first one for now */ - pval->data = (const byte *)( (pis->icc_manager->device_n == NULL) ? - rfs : pis->icc_manager->device_n->head->iccprofile->name); - pval->size = strlen((const char *)pval->data); - pval->persistent = true; + gs_currentdevicenicc(pis, pval); } static int set_devicen_profile_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - int code = 0; - char *pname, *pstr, *pstrend; - int namelen = (pval->size)+1; const gs_imager_state * pis = (gs_imager_state *) igs; - gs_memory_t *mem = pis->memory; - - /* Check if it was "NULL" */ - if (pval->size != 0) { - /* The DeviceN name can have multiple files - in it. This way we can define all the - DeviceN color spaces with ICC profiles. - divide using , and ; delimeters as well as - remove leading and ending spaces (file names - can have internal spaces). */ - pname = (char *)gs_alloc_bytes(mem, namelen, - "set_devicen_profile_icc"); - memcpy(pname,pval->data,namelen-1); - pname[namelen-1] = 0; - pstr = strtok(pname, ",;"); - while (pstr != NULL) { - namelen = strlen(pstr); - /* Remove leading and trailing spaces from the name */ - while ( namelen > 0 && pstr[0] == 0x20) { - pstr++; - namelen--; - } - namelen = strlen(pstr); - pstrend = &(pstr[namelen-1]); - while ( namelen > 0 && pstrend[0] == 0x20) { - pstrend--; - namelen--; - } - code = gsicc_set_profile(pis->icc_manager, (const char*) pstr, namelen, DEVICEN_TYPE); - if (code < 0) - return gs_rethrow(code, "cannot find devicen icc profile"); - pstr = strtok(NULL, ",;"); - } - gs_free_object(mem, pname, - "set_devicen_profile_icc"); - return(code); - } - return(0); + return gs_setdevicenprofileicc(pis, pval); } static void current_default_gray_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - static const char *const rfs = DEFAULT_GRAY_ICC; const gs_imager_state * pis = (gs_imager_state *) igs; - - pval->data = (const byte *)( (pis->icc_manager->default_gray == NULL) ? - rfs : pis->icc_manager->default_gray->name); - pval->size = strlen((const char *)pval->data); - pval->persistent = true; + gs_currentdefaultgrayicc(pis, pval); } static int set_default_gray_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - int code; - char *pname; - int namelen = (pval->size)+1; const gs_imager_state * pis = (gs_imager_state *) igs; - gs_memory_t *mem = pis->memory; - bool not_initialized; - - /* Detect if this is our first time in here. If so, then we need to - reset up the default gray color spaces that are in the graphic state - to be ICC based. It was not possible to do it until after we get - the profile */ - not_initialized = (pis->icc_manager->default_gray == NULL); - - pname = (char *)gs_alloc_bytes(mem, namelen, - "set_default_gray_icc"); - memcpy(pname,pval->data,namelen-1); - pname[namelen-1] = 0; - code = gsicc_set_profile(pis->icc_manager, - (const char*) pname, namelen, DEFAULT_GRAY); - gs_free_object(mem, pname, - "set_default_gray_icc"); - if (code < 0) - return gs_rethrow(code, "cannot find default gray icc profile"); - /* if this is our first time in here then we need to properly install the - color spaces that were initialized in the graphic state at this time */ - if (not_initialized) { - code = gsicc_init_gs_colors((gs_state*) pis); - } - if (code < 0) - return gs_rethrow(code, "error initializing gstate color spaces to icc"); - return code; + return gs_setdefaultgrayicc(pis, pval); } static void current_icc_directory(i_ctx_t *i_ctx_p, gs_param_string * pval) { - static const char *const rfs = DEFAULT_DIR_ICC; /* as good as any other */ - const gs_lib_ctx_t *lib_ctx = ((gs_imager_state *)igs)->memory->gs_lib_ctx; - - if (lib_ctx->profiledir == NULL) { - pval->data = (const byte *)rfs; - pval->size = strlen(rfs); - } else { - pval->data = (const byte *)(lib_ctx->profiledir); - pval->size = lib_ctx->profiledir_len; - } - pval->persistent = true; + const gs_imager_state * pis = (gs_imager_state *) igs; + gs_currenticcdirectory(pis, pval); } static int set_icc_directory(i_ctx_t *i_ctx_p, gs_param_string * pval) { - char *pname; - int namelen = (pval->size)+1; - const gs_memory_t *mem = ((gs_imager_state *)igs)->memory; - - /* Check if it was "NULL" */ - if (pval->size != 0 ) { - pname = (char *)gs_alloc_bytes((gs_memory_t *)mem, namelen, - "set_icc_directory"); - if (pname == NULL) - return gs_rethrow(-1, "cannot allocate directory name"); - memcpy(pname,pval->data,namelen-1); - pname[namelen-1] = 0; - gs_lib_ctx_set_icc_directory(mem, (const char*) pname, namelen); - gs_free_object((gs_memory_t *)mem, pname, "set_icc_directory"); - } - return(0); + const gs_imager_state * pis = (gs_imager_state *) igs; + return gs_seticcdirectory(pis, pval); } static void current_srcgtag_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { const gs_imager_state * pis = (gs_imager_state *) igs; - - if (pis->icc_manager->srcgtag_profile == NULL) { - pval->data = NULL; - pval->size = 0; - pval->persistent = true; - } else { - pval->data = (byte *)pis->icc_manager->srcgtag_profile->name; - pval->size = strlen((const char *)pval->data); - pval->persistent = true; - } + gs_currentsrcgtagicc(pis, pval); } static int set_srcgtag_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - int code; - char *pname; - int namelen = (pval->size)+1; const gs_imager_state * pis = (gs_imager_state *) igs; - gs_memory_t *mem = pis->memory; - - if (pval->size == 0) return 0; - pname = (char *)gs_alloc_bytes(mem, namelen, "set_srcgtag_icc"); - memcpy(pname,pval->data,namelen-1); - pname[namelen-1] = 0; - code = gsicc_set_srcgtag_struct(pis->icc_manager, (const char*) pname, - namelen); - gs_free_object(mem, pname, "set_srcgtag_icc"); - if (code < 0) - return gs_rethrow(code, "cannot find srctag file"); - return(code); + return gs_setsrcgtagicc(pis, pval); } static void current_default_rgb_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - static const char *const rfs = DEFAULT_RGB_ICC; const gs_imager_state * pis = (gs_imager_state *) igs; - - pval->data = (const byte *)( (pis->icc_manager->default_rgb == NULL) ? - rfs : pis->icc_manager->default_rgb->name); - pval->size = strlen((const char *)pval->data); - pval->persistent = true; + gs_currentdefaultrgbicc(pis, pval); } static int set_default_rgb_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - int code; - char *pname; - int namelen = (pval->size)+1; const gs_imager_state * pis = (gs_imager_state *) igs; - gs_memory_t *mem = pis->memory; - - pname = (char *)gs_alloc_bytes(mem, namelen, - "set_default_rgb_icc"); - memcpy(pname,pval->data,namelen-1); - pname[namelen-1] = 0; - code = gsicc_set_profile(pis->icc_manager, - (const char*) pname, namelen, DEFAULT_RGB); - gs_free_object(mem, pname, - "set_default_rgb_icc"); - if (code < 0) - return gs_rethrow(code, "cannot find default rgb icc profile"); - return(code); + return gs_setdefaultrgbicc(pis, pval); } static void current_named_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - static const char *const rfs = ""; const gs_imager_state * pis = (gs_imager_state *) igs; - - pval->data = (const byte *)( (pis->icc_manager->device_named == NULL) ? - rfs : pis->icc_manager->device_named->name); - pval->size = strlen((const char *)pval->data); - pval->persistent = true; + gs_currentnamedicc(pis, pval); } static int set_named_profile_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - int code; - char* pname; - int namelen = (pval->size)+1; const gs_imager_state * pis = (gs_imager_state *) igs; - gs_memory_t *mem = pis->memory; - - /* Check if it was "NULL" */ - if (pval->size != 0) { - pname = (char *)gs_alloc_bytes(mem, namelen, - "set_named_profile_icc"); - memcpy(pname,pval->data,namelen-1); - pname[namelen-1] = 0; - code = gsicc_set_profile(pis->icc_manager, - (const char*) pname, namelen, NAMED_TYPE); - gs_free_object(mem, pname, - "set_named_profile_icc"); - if (code < 0) - return gs_rethrow(code, "cannot find named color icc profile"); - return(code); - } - return(0); + return gs_setnamedprofileicc(pis, pval); } static void current_default_cmyk_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - static const char *const rfs = DEFAULT_CMYK_ICC; const gs_imager_state * pis = (gs_imager_state *) igs; - - pval->data = (const byte *)( (pis->icc_manager->default_cmyk == NULL) ? - rfs : pis->icc_manager->default_cmyk->name); - pval->size = strlen((const char *)pval->data); - pval->persistent = true; + gs_currentdefaultcmykicc(pis, pval); } static int set_default_cmyk_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - int code; - char* pname; - int namelen = (pval->size)+1; const gs_imager_state * pis = (gs_imager_state *) igs; - gs_memory_t *mem = pis->memory; - - pname = (char *)gs_alloc_bytes(mem, namelen, - "set_default_cmyk_icc"); - memcpy(pname,pval->data,namelen-1); - pname[namelen-1] = 0; - code = gsicc_set_profile(pis->icc_manager, - (const char*) pname, namelen, DEFAULT_CMYK); - gs_free_object(mem, pname, - "set_default_cmyk_icc"); - if (code < 0) - return gs_rethrow(code, "cannot find default cmyk icc profile"); - return(code); + return gs_setdefaultcmykicc(pis, pval); } static void current_lab_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - static const char *const rfs = LAB_ICC; const gs_imager_state * pis = (gs_imager_state *) igs; - - pval->data = (const byte *)( (pis->icc_manager->lab_profile == NULL) ? - rfs : pis->icc_manager->lab_profile->name); - pval->size = strlen((const char *)pval->data); - pval->persistent = true; + gs_currentlabicc(pis, pval); } static int set_lab_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - int code; - char* pname; - int namelen = (pval->size)+1; const gs_imager_state * pis = (gs_imager_state *) igs; - gs_memory_t *mem = pis->memory; - - pname = (char *)gs_alloc_bytes(mem, namelen, - "set_lab_icc"); - memcpy(pname,pval->data,namelen-1); - pname[namelen-1] = 0; - code = gsicc_set_profile(pis->icc_manager, - (const char*) pname, namelen, LAB_TYPE); - gs_free_object(mem, pname, - "set_lab_icc"); - if (code < 0) - return gs_rethrow(code, "cannot find default lab icc profile"); - return(code); + return gs_setlabicc(pis, pval); } static const long_param_def_t user_long_params[] = |