本文整理汇总了C++中cmsSignalError函数的典型用法代码示例。如果您正苦于以下问题:C++ cmsSignalError函数的具体用法?C++ cmsSignalError怎么用?C++ cmsSignalError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cmsSignalError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPoint
// Auxiliar to retrieve a pointer to the segmentr containing the Lab value
static
cmsGDBPoint* GetPoint(cmsGDB* gbd, const cmsCIELab* Lab, cmsSpherical* sp)
{
cmsVEC3 v;
int alpha, theta;
// Housekeeping
_cmsAssert(gbd != NULL);
_cmsAssert(Lab != NULL);
_cmsAssert(sp != NULL);
// Center L* by substracting half of its domain, that's 50
_cmsVEC3init(&v, Lab ->L - 50.0, Lab ->a, Lab ->b);
// Convert to spherical coordinates
ToSpherical(sp, &v);
if (sp ->r < 0 || sp ->alpha < 0 || sp->theta < 0) {
cmsSignalError(gbd ->ContextID, cmsERROR_RANGE, "spherical value out of range");
return NULL;
}
// On which sector it falls?
QuantizeToSector(sp, &alpha, &theta);
if (alpha < 0 || theta < 0 || alpha >= SECTORS || theta >= SECTORS) {
cmsSignalError(gbd ->ContextID, cmsERROR_RANGE, " quadrant out of range");
return NULL;
}
// Get pointer to the sector
return &gbd ->Gamut[theta][alpha];
}
示例2: _cmsLinkProfiles
// Chain several profiles into a single LUT. It just checks the parameters and then calls the handler
// for the first intent in chain. The handler may be user-defined. Is up to the handler to deal with the
// rest of intents in chain. A maximum of 255 profiles at time are supported, which is pretty reasonable.
cmsPipeline* _cmsLinkProfiles(cmsContext ContextID,
cmsUInt32Number nProfiles,
cmsUInt32Number TheIntents[],
cmsHPROFILE hProfiles[],
cmsBool BPC[],
cmsFloat64Number AdaptationStates[],
cmsUInt32Number dwFlags)
{
cmsUInt32Number i;
cmsIntentsList* Intent;
// Make sure a reasonable number of profiles is provided
if (nProfiles <= 0 || nProfiles > 255) {
cmsSignalError(ContextID, cmsERROR_RANGE, "Couldn't link '%d' profiles", nProfiles);
return NULL;
}
for (i=0; i < nProfiles; i++) {
// Check if black point is really needed or allowed. Note that
// following Adobe's document:
// BPC does not apply to devicelink profiles, nor to abs colorimetric,
// and applies always on V4 perceptual and saturation.
if (TheIntents[i] == INTENT_ABSOLUTE_COLORIMETRIC)
BPC[i] = FALSE;
if (TheIntents[i] == INTENT_PERCEPTUAL || TheIntents[i] == INTENT_SATURATION) {
// Force BPC for V4 profiles in perceptual and saturation
if (cmsGetProfileVersion(hProfiles[i]) >= 4.0)
BPC[i] = TRUE;
}
}
// Search for a handler. The first intent in the chain defines the handler. That would
// prevent using multiple custom intents in a multiintent chain, but the behaviour of
// this case would present some issues if the custom intent tries to do things like
// preserve primaries. This solution is not perfect, but works well on most cases.
Intent = SearchIntent(TheIntents[0]);
if (Intent == NULL) {
cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported intent '%d'", TheIntents[0]);
return NULL;
}
// Call the handler
return Intent ->Link(ContextID, nProfiles, TheIntents, hProfiles, BPC, AdaptationStates, dwFlags);
}
示例3: cmsIsCLUT
// Returns TRUE if the intent is implemented as CLUT
cmsBool CMSEXPORT cmsIsCLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number UsedDirection)
{
const cmsTagSignature* TagTable;
// For devicelinks, the supported intent is that one stated in the header
if (cmsGetDeviceClass(hProfile) == cmsSigLinkClass) {
return (cmsGetHeaderRenderingIntent(hProfile) == Intent);
}
switch (UsedDirection) {
case LCMS_USED_AS_INPUT: TagTable = Device2PCS16; break;
case LCMS_USED_AS_OUTPUT:TagTable = PCS2Device16; break;
// For proofing, we need rel. colorimetric in output. Let's do some recursion
case LCMS_USED_AS_PROOF:
return cmsIsIntentSupported(hProfile, Intent, LCMS_USED_AS_INPUT) &&
cmsIsIntentSupported(hProfile, INTENT_RELATIVE_COLORIMETRIC, LCMS_USED_AS_OUTPUT);
default:
cmsSignalError(cmsGetProfileContextID(hProfile), cmsERROR_RANGE, "Unexpected direction (%d)", UsedDirection);
return FALSE;
}
return cmsIsTag(hProfile, TagTable[Intent]);
}
示例4: _cmsCreateProfileFromMemPlaceholder
LPLCMSICCPROFILE _cmsCreateProfileFromMemPlaceholder(LPVOID MemPtr, DWORD dwSize)
{
LPLCMSICCPROFILE NewIcc;
LPVOID ICCfile = MemoryOpen((LPBYTE) MemPtr, (size_t) dwSize, 'r');
if (ICCfile == NULL) {
cmsSignalError(LCMS_ERRC_ABORTED, "Couldn't allocate %ld bytes for profile", dwSize);
return NULL;
}
NewIcc = (LPLCMSICCPROFILE) _cmsCreateProfilePlaceholder();
if (NewIcc == NULL) return NULL;
NewIcc -> PhysicalFile[0] = 0;
NewIcc ->stream = ICCfile;
NewIcc ->Read = MemoryRead;
NewIcc ->Seek = MemorySeek;
NewIcc ->Tell = MemoryTell;
NewIcc ->Close = MemoryClose;
NewIcc ->Grow = MemoryGrow;
NewIcc ->Write = MemoryWrite;
NewIcc ->IsWrite = FALSE;
return NewIcc;
}
示例5: _cmsCreateProfileFromFilePlaceholder
LPLCMSICCPROFILE _cmsCreateProfileFromFilePlaceholder(const char* FileName)
{
LPLCMSICCPROFILE NewIcc;
LPVOID ICCfile = FileOpen(FileName);
if (ICCfile == NULL) {
cmsSignalError(LCMS_ERRC_ABORTED, "File '%s' not found", FileName);
return NULL;
}
NewIcc = (LPLCMSICCPROFILE) _cmsCreateProfilePlaceholder();
if (NewIcc == NULL) return NULL;
strncpy(NewIcc -> PhysicalFile, FileName, MAX_PATH-1);
NewIcc -> PhysicalFile[MAX_PATH-1] = 0;
NewIcc ->stream = ICCfile;
NewIcc ->Read = FileRead;
NewIcc ->Seek = FileSeek;
NewIcc ->Tell = FileTell;
NewIcc ->Close = FileClose;
NewIcc ->Grow = FileGrow;
NewIcc ->Write = NULL;
NewIcc ->IsWrite = FALSE;
return NewIcc;
}
示例6: cmsBuildParametricToneCurve
// Parametric curves
//
// Parameters goes as: Curve, a, b, c, d, e, f
// Type is the ICC type +1
// if type is negative, then the curve is analyticaly inverted
cmsToneCurve* CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[])
{
cmsCurveSegment Seg0;
int Pos = 0;
cmsUInt32Number size;
_cmsParametricCurvesCollection* c = GetParametricCurveByType(Type, &Pos);
_cmsAssert(Params != NULL);
if (c == NULL) {
cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Invalid parametric curve type %d", Type);
return NULL;
}
memset(&Seg0, 0, sizeof(Seg0));
Seg0.x0 = MINUS_INF;
Seg0.x1 = PLUS_INF;
Seg0.Type = Type;
size = c->ParameterCount[Pos] * sizeof(cmsFloat64Number);
memmove(Seg0.Params, Params, size);
return cmsBuildSegmentedToneCurve(ContextID, 1, &Seg0);
}
示例7: WriteInputMatrixShaper
static
int WriteInputMatrixShaper(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsStage* Matrix, cmsStage* Shaper)
{
cmsColorSpaceSignature ColorSpace;
int rc;
cmsCIEXYZ BlackPointAdaptedToD50;
ColorSpace = cmsGetColorSpace(hProfile);
cmsDetectBlackPoint(&BlackPointAdaptedToD50, hProfile, INTENT_RELATIVE_COLORIMETRIC, 0);
if (ColorSpace == cmsSigGrayData) {
cmsToneCurve** ShaperCurve = _cmsStageGetPtrToCurveSet(Shaper);
rc = EmitCIEBasedA(m, ShaperCurve[0], &BlackPointAdaptedToD50);
}
else
if (ColorSpace == cmsSigRgbData) {
rc = EmitCIEBasedABC(m, GetPtrToMatrix(Matrix),
_cmsStageGetPtrToCurveSet(Shaper),
&BlackPointAdaptedToD50);
}
else {
cmsSignalError(m ->ContextID, cmsERROR_COLORSPACE_CHECK, "Profile is not suitable for CSA. Unsupported colorspace.");
return 0;
}
return rc;
}
示例8: cmsxIT8SetDataSet
BOOL cmsxIT8SetDataSet(LCMSHANDLE hIT8, const char* cPatch,
const char* cSample,
char *Val)
{
LPIT8 it8 = (LPIT8) hIT8;
int iField, iSet;
iField = LocateSample(it8, cSample);
if (iField < 0) {
cmsSignalError(LCMS_ERRC_ABORTED, "Couldn't find data field %s\n", cSample);
return false;
}
if (it8-> nPatches == 0) {
AllocateDataFormat(it8);
AllocateDataSet(it8);
CookPointers(it8);
}
if (stricmp(cSample, "SAMPLE_ID") == 0)
{
iSet = LocateEmptyPatch(it8, cPatch);
if (iSet < 0) {
cmsSignalError(LCMS_ERRC_ABORTED, "Couldn't add more patches '%s'\n", cPatch);
return false;
}
iField = it8 -> SampleID;
}
else {
iSet = LocatePatch(it8, cPatch);
if (iSet < 0) {
cmsSignalError(LCMS_ERRC_ABORTED, "Couldn't find patch '%s'\n", cPatch);
return false;
}
}
return SetData(it8, iSet, iField, Val);
}
示例9: cmsFreeNamedColorList
void cmsFreeNamedColorList(LPcmsNAMEDCOLORLIST v)
{
if (v == NULL) {
cmsSignalError(LCMS_ERRC_RECOVERABLE, "Couldn't free a NULL named color list");
return;
}
_cmsFree(v);
}
示例10: FileSeek
static
LCMSBOOL FileSeek(struct _lcms_iccprofile_struct* Icc, size_t offset)
{
if (fseek((FILE*) Icc ->stream, (long) offset, SEEK_SET) != 0) {
cmsSignalError(LCMS_ERRC_ABORTED, "Seek error; probably corrupted file");
return TRUE;
}
return FALSE;
}
示例11: FileRead
static
size_t FileRead(void *buffer, size_t size, size_t count, struct _lcms_iccprofile_struct* Icc)
{
size_t nReaded = fread(buffer, size, count, (FILE*) Icc->stream);
if (nReaded != count) {
cmsSignalError(LCMS_ERRC_ABORTED, "Read error. Got %d bytes, block should be of %d bytes", nReaded * size, count * size);
return 0;
}
return nReaded;
}
示例12: DataFormatSection
static
BOOL DataFormatSection(LPIT8 it8)
{
int iField = 0;
BOOL Ignoring = false;
InSymbol(it8); /* Eats "BEGIN_DATA_FORMAT" */
CheckEOLN(it8);
while (it8->sy != SEND_DATA_FORMAT &&
it8->sy != SEOLN &&
it8->sy != SEOF &&
it8->sy != SSYNERROR)
{
if (it8->sy != SIDENT) {
cmsSignalError(LCMS_ERRC_ABORTED, "Sample type expected");
it8->sy = SSYNERROR;
return false;
}
if (!Ignoring && iField > it8->nSamples) {
cmsSignalError(LCMS_ERRC_WARNING, "More than NUMBER_OF_FIELDS fields. Extra is ignored\n");
Ignoring = true;
}
else {
if (!SetDataFormat(it8, iField, it8->id)) return false;
iField++;
}
InSymbol(it8);
Skip(it8, SEOLN);
}
Skip(it8, SEOLN);
Skip(it8, SEND_DATA_FORMAT);
Skip(it8, SEOLN);
return true;
}
示例13: AddToList
/* Add a property into a linked list */
static
BOOL AddToList(LPIT8 it8, LPKEYVALUE* Head, const char *Key, const char* Value)
{
LPKEYVALUE p;
LPKEYVALUE last;
/* Check if property is already in list (this is an error) */
if (IsAvailableOnList(*Head, Key, &last)) {
cmsSignalError(LCMS_ERRC_ABORTED, "duplicate key <%s>", Key);
return false;
}
/* Allocate the container */
p = (LPKEYVALUE) AllocChunk(it8, sizeof(KEYVALUE));
if (p == NULL)
{
cmsSignalError(LCMS_ERRC_ABORTED, "AddToList: out of memory");
return false;
}
/* Store name and value */
p->Keyword = AllocString(it8, Key);
if (Value)
p->Value = AllocString(it8, Value);
else
p->Value = NULL;
p->Next = NULL;
/* Keep the container in our list */
if (*Head == NULL)
*Head = p;
else
last->Next = p;
return true;
}
示例14: MemorySeek
static
LCMSBOOL MemorySeek(struct _lcms_iccprofile_struct* Icc, size_t offset)
{
FILEMEM* ResData = (FILEMEM*) Icc ->stream;
if (offset > ResData ->Size) {
cmsSignalError(LCMS_ERRC_ABORTED, "Pointer error; probably corrupted file");
return TRUE;
}
ResData ->Pointer = (DWORD) offset;
return FALSE;
}
示例15: cmsWhitePointFromTemp
BOOL LCMSEXPORT cmsWhitePointFromTemp(int TempK, LPcmsCIExyY WhitePoint)
{
double x, y;
double T, T2, T3;
// double M1, M2;
// No optimization provided.
T = TempK;
T2 = T*T; // Square
T3 = T2*T; // Cube
// For correlated color temperature (T) between 4000K and 7000K:
if (T >= 4000. && T <= 7000.)
{
x = -4.6070*(1E9/T3) + 2.9678*(1E6/T2) + 0.09911*(1E3/T) + 0.244063;
}
else
// or for correlated color temperature (T) between 7000K and 25000K:
if (T > 7000.0 && T <= 25000.0)
{
x = -2.0064*(1E9/T3) + 1.9018*(1E6/T2) + 0.24748*(1E3/T) + 0.237040;
}
else {
cmsSignalError(LCMS_ERRC_ABORTED, "cmsWhitePointFromTemp: invalid temp");
return FALSE;
}
// Obtain y(x)
y = -3.000*(x*x) + 2.870*x - 0.275;
// wave factors (not used, but here for futures extensions)
// M1 = (-1.3515 - 1.7703*x + 5.9114 *y)/(0.0241 + 0.2562*x - 0.7341*y);
// M2 = (0.0300 - 31.4424*x + 30.0717*y)/(0.0241 + 0.2562*x - 0.7341*y);
// Fill WhitePoint struct
WhitePoint -> x = x;
WhitePoint -> y = y;
WhitePoint -> Y = 1.0;
return TRUE;
}