本文整理汇总了C++中CPDF_DocPageData::GetColorSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_DocPageData::GetColorSpace方法的具体用法?C++ CPDF_DocPageData::GetColorSpace怎么用?C++ CPDF_DocPageData::GetColorSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_DocPageData
的用法示例。
在下文中一共展示了CPDF_DocPageData::GetColorSpace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadColorInfo
bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
const CPDF_Dictionary* pPageResources) {
m_bpc_orig = m_pDict->GetIntegerFor("BitsPerComponent");
if (m_pDict->GetIntegerFor("ImageMask"))
m_bImageMask = true;
if (m_bImageMask || !m_pDict->KeyExist("ColorSpace")) {
if (!m_bImageMask) {
CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter");
if (pFilter) {
CFX_ByteString filter;
if (pFilter->IsName()) {
filter = pFilter->GetString();
} else if (CPDF_Array* pArray = pFilter->AsArray()) {
filter = pArray->GetStringAt(pArray->GetCount() - 1);
}
if (filter == "JPXDecode") {
m_bDoBpcCheck = false;
return true;
}
}
}
m_bImageMask = true;
m_bpc = m_nComponents = 1;
CPDF_Array* pDecode = m_pDict->GetArrayFor("Decode");
m_bDefaultDecode = !pDecode || !pDecode->GetIntegerAt(0);
return true;
}
CPDF_Object* pCSObj = m_pDict->GetDirectObjectFor("ColorSpace");
if (!pCSObj)
return false;
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
if (pFormResources)
m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pFormResources);
if (!m_pColorSpace)
m_pColorSpace = pDocPageData->GetColorSpace(pCSObj, pPageResources);
if (!m_pColorSpace)
return false;
m_Family = m_pColorSpace->GetFamily();
m_nComponents = m_pColorSpace->CountComponents();
if (m_Family == PDFCS_ICCBASED && pCSObj->IsName()) {
CFX_ByteString cs = pCSObj->GetString();
if (cs == "DeviceGray") {
m_nComponents = 1;
} else if (cs == "DeviceRGB") {
m_nComponents = 3;
} else if (cs == "DeviceCMYK") {
m_nComponents = 4;
}
}
ValidateDictParam();
m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey);
return !!m_pCompData;
}
示例2: v_Load
FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
if (pArray->GetCount() < 4) {
return FALSE;
}
CPDF_Object* pBaseObj = pArray->GetElementValue(1);
if (pBaseObj == m_pArray) {
return FALSE;
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, NULL);
if (m_pBaseCS == NULL) {
return FALSE;
}
m_nBaseComponents = m_pBaseCS->CountComponents();
m_pCompMinMax = FX_Alloc(FX_FLOAT, m_nBaseComponents * 2);
FX_FLOAT defvalue;
for (int i = 0; i < m_nBaseComponents; i ++) {
m_pBaseCS->GetDefaultValue(i, defvalue, m_pCompMinMax[i * 2], m_pCompMinMax[i * 2 + 1]);
m_pCompMinMax[i * 2 + 1] -= m_pCompMinMax[i * 2];
}
m_MaxIndex = pArray->GetInteger(2);
CPDF_Object* pTableObj = pArray->GetElementValue(3);
if (pTableObj == NULL) {
return FALSE;
}
if (pTableObj->GetType() == PDFOBJ_STRING) {
m_Table = ((CPDF_String*)pTableObj)->GetString();
} else if (pTableObj->GetType() == PDFOBJ_STREAM) {
CPDF_StreamAcc acc;
acc.LoadAllData((CPDF_Stream*)pTableObj, FALSE);
m_Table = CFX_ByteStringC(acc.GetData(), acc.GetSize());
}
return TRUE;
}
示例3: Load
FX_BOOL CPDF_ShadingPattern::Load()
{
if (m_ShadingType != 0) {
return TRUE;
}
CPDF_Dictionary* pShadingDict = m_pShadingObj ? m_pShadingObj->GetDict() : NULL;
if (pShadingDict == NULL) {
return FALSE;
}
if (m_nFuncs) {
for (int i = 0; i < m_nFuncs; i ++)
if (m_pFunctions[i]) {
delete m_pFunctions[i];
}
m_nFuncs = 0;
}
CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function"));
if (pFunc) {
if (pFunc->GetType() == PDFOBJ_ARRAY) {
m_nFuncs = ((CPDF_Array*)pFunc)->GetCount();
if (m_nFuncs > 4) {
m_nFuncs = 4;
}
for (int i = 0; i < m_nFuncs; i ++) {
m_pFunctions[i] = CPDF_Function::Load(((CPDF_Array*)pFunc)->GetElementValue(i));
}
} else {
m_pFunctions[0] = CPDF_Function::Load(pFunc);
m_nFuncs = 1;
}
}
CPDF_Object* pCSObj = pShadingDict->GetElementValue(FX_BSTRC("ColorSpace"));
if (pCSObj == NULL) {
return FALSE;
}
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, NULL);
if (m_pCS) {
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
}
m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType"));
return TRUE;
}
示例4: v_Load
FX_BOOL CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Object* pBaseCS = pArray->GetElementValue(1);
if (pBaseCS == m_pArray) {
return FALSE;
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, NULL);
if (m_pBaseCS) {
if (m_pBaseCS->GetFamily() == PDFCS_PATTERN) {
return FALSE;
}
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
m_nComponents = m_pBaseCS->CountComponents() + 1;
if (m_pBaseCS->CountComponents() > MAX_PATTERN_COLORCOMPS) {
return FALSE;
}
} else {
m_nComponents = 1;
}
return TRUE;
}
示例5: Load
bool CPDF_ShadingPattern::Load() {
if (m_ShadingType != kInvalidShading)
return true;
CPDF_Dictionary* pShadingDict =
m_pShadingObj ? m_pShadingObj->GetDict() : nullptr;
if (!pShadingDict)
return false;
m_pFunctions.clear();
CPDF_Object* pFunc = pShadingDict->GetDirectObjectFor("Function");
if (pFunc) {
if (CPDF_Array* pArray = pFunc->AsArray()) {
m_pFunctions.resize(std::min<size_t>(pArray->GetCount(), 4));
for (size_t i = 0; i < m_pFunctions.size(); ++i)
m_pFunctions[i] = CPDF_Function::Load(pArray->GetDirectObjectAt(i));
} else {
m_pFunctions.push_back(CPDF_Function::Load(pFunc));
}
}
CPDF_Object* pCSObj = pShadingDict->GetDirectObjectFor("ColorSpace");
if (!pCSObj)
return false;
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
m_pCS = pDocPageData->GetColorSpace(pCSObj, nullptr);
if (m_pCS)
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
m_ShadingType = ToShadingType(pShadingDict->GetIntegerFor("ShadingType"));
// We expect to have a stream if our shading type is a mesh.
if (IsMeshShading() && !ToStream(m_pShadingObj))
return false;
return true;
}
示例6: v_Load
FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (pArray->GetCount() < 4) {
return FALSE;
}
CPDF_Object* pBaseObj = pArray->GetElementValue(1);
if (pBaseObj == m_pArray) {
return FALSE;
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, NULL);
if (!m_pBaseCS) {
return FALSE;
}
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
m_nBaseComponents = m_pBaseCS->CountComponents();
m_pCompMinMax = FX_Alloc2D(FX_FLOAT, m_nBaseComponents, 2);
FX_FLOAT defvalue;
for (int i = 0; i < m_nBaseComponents; i++) {
m_pBaseCS->GetDefaultValue(i, defvalue, m_pCompMinMax[i * 2],
m_pCompMinMax[i * 2 + 1]);
m_pCompMinMax[i * 2 + 1] -= m_pCompMinMax[i * 2];
}
m_MaxIndex = pArray->GetInteger(2);
CPDF_Object* pTableObj = pArray->GetElementValue(3);
if (!pTableObj)
return FALSE;
if (CPDF_String* pString = pTableObj->AsString()) {
m_Table = pString->GetString();
} else if (CPDF_Stream* pStream = pTableObj->AsStream()) {
CPDF_StreamAcc acc;
acc.LoadAllData(pStream, FALSE);
m_Table = CFX_ByteStringC(acc.GetData(), acc.GetSize());
}
return TRUE;
}