本文整理汇总了C++中CPDF_Dictionary::GetArrayBy方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Dictionary::GetArrayBy方法的具体用法?C++ CPDF_Dictionary::GetArrayBy怎么用?C++ CPDF_Dictionary::GetArrayBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Dictionary
的用法示例。
在下文中一共展示了CPDF_Dictionary::GetArrayBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CPDFPageFromFPDFPage
DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
FPDF_CLIPPATH clipPath) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return;
CPDF_Dictionary* pPageDic = pPage->m_pFormDict;
CPDF_Object* pContentObj =
pPageDic ? pPageDic->GetObjectBy("Contents") : nullptr;
if (!pContentObj)
pContentObj = pPageDic ? pPageDic->GetArrayBy("Contents") : nullptr;
if (!pContentObj)
return;
CFX_ByteTextBuf strClip;
CPDF_ClipPath* pClipPath = (CPDF_ClipPath*)clipPath;
uint32_t i;
for (i = 0; i < pClipPath->GetPathCount(); i++) {
CPDF_Path path = pClipPath->GetPath(i);
int iClipType = pClipPath->GetClipType(i);
if (path.GetPointCount() == 0) {
// Empty clipping (totally clipped out)
strClip << "0 0 m W n ";
} else {
OutputPath(strClip, path);
if (iClipType == FXFILL_WINDING)
strClip << "W n\n";
else
strClip << "W* n\n";
}
}
CPDF_Dictionary* pDic = new CPDF_Dictionary;
CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic);
pStream->SetData(strClip.GetBuffer(), strClip.GetSize(), FALSE, FALSE);
CPDF_Document* pDoc = pPage->m_pDocument;
if (!pDoc)
return;
pDoc->AddIndirectObject(pStream);
CPDF_Array* pContentArray = nullptr;
CPDF_Array* pArray = ToArray(pContentObj);
if (pArray) {
pContentArray = pArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
} else if (CPDF_Reference* pReference = ToReference(pContentObj)) {
CPDF_Object* pDirectObj = pReference->GetDirect();
if (pDirectObj) {
CPDF_Array* pObjArray = pDirectObj->AsArray();
if (pObjArray) {
pContentArray = pObjArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
} else if (pDirectObj->IsStream()) {
pContentArray = new CPDF_Array();
pContentArray->AddReference(pDoc, pStream->GetObjNum());
pContentArray->AddReference(pDoc, pDirectObj->GetObjNum());
pPageDic->SetAtReference("Contents", pDoc,
pDoc->AddIndirectObject(pContentArray));
}
}
}
}