本文整理汇总了C++中CFX_ByteString::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteString::GetID方法的具体用法?C++ CFX_ByteString::GetID怎么用?C++ CFX_ByteString::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_ByteString
的用法示例。
在下文中一共展示了CFX_ByteString::GetID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj)
{
if (pObj == NULL) {
return NULL;
}
if (pObj->GetType() == PDFOBJ_NAME) {
return _CSFromName(pObj->GetString());
}
if (pObj->GetType() == PDFOBJ_STREAM) {
CPDF_Dictionary *pDict = ((CPDF_Stream *)pObj)->GetDict();
if (!pDict) {
return NULL;
}
CPDF_ColorSpace *pRet = NULL;
FX_POSITION pos = pDict->GetStartPos();
while (pos) {
CFX_ByteString bsKey;
CPDF_Object *pValue = pDict->GetNextElement(pos, bsKey);
if (pValue && pValue->GetType() == PDFOBJ_NAME) {
pRet = _CSFromName(pValue->GetString());
}
if (pRet) {
return pRet;
}
}
return NULL;
}
if (pObj->GetType() != PDFOBJ_ARRAY) {
return NULL;
}
CPDF_Array* pArray = (CPDF_Array*)pObj;
if (pArray->GetCount() == 0) {
return NULL;
}
CPDF_Object *pFamilyObj = pArray->GetElementValue(0);
if (!pFamilyObj) {
return NULL;
}
CFX_ByteString familyname = pFamilyObj->GetString();
if (pArray->GetCount() == 1) {
return _CSFromName(familyname);
}
CPDF_ColorSpace* pCS = NULL;
FX_DWORD id = familyname.GetID();
if (id == FXBSTR_ID('C', 'a', 'l', 'G')) {
pCS = new CPDF_CalGray(pDoc);
} else if (id == FXBSTR_ID('C', 'a', 'l', 'R')) {
pCS = new CPDF_CalRGB(pDoc);
} else if (id == FXBSTR_ID('L', 'a', 'b', 0)) {
pCS = new CPDF_LabCS(pDoc);
} else if (id == FXBSTR_ID('I', 'C', 'C', 'B')) {
pCS = new CPDF_ICCBasedCS(pDoc);
} else if (id == FXBSTR_ID('I', 'n', 'd', 'e') || id == FXBSTR_ID('I', 0, 0, 0)) {
pCS = new CPDF_IndexedCS(pDoc);
} else if (id == FXBSTR_ID('S', 'e', 'p', 'a')) {
pCS = new CPDF_SeparationCS(pDoc);
} else if (id == FXBSTR_ID('D', 'e', 'v', 'i')) {
pCS = new CPDF_DeviceNCS(pDoc);
} else if (id == FXBSTR_ID('P', 'a', 't', 't')) {
pCS = new CPDF_PatternCS(pDoc);
} else {
return NULL;
}
pCS->m_pArray = pArray;
if (!pCS->v_Load(pDoc, pArray)) {
pCS->ReleaseCS();
return NULL;
}
return pCS;
}
示例2: Load
CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) {
if (!pObj)
return nullptr;
if (pObj->IsName())
return _CSFromName(pObj->GetString());
if (CPDF_Stream* pStream = pObj->AsStream()) {
CPDF_Dictionary* pDict = pStream->GetDict();
if (!pDict)
return nullptr;
for (const auto& it : *pDict) {
CPDF_ColorSpace* pRet = nullptr;
CPDF_Object* pValue = it.second;
if (ToName(pValue))
pRet = _CSFromName(pValue->GetString());
if (pRet)
return pRet;
}
return nullptr;
}
CPDF_Array* pArray = pObj->AsArray();
if (!pArray || pArray->GetCount() == 0)
return nullptr;
CPDF_Object* pFamilyObj = pArray->GetElementValue(0);
if (!pFamilyObj)
return nullptr;
CFX_ByteString familyname = pFamilyObj->GetString();
if (pArray->GetCount() == 1)
return _CSFromName(familyname);
CPDF_ColorSpace* pCS = NULL;
FX_DWORD id = familyname.GetID();
if (id == FXBSTR_ID('C', 'a', 'l', 'G')) {
pCS = new CPDF_CalGray(pDoc);
} else if (id == FXBSTR_ID('C', 'a', 'l', 'R')) {
pCS = new CPDF_CalRGB(pDoc);
} else if (id == FXBSTR_ID('L', 'a', 'b', 0)) {
pCS = new CPDF_LabCS(pDoc);
} else if (id == FXBSTR_ID('I', 'C', 'C', 'B')) {
pCS = new CPDF_ICCBasedCS(pDoc);
} else if (id == FXBSTR_ID('I', 'n', 'd', 'e') ||
id == FXBSTR_ID('I', 0, 0, 0)) {
pCS = new CPDF_IndexedCS(pDoc);
} else if (id == FXBSTR_ID('S', 'e', 'p', 'a')) {
pCS = new CPDF_SeparationCS(pDoc);
} else if (id == FXBSTR_ID('D', 'e', 'v', 'i')) {
pCS = new CPDF_DeviceNCS(pDoc);
} else if (id == FXBSTR_ID('P', 'a', 't', 't')) {
pCS = new CPDF_PatternCS(pDoc);
} else {
return NULL;
}
pCS->m_pArray = pArray;
if (!pCS->v_Load(pDoc, pArray)) {
pCS->ReleaseCS();
return NULL;
}
return pCS;
}