本文整理汇总了C++中cmsGetPCS函数的典型用法代码示例。如果您正苦于以下问题:C++ cmsGetPCS函数的具体用法?C++ cmsGetPCS怎么用?C++ cmsGetPCS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cmsGetPCS函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _cmsReadOutputLUT
// Create an output MPE LUT from agiven profile. Version mismatches are handled here
cmsPipeline* _cmsReadOutputLUT(cmsHPROFILE hProfile, int Intent)
{
cmsTagTypeSignature OriginalType;
cmsTagSignature tag16 = PCS2Device16[Intent];
cmsTagSignature tagFloat = PCS2DeviceFloat[Intent];
cmsContext ContextID = cmsGetProfileContextID(hProfile);
if (cmsIsTag(hProfile, tagFloat)) { // Float tag takes precedence
// Floating point LUT are always V4, so no adjustment is required
return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
}
// Revert to perceptual if no tag is found
if (!cmsIsTag(hProfile, tag16)) {
tag16 = PCS2Device16[0];
}
if (cmsIsTag(hProfile, tag16)) { // Is there any LUT-Based table?
// Check profile version and LUT type. Do the necessary adjustments if needed
// First read the tag
cmsPipeline* Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16);
if (Lut == NULL) return NULL;
// After reading it, we have info about the original type
OriginalType = _cmsGetTagTrueType(hProfile, tag16);
// The profile owns the Lut, so we need to copy it
Lut = cmsPipelineDup(Lut);
if (Lut == NULL) return NULL;
// Now it is time for a controversial stuff. I found that for 3D LUTS using
// Lab used as indexer space, trilinear interpolation should be used
if (cmsGetPCS(hProfile) == cmsSigLabData)
ChangeInterpolationToTrilinear(Lut);
// We need to adjust data only for Lab and Lut16 type
if (OriginalType != cmsSigLut16Type || cmsGetPCS(hProfile) != cmsSigLabData)
return Lut;
// Add a matrix for conversion V4 to V2 Lab PCS
cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID));
return Lut;
}
// Lut not found, try to create a matrix-shaper
// Check if this is a grayscale profile.
if (cmsGetColorSpace(hProfile) == cmsSigGrayData) {
// if so, build appropiate conversion tables.
// The tables are the PCS iluminant, scaled across GrayTRC
return BuildGrayOutputPipeline(hProfile);
}
// Not gray, create a normal matrix-shaper
return BuildRGBOutputMatrixShaper(hProfile);
}
开发者ID:AFQuentin,项目名称:openjpeg,代码行数:61,代码来源:cmsio1.c
示例2: _cmsReadFloatInputTag
/*static
cmsPipeline* _cmsReadFloatInputTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat)
{
cmsContext ContextID = cmsGetProfileContextID(hProfile);
cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
cmsColorSpaceSignature spc = cmsGetColorSpace(hProfile);
if (Lut == NULL) return NULL;
// If PCS is Lab or XYZ, the floating point tag is accepting data in the space encoding,
// and since the formatter has already accomodated to 0..1.0, we should undo this change
if ( spc == cmsSigLabData)
{
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID));
}
else
if (spc == cmsSigXYZData)
{
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID));
}
return Lut;
}
*/
static
cmsPipeline* _cmsReadFloatInputTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat)
{
cmsContext ContextID = cmsGetProfileContextID(hProfile);
cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
cmsColorSpaceSignature spc = cmsGetColorSpace(hProfile);
cmsColorSpaceSignature PCS = cmsGetPCS(hProfile);
if (Lut == NULL) return NULL;
// input and output of transform are in lcms 0..1 encoding. If XYZ or Lab spaces are used,
// these need to be normalized into the appropriate ranges (Lab = 100,0,0, XYZ=1.0,1.0,1.0)
if ( spc == cmsSigLabData)
{
cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToLabFloat(ContextID));
}
else if (spc == cmsSigXYZData)
{
cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToXyzFloat(ContextID));
}
if ( PCS == cmsSigLabData)
{
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID));
}
else if( PCS == cmsSigXYZData)
{
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID));
}
return Lut;
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:56,代码来源:cmsio1.c
示例3: _cmsReadFloatOutputTag
static
cmsPipeline* _cmsReadFloatOutputTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat)
{
cmsContext ContextID = cmsGetProfileContextID(hProfile);
cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
cmsColorSpaceSignature PCS = cmsGetPCS(hProfile);
cmsColorSpaceSignature dataSpace = cmsGetColorSpace(hProfile);
if (Lut == NULL) return NULL;
// If PCS is Lab or XYZ, the floating point tag is accepting data in the space encoding,
// and since the formatter has already accomodated to 0..1.0, we should undo this change
if ( PCS == cmsSigLabData)
{
cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToLabFloat(ContextID));
}
else
if (PCS == cmsSigXYZData)
{
cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToXyzFloat(ContextID));
}
// the output can be Lab or XYZ, in which case normalisation is needed on the end of the pipeline
if ( dataSpace == cmsSigLabData)
{
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID));
}
else if ( dataSpace == cmsSigXYZData)
{
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID));
}
return Lut;
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:34,代码来源:cmsio1.c
示例4: _cmsReadFloatDevicelinkTag
// Read the AToD0 tag, adjusting the encoding of Lab or XYZ if neded
static
cmsPipeline* _cmsReadFloatDevicelinkTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat)
{
cmsContext ContextID = cmsGetProfileContextID(hProfile);
cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
cmsColorSpaceSignature PCS = cmsGetPCS(hProfile);
cmsColorSpaceSignature spc = cmsGetColorSpace(hProfile);
if (Lut == NULL) return NULL;
if (spc == cmsSigLabData)
{
cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToLabFloat(ContextID));
}
else
if (spc == cmsSigXYZData)
{
cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToXyzFloat(ContextID));
}
if (PCS == cmsSigLabData)
{
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID));
}
else
if (PCS == cmsSigXYZData)
{
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID));
}
return Lut;
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:33,代码来源:cmsio1.c
示例5: GetDevicelinkColorSpace
static
int GetDevicelinkColorSpace(cmsHPROFILE hProfile)
{
cmsColorSpaceSignature ProfileSpace = cmsGetPCS(hProfile);
return _cmsLCMScolorSpace(ProfileSpace);
}
开发者ID:etlegacy,项目名称:EasyGen,代码行数:7,代码来源:jpgicc.c
示例6: cms_profile_getattro
static PyObject*
cms_profile_getattro(CmsProfileObject* self, PyObject* name)
{
PyObject* name_bytes;
char* name_string;
if (!PyUnicode_Check(name))
return NULL;
if (!(name_bytes = PyUnicode_AsASCIIString(name)))
return NULL;
if (!(name_string = PyBytes_AsString(name_bytes)))
return NULL;
if (!strcmp(name_string, "product_name"))
return PyUnicode_FromFormat("%s", cmsTakeProductName(self->profile));
if (!strcmp(name_string, "product_desc"))
return PyUnicode_FromFormat("%s", cmsTakeProductDesc(self->profile));
if (!strcmp(name_string, "product_info"))
return PyUnicode_FromFormat("%s", cmsTakeProductInfo(self->profile));
if (!strcmp(name_string, "rendering_intent"))
return PyLong_FromLong(cmsTakeRenderingIntent(self->profile));
if (!strcmp(name_string, "pcs"))
return PyUnicode_FromFormat("%s", findICmode(cmsGetPCS(self->profile)));
if (!strcmp(name_string, "color_space"))
return PyUnicode_FromFormat("%s",
findICmode(cmsGetColorSpace(self->profile)));
/* FIXME: add more properties (creation_datetime etc) */
return PyObject_GenericGetAttr((PyObject*)self, name);
}
开发者ID:olduvaihand,项目名称:pil3k,代码行数:32,代码来源:_imagingcms.c
示例7: BuildGrayOutputPipeline
static
cmsPipeline* BuildGrayOutputPipeline(cmsHPROFILE hProfile)
{
cmsToneCurve *GrayTRC, *RevGrayTRC;
cmsPipeline* Lut;
cmsContext ContextID = cmsGetProfileContextID(hProfile);
GrayTRC = (cmsToneCurve *) cmsReadTag(hProfile, cmsSigGrayTRCTag);
if (GrayTRC == NULL) return NULL;
RevGrayTRC = cmsReverseToneCurve(GrayTRC);
if (RevGrayTRC == NULL) return NULL;
Lut = cmsPipelineAlloc(ContextID, 3, 1);
if (Lut == NULL) {
cmsFreeToneCurve(RevGrayTRC);
return NULL;
}
if (cmsGetPCS(hProfile) == cmsSigLabData) {
cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocMatrix(ContextID, 1, 3, PickLstarMatrix, NULL));
}
else {
cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocMatrix(ContextID, 1, 3, PickYMatrix, NULL));
}
cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, 1, &RevGrayTRC));
cmsFreeToneCurve(RevGrayTRC);
return Lut;
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:32,代码来源:cmsio1.c
示例8: gscms_get_output_channel_count
/* Get the number of output channels for the profile */
int
gscms_get_output_channel_count(gcmmhprofile_t profile)
{
icColorSpaceSignature colorspace;
colorspace = cmsGetPCS(profile);
return(_cmsChannelsOf(colorspace));
}
开发者ID:ststeiger,项目名称:ghostsvg,代码行数:9,代码来源:gsicc_lcms.c
示例9: _cmsReadInputLUT
// Read and create a BRAND NEW MPE LUT from a given profile. All stuff dependent of version, etc
// is adjusted here in order to create a LUT that takes care of all those details
cmsPipeline* _cmsReadInputLUT(cmsHPROFILE hProfile, int Intent)
{
cmsTagTypeSignature OriginalType;
cmsTagSignature tag16 = Device2PCS16[Intent];
cmsTagSignature tagFloat = Device2PCSFloat[Intent];
cmsContext ContextID = cmsGetProfileContextID(hProfile);
if (cmsIsTag(hProfile, tagFloat)) { // Float tag takes precedence
// Floating point LUT are always V4, so no adjustment is required
return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
}
// Revert to perceptual if no tag is found
if (!cmsIsTag(hProfile, tag16)) {
tag16 = Device2PCS16[0];
}
if (cmsIsTag(hProfile, tag16)) { // Is there any LUT-Based table?
// Check profile version and LUT type. Do the necessary adjustments if needed
// First read the tag
cmsPipeline* Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16);
if (Lut == NULL) return NULL;
// After reading it, we have now info about the original type
OriginalType = _cmsGetTagTrueType(hProfile, tag16);
// The profile owns the Lut, so we need to copy it
Lut = cmsPipelineDup(Lut);
// We need to adjust data only for Lab16 on output
if (OriginalType != cmsSigLut16Type || cmsGetPCS(hProfile) != cmsSigLabData)
return Lut;
// If the input is Lab, add also a conversion at the begin
if (cmsGetColorSpace(hProfile) == cmsSigLabData)
cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID));
// Add a matrix for conversion V2 to V4 Lab PCS
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID));
return Lut;
}
// Lut was not found, try to create a matrix-shaper
// Check if this is a grayscale profile.
if (cmsGetColorSpace(hProfile) == cmsSigGrayData) {
// if so, build appropiate conversion tables.
// The tables are the PCS iluminant, scaled across GrayTRC
return BuildGrayInputMatrixPipeline(hProfile);
}
// Not gray, create a normal matrix-shaper
return BuildRGBInputMatrixShaper(hProfile);
}
开发者ID:ststeiger,项目名称:ghostsvg,代码行数:60,代码来源:cmsio1.c
示例10: BuildRGBOutputMatrixShaper
static
cmsPipeline* BuildRGBOutputMatrixShaper(cmsHPROFILE hProfile)
{
cmsPipeline* Lut;
cmsToneCurve *Shapes[3], *InvShapes[3];
cmsMAT3 Mat, Inv;
int i, j;
cmsContext ContextID = cmsGetProfileContextID(hProfile);
if (!ReadICCMatrixRGB2XYZ(&Mat, hProfile))
return NULL;
if (!_cmsMAT3inverse(&Mat, &Inv))
return NULL;
// XYZ PCS in encoded in 1.15 format, and the matrix input should come in 0..0xffff range, so
// we need to adjust the input by a << 1 to obtain a 1.16 fixed and then by a factor of
// (0xffff/0x10000) to put data in 0..0xffff range. Total factor is (2.0*65535.0)/65536.0;
for (i=0; i < 3; i++)
for (j=0; j < 3; j++)
Inv.v[i].n[j] *= OutpAdj;
Shapes[0] = (cmsToneCurve *) cmsReadTag(hProfile, cmsSigRedTRCTag);
Shapes[1] = (cmsToneCurve *) cmsReadTag(hProfile, cmsSigGreenTRCTag);
Shapes[2] = (cmsToneCurve *) cmsReadTag(hProfile, cmsSigBlueTRCTag);
if (!Shapes[0] || !Shapes[1] || !Shapes[2])
return NULL;
InvShapes[0] = cmsReverseToneCurve(Shapes[0]);
InvShapes[1] = cmsReverseToneCurve(Shapes[1]);
InvShapes[2] = cmsReverseToneCurve(Shapes[2]);
if (!InvShapes[0] || !InvShapes[1] || !InvShapes[2]) {
return NULL;
}
Lut = cmsPipelineAlloc(ContextID, 3, 3);
if (Lut != NULL) {
// Note that it is certainly possible a single profile would have a LUT based
// tag for output working in lab and a matrix-shaper for the fallback cases.
// This is not allowed by the spec, but this code is tolerant to those cases
if (cmsGetPCS(hProfile) == cmsSigLabData) {
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLab2XYZ(ContextID));
}
cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocMatrix(ContextID, 3, 3, (cmsFloat64Number*) &Inv, NULL));
cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, 3, InvShapes));
}
cmsFreeToneCurveTriple(InvShapes);
return Lut;
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:56,代码来源:cmsio1.c
示例11: gscms_get_link_proof_devlink
/* Get the link from the CMS, but include proofing and/or a device link
profile. */
gcmmhlink_t
gscms_get_link_proof_devlink(gcmmhprofile_t lcms_srchandle,
gcmmhprofile_t lcms_proofhandle,
gcmmhprofile_t lcms_deshandle,
gcmmhprofile_t lcms_devlinkhandle,
gsicc_rendering_param_t *rendering_params,
bool src_dev_link, int cmm_flags,
gs_memory_t *mem)
{
DWORD src_data_type,des_data_type;
icColorSpaceSignature src_color_space,des_color_space;
int src_nChannels,des_nChannels;
int lcms_src_color_space, lcms_des_color_space;
cmsHPROFILE hProfiles[5];
int nProfiles = 0;
/* First handle all the source stuff */
src_color_space = cmsGetColorSpace(lcms_srchandle);
lcms_src_color_space = _cmsLCMScolorSpace(src_color_space);
/* littlecms returns -1 for types it does not (but should) understand */
if (lcms_src_color_space < 0) lcms_src_color_space = 0;
src_nChannels = _cmsChannelsOf(src_color_space);
/* For now, just do single byte data, interleaved. We can change this
when we use the transformation. */
src_data_type = (COLORSPACE_SH(lcms_src_color_space)|
CHANNELS_SH(src_nChannels)|BYTES_SH(2));
if (lcms_deshandle != NULL) {
des_color_space = cmsGetColorSpace(lcms_deshandle);
} else {
/* We must have a device link profile. */
des_color_space = cmsGetPCS(lcms_deshandle);
}
lcms_des_color_space = _cmsLCMScolorSpace(des_color_space);
if (lcms_des_color_space < 0) lcms_des_color_space = 0;
des_nChannels = _cmsChannelsOf(des_color_space);
des_data_type = (COLORSPACE_SH(lcms_des_color_space)|
CHANNELS_SH(des_nChannels)|BYTES_SH(2));
/* lcms proofing transform has a clunky API and can't include the device
link profile if we have both. So use cmsCreateMultiprofileTransform
instead and round trip the proofing profile. */
hProfiles[nProfiles++] = lcms_srchandle;
if (lcms_proofhandle != NULL) {
hProfiles[nProfiles++] = lcms_proofhandle;
hProfiles[nProfiles++] = lcms_proofhandle;
}
hProfiles[nProfiles++] = lcms_deshandle;
if (lcms_devlinkhandle != NULL) {
hProfiles[nProfiles++] = lcms_devlinkhandle;
}
return(cmsCreateMultiprofileTransform(hProfiles, nProfiles, src_data_type,
des_data_type, rendering_params->rendering_intent,
(cmm_flags | cmsFLAGS_BLACKPOINTCOMPENSATION |
cmsFLAGS_HIGHRESPRECALC |
cmsFLAGS_NOTCACHE)));
}
开发者ID:DecisiveMocha,项目名称:ghostpdl,代码行数:57,代码来源:gsicc_lcms.c
示例12: _cmsReadDevicelinkLUT
// This one includes abstract profiles as well. Matrix-shaper cannot be obtained on that device class. The
// tag name here may default to AToB0
cmsPipeline* _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, int Intent)
{
cmsPipeline* Lut;
cmsTagTypeSignature OriginalType;
cmsTagSignature tag16 = Device2PCS16[Intent];
cmsTagSignature tagFloat = Device2PCSFloat[Intent];
cmsContext ContextID = cmsGetProfileContextID(hProfile);
if (cmsIsTag(hProfile, tagFloat)) { // Float tag takes precedence
// Floating point LUT are always V4, no adjustment is required
return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
}
tagFloat = Device2PCSFloat[0];
if (cmsIsTag(hProfile, tagFloat)) {
return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
}
if (!cmsIsTag(hProfile, tag16)) { // Is there any LUT-Based table?
tag16 = Device2PCS16[0];
if (!cmsIsTag(hProfile, tag16)) return NULL;
}
// Check profile version and LUT type. Do the necessary adjustments if needed
// Read the tag
Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16);
if (Lut == NULL) return NULL;
// The profile owns the Lut, so we need to copy it
Lut = cmsPipelineDup(Lut);
// After reading it, we have info about the original type
OriginalType = _cmsGetTagTrueType(hProfile, tag16);
// We need to adjust data for Lab16 on output
if (OriginalType != cmsSigLut16Type) return Lut;
// Here it is possible to get Lab on both sides
if (cmsGetPCS(hProfile) == cmsSigLabData) {
cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID));
}
if (cmsGetColorSpace(hProfile) == cmsSigLabData) {
cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID));
}
return Lut;
}
开发者ID:AntinZhu,项目名称:jdk-source,代码行数:57,代码来源:cmsio1.c
示例13: BuildGrayInputMatrixPipeline
// Gray input pipeline
static
cmsPipeline* BuildGrayInputMatrixPipeline(cmsHPROFILE hProfile)
{
cmsToneCurve *GrayTRC;
cmsPipeline* Lut;
cmsContext ContextID = cmsGetProfileContextID(hProfile);
GrayTRC = (cmsToneCurve *) cmsReadTag(hProfile, cmsSigGrayTRCTag);
if (GrayTRC == NULL) return NULL;
Lut = cmsPipelineAlloc(ContextID, 1, 3);
if (Lut == NULL)
goto Error;
if (cmsGetPCS(hProfile) == cmsSigLabData) {
// In this case we implement the profile as an identity matrix plus 3 tone curves
cmsUInt16Number Zero[2] = { 0x8080, 0x8080 };
cmsToneCurve* EmptyTab;
cmsToneCurve* LabCurves[3];
EmptyTab = cmsBuildTabulatedToneCurve16(ContextID, 2, Zero);
if (EmptyTab == NULL)
goto Error;
LabCurves[0] = GrayTRC;
LabCurves[1] = EmptyTab;
LabCurves[2] = EmptyTab;
if (!cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocMatrix(ContextID, 3, 1, OneToThreeInputMatrix, NULL)) ||
!cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, 3, LabCurves))) {
cmsFreeToneCurve(EmptyTab);
goto Error;
}
cmsFreeToneCurve(EmptyTab);
}
else {
if (!cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, 1, &GrayTRC)) ||
!cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocMatrix(ContextID, 3, 1, GrayInputMatrix, NULL)))
goto Error;
}
return Lut;
Error:
cmsFreeToneCurve(GrayTRC);
cmsPipelineFree(Lut);
return NULL;
}
开发者ID:AndresPozo,项目名称:PCL,代码行数:54,代码来源:cmsio1.c
示例14: BuildRGBInputMatrixShaper
// RGB Matrix shaper
static
cmsPipeline* BuildRGBInputMatrixShaper(cmsHPROFILE hProfile)
{
cmsPipeline* Lut;
cmsMAT3 Mat;
cmsToneCurve *Shapes[3];
cmsContext ContextID = cmsGetProfileContextID(hProfile);
int i, j;
if (!ReadICCMatrixRGB2XYZ(&Mat, hProfile)) return NULL;
// XYZ PCS in encoded in 1.15 format, and the matrix output comes in 0..0xffff range, so
// we need to adjust the output by a factor of (0x10000/0xffff) to put data in
// a 1.16 range, and then a >> 1 to obtain 1.15. The total factor is (65536.0)/(65535.0*2)
for (i=0; i < 3; i++)
for (j=0; j < 3; j++)
Mat.v[i].n[j] *= InpAdj;
Shapes[0] = (cmsToneCurve *) cmsReadTag(hProfile, cmsSigRedTRCTag);
Shapes[1] = (cmsToneCurve *) cmsReadTag(hProfile, cmsSigGreenTRCTag);
Shapes[2] = (cmsToneCurve *) cmsReadTag(hProfile, cmsSigBlueTRCTag);
if (!Shapes[0] || !Shapes[1] || !Shapes[2])
return NULL;
Lut = cmsPipelineAlloc(ContextID, 3, 3);
if (Lut != NULL) {
if (!cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, 3, Shapes)) ||
!cmsPipelineInsertStage(Lut, cmsAT_END, cmsStageAllocMatrix(ContextID, 3, 3, (cmsFloat64Number*) &Mat, NULL)))
goto Error;
// Note that it is certainly possible a single profile would have a LUT based
// tag for output working in lab and a matrix-shaper for the fallback cases.
// This is not allowed by the spec, but this code is tolerant to those cases
if (cmsGetPCS(hProfile) == cmsSigLabData) {
if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocXYZ2Lab(ContextID)))
goto Error;
}
}
return Lut;
Error:
cmsPipelineFree(Lut);
return NULL;
}
开发者ID:AndresPozo,项目名称:PCL,代码行数:52,代码来源:cmsio1.c
示例15: cms_profile_getattr
static PyObject*
cms_profile_getattr(CmsProfileObject* self, char* name)
{
#ifdef PY3
if (!strcmp(name, "product_name"))
return PyUnicode_DecodeFSDefault(cmsTakeProductName(self->profile));
if (!strcmp(name, "product_desc"))
return PyUnicode_DecodeFSDefault(cmsTakeProductDesc(self->profile));
if (!strcmp(name, "product_info"))
return PyUnicode_DecodeFSDefault(cmsTakeProductInfo(self->profile));
if (!strcmp(name, "rendering_intent"))
return PyLong_FromLong(cmsTakeRenderingIntent(self->profile));
if (!strcmp(name, "pcs"))
return PyUnicode_DecodeFSDefault(findICmode(cmsGetPCS(self->profile)));
if (!strcmp(name, "color_space"))
return PyUnicode_DecodeFSDefault(findICmode(cmsGetColorSpace(self->profile)));
/* FIXME: add more properties (creation_datetime etc) */
return PyObject_GenericGetAttr((PyObject *)self,
PyUnicode_DecodeFSDefault(name));
#else
if (!strcmp(name, "product_name"))
return PyString_FromString(cmsTakeProductName(self->profile));
if (!strcmp(name, "product_desc"))
return PyString_FromString(cmsTakeProductDesc(self->profile));
if (!strcmp(name, "product_info"))
return PyString_FromString(cmsTakeProductInfo(self->profile));
if (!strcmp(name, "rendering_intent"))
return PyInt_FromLong(cmsTakeRenderingIntent(self->profile));
if (!strcmp(name, "pcs"))
return PyString_FromString(findICmode(cmsGetPCS(self->profile)));
if (!strcmp(name, "color_space"))
return PyString_FromString(findICmode(cmsGetColorSpace(self->profile)));
/* FIXME: add more properties (creation_datetime etc) */
return Py_FindMethod(cms_profile_methods, (PyObject*) self, name);
#endif
}
开发者ID:znanja,项目名称:pil-py3k,代码行数:38,代码来源:_imagingcms.c
示例16: CreateNamedColorDevicelink
static
cmsHPROFILE CreateNamedColorDevicelink(cmsHTRANSFORM xform)
{
_LPcmsTRANSFORM v = (_LPcmsTRANSFORM) xform;
cmsHPROFILE hICC;
cmsCIEXYZ WhitePoint;
int i, nColors;
size_t Size;
LPcmsNAMEDCOLORLIST nc2;
hICC = _cmsCreateProfilePlaceholder();
if (hICC == NULL) return NULL;
cmsSetRenderingIntent(hICC, v -> Intent);
cmsSetDeviceClass(hICC, icSigNamedColorClass);
cmsSetColorSpace(hICC, v ->ExitColorSpace);
cmsSetPCS(hICC, cmsGetPCS(v ->InputProfile));
cmsTakeMediaWhitePoint(&WhitePoint, v ->InputProfile);
cmsAddTag(hICC, icSigMediaWhitePointTag, &WhitePoint);
cmsAddTag(hICC, icSigDeviceMfgDescTag, (LPVOID) "LittleCMS");
cmsAddTag(hICC, icSigProfileDescriptionTag, (LPVOID) "Named color Device link");
cmsAddTag(hICC, icSigDeviceModelDescTag, (LPVOID) "Named color Device link");
nColors = cmsNamedColorCount(xform);
nc2 = cmsAllocNamedColorList(nColors);
Size = sizeof(cmsNAMEDCOLORLIST) + (sizeof(cmsNAMEDCOLOR) * (nColors-1));
CopyMemory(nc2, v->NamedColorList, Size);
nc2 ->ColorantCount = _cmsChannelsOf(v ->ExitColorSpace);
for (i=0; i < nColors; i++) {
cmsDoTransform(xform, &i, nc2 ->List[i].DeviceColorant, 1);
}
cmsAddTag(hICC, icSigNamedColor2Tag, (void*) nc2);
cmsFreeNamedColorList(nc2);
return hICC;
}
开发者ID:LuaDist,项目名称:lcms,代码行数:43,代码来源:cmsvirt.c
示例17: gscms_get_link
/* Get the link from the CMS. TODO: Add error checking */
gcmmhlink_t
gscms_get_link(gcmmhprofile_t lcms_srchandle,
gcmmhprofile_t lcms_deshandle,
gsicc_rendering_param_t *rendering_params)
{
DWORD src_data_type,des_data_type;
icColorSpaceSignature src_color_space,des_color_space;
int src_nChannels,des_nChannels;
int lcms_src_color_space, lcms_des_color_space;
/* Check for case of request for a transfrom from a device link profile
in that case, the destination profile is NULL */
/* First handle all the source stuff */
src_color_space = cmsGetColorSpace(lcms_srchandle);
lcms_src_color_space = _cmsLCMScolorSpace(src_color_space);
/* littlecms returns -1 for types it does not (but should) understand */
if (lcms_src_color_space < 0) lcms_src_color_space = 0;
src_nChannels = _cmsChannelsOf(src_color_space);
/* For now, just do single byte data, interleaved. We can change this
when we use the transformation. */
src_data_type = (COLORSPACE_SH(lcms_src_color_space)|
CHANNELS_SH(src_nChannels)|BYTES_SH(2));
if (lcms_deshandle != NULL) {
des_color_space = cmsGetColorSpace(lcms_deshandle);
} else {
/* We must have a device link profile. */
des_color_space = cmsGetPCS(lcms_deshandle);
}
lcms_des_color_space = _cmsLCMScolorSpace(des_color_space);
if (lcms_des_color_space < 0) lcms_des_color_space = 0;
des_nChannels = _cmsChannelsOf(des_color_space);
des_data_type = (COLORSPACE_SH(lcms_des_color_space)|
CHANNELS_SH(des_nChannels)|BYTES_SH(2));
/* Create the link */
return(cmsCreateTransform(lcms_srchandle, src_data_type, lcms_deshandle,
des_data_type, rendering_params->rendering_intent,
(cmsFLAGS_BLACKPOINTCOMPENSATION | cmsFLAGS_HIGHRESPRECALC)));
/* cmsFLAGS_HIGHRESPRECALC) cmsFLAGS_NOTPRECALC cmsFLAGS_LOWRESPRECALC*/
}
开发者ID:ststeiger,项目名称:ghostsvg,代码行数:42,代码来源:gsicc_lcms.c
示例18: OpenTransforms
static
void OpenTransforms(int argc, char *argv[])
{
DWORD dwIn, dwOut, dwFlags;
if (lMultiProfileChain) {
int i;
cmsHTRANSFORM hTmp;
nProfiles = argc - xoptind;
for (i=0; i < nProfiles; i++) {
hProfiles[i] = OpenProfile(argv[i+xoptind]);
}
// Create a temporary devicelink
hTmp = cmsCreateMultiprofileTransform(hProfiles, nProfiles,
0, 0, Intent, GetFlags());
hInput = cmsTransform2DeviceLink(hTmp, 0);
hOutput = NULL;
cmsDeleteTransform(hTmp);
InputColorSpace = cmsGetColorSpace(hInput);
OutputColorSpace = cmsGetPCS(hInput);
lIsDeviceLink = TRUE;
}
else
if (lIsDeviceLink) {
hInput = cmsOpenProfileFromFile(cInProf, "r");
hOutput = NULL;
InputColorSpace = cmsGetColorSpace(hInput);
OutputColorSpace = cmsGetPCS(hInput);
}
else {
hInput = OpenProfile(cInProf);
hOutput = OpenProfile(cOutProf);
InputColorSpace = cmsGetColorSpace(hInput);
OutputColorSpace = cmsGetColorSpace(hOutput);
if (cmsGetDeviceClass(hInput) == icSigLinkClass ||
cmsGetDeviceClass(hOutput) == icSigLinkClass)
FatalError("Use %cl flag for devicelink profiles!\n", SW);
}
if (Verbose) {
mexPrintf("From: %s\n", cmsTakeProductName(hInput));
if (hOutput) mexPrintf("To : %s\n\n", cmsTakeProductName(hOutput));
}
OutputChannels = _cmsChannelsOf(OutputColorSpace);
InputChannels = _cmsChannelsOf(InputColorSpace);
dwIn = MakeFormatDescriptor(InputColorSpace, nBytesDepth);
dwOut = MakeFormatDescriptor(OutputColorSpace, nBytesDepth);
dwFlags = GetFlags();
if (cProofing != NULL) {
hProof = OpenProfile(cProofing);
dwFlags |= cmsFLAGS_SOFTPROOFING;
}
hColorTransform = cmsCreateProofingTransform(hInput, dwIn,
hOutput, dwOut,
hProof, Intent,
ProofingIntent,
dwFlags);
}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:96,代码来源:icctrans.c
示例19: OpenTransforms
// Creates all needed color transforms
static
cmsBool OpenTransforms(void)
{
cmsHPROFILE hInput, hOutput, hProof;
cmsUInt32Number dwIn, dwOut, dwFlags;
cmsNAMEDCOLORLIST* List;
int i;
// We don't need cache
dwFlags = cmsFLAGS_NOCACHE;
if (lIsDeviceLink) {
hInput = OpenStockProfile(0, cInProf);
if (hInput == NULL) return FALSE;
hOutput = NULL;
hProof = NULL;
if (cmsGetDeviceClass(hInput) == cmsSigNamedColorClass) {
OutputColorSpace = cmsGetColorSpace(hInput);
InputColorSpace = cmsGetPCS(hInput);
}
else {
InputColorSpace = cmsGetColorSpace(hInput);
OutputColorSpace = cmsGetPCS(hInput);
}
// Read colorant tables if present
if (cmsIsTag(hInput, cmsSigColorantTableTag)) {
List = cmsReadTag(hInput, cmsSigColorantTableTag);
InputColorant = cmsDupNamedColorList(List);
InputRange = 1;
}
else InputColorant = ComponentNames(InputColorSpace, TRUE);
if (cmsIsTag(hInput, cmsSigColorantTableOutTag)){
List = cmsReadTag(hInput, cmsSigColorantTableOutTag);
OutputColorant = cmsDupNamedColorList(List);
OutputRange = 1;
}
else OutputColorant = ComponentNames(OutputColorSpace, FALSE);
}
else {
hInput = OpenStockProfile(0, cInProf);
if (hInput == NULL) return FALSE;
hOutput = OpenStockProfile(0, cOutProf);
if (hOutput == NULL) return FALSE;
hProof = NULL;
if (cmsGetDeviceClass(hInput) == cmsSigLinkClass ||
cmsGetDeviceClass(hOutput) == cmsSigLinkClass)
FatalError("Use %cl flag for devicelink profiles!\n", SW);
InputColorSpace = cmsGetColorSpace(hInput);
OutputColorSpace = cmsGetColorSpace(hOutput);
// Read colorant tables if present
if (cmsIsTag(hInput, cmsSigColorantTableTag)) {
List = cmsReadTag(hInput, cmsSigColorantTableTag);
InputColorant = cmsDupNamedColorList(List);
if (cmsNamedColorCount(InputColorant) <= 3)
SetRange(255, TRUE);
else
SetRange(1, TRUE); // Inks are already divided by 100 in the formatter
}
else InputColorant = ComponentNames(InputColorSpace, TRUE);
if (cmsIsTag(hOutput, cmsSigColorantTableTag)){
List = cmsReadTag(hOutput, cmsSigColorantTableTag);
OutputColorant = cmsDupNamedColorList(List);
if (cmsNamedColorCount(OutputColorant) <= 3)
SetRange(255, FALSE);
else
SetRange(1, FALSE); // Inks are already divided by 100 in the formatter
}
else OutputColorant = ComponentNames(OutputColorSpace, FALSE);
if (cProofing != NULL) {
hProof = OpenStockProfile(0, cProofing);
if (hProof == NULL) return FALSE;
dwFlags |= cmsFLAGS_SOFTPROOFING;
}
}
// Print information on profiles
if (Verbose > 2) {
printf("Profile:\n");
PrintProfileInformation(hInput);
//.........这里部分代码省略.........
开发者ID:TestingBytes,项目名称:Little-CMS,代码行数:101,代码来源:transicc.c
示例20: _cmsReadDevicelinkLUT
// This one includes abstract profiles as well. Matrix-shaper cannot be obtained on that device class. The
// tag name here may default to AToB0
cmsPipeline* _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, int Intent)
{
cmsPipeline* Lut;
cmsTagTypeSignature OriginalType;
cmsTagSignature tag16;
cmsTagSignature tagFloat;
cmsContext ContextID = cmsGetProfileContextID(hProfile);
if (Intent < INTENT_PERCEPTUAL || Intent > INTENT_ABSOLUTE_COLORIMETRIC)
return NULL;
tag16 = Device2PCS16[Intent];
tagFloat = Device2PCSFloat[Intent];
// On named color, take the appropriate tag
if (cmsGetDeviceClass(hProfile) == cmsSigNamedColorClass) {
cmsNAMEDCOLORLIST* nc = (cmsNAMEDCOLORLIST*)cmsReadTag(hProfile, cmsSigNamedColor2Tag);
if (nc == NULL) return NULL;
Lut = cmsPipelineAlloc(ContextID, 0, 0);
if (Lut == NULL)
goto Error;
if (!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocNamedColor(nc, FALSE)))
goto Error;
if (cmsGetColorSpace(hProfile) == cmsSigLabData)
if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
goto Error;
return Lut;
Error:
cmsPipelineFree(Lut);
cmsFreeNamedColorList(nc);
return NULL;
}
if (cmsIsTag(hProfile, tagFloat)) { // Float tag takes precedence
// Floating point LUT are always V
return _cmsReadFloatDevicelinkTag(hProfile, tagFloat);
}
tagFloat = Device2PCSFloat[0];
if (cmsIsTag(hProfile, tagFloat)) {
return cmsPipelineDup((cmsPipeline*)cmsReadTag(hProfile, tagFloat));
}
if (!cmsIsTag(hProfile, tag16)) { // Is there any LUT-Based table?
tag16 = Device2PCS16[0];
if (!cmsIsTag(hProfile, tag16)) return NULL;
}
// Check profile version and LUT type. Do the necessary adjustments if needed
// Read the tag
Lut = (cmsPipeline*)cmsReadTag(hProfile, tag16);
if (Lut == NULL) return NULL;
// The profile owns the Lut, so we need to copy it
Lut = cmsPipelineDup(Lut);
if (Lut == NULL) return NULL;
// Now it is time for a controversial stuff. I found that for 3D LUTS using
// Lab used as indexer space, trilinear interpolation should be used
if (cmsGetPCS(hProfile) == cmsSigLabData)
ChangeInterpolationToTrilinear(Lut);
// After reading it, we have info about the original type
OriginalType = _cmsGetTagTrueType(hProfile, tag16);
// We need to adjust data for Lab16 on output
if (OriginalType != cmsSigLut16Type) return Lut;
// Here it is possible to get Lab on both sides
if (cmsGetColorSpace(hProfile) == cmsSigLabData) {
if (!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
goto Error2;
}
if (cmsGetPCS(hProfile) == cmsSigLabData) {
if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
goto Error2;
}
return Lut;
Error2:
cmsPipelineFree(Lut);
return NULL;
}
开发者ID:AndresPozo,项目名称:PCL,代码行数:100,代码来源:cmsio1.c
注:本文中的cmsGetPCS函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论