本文整理汇总了C++中CPDF_StreamAcc::LoadAllData方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_StreamAcc::LoadAllData方法的具体用法?C++ CPDF_StreamAcc::LoadAllData怎么用?C++ CPDF_StreamAcc::LoadAllData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_StreamAcc
的用法示例。
在下文中一共展示了CPDF_StreamAcc::LoadAllData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetIccProfile
CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(
CPDF_Stream* pIccProfileStream) {
if (!pIccProfileStream)
return NULL;
auto it = m_IccProfileMap.find(pIccProfileStream);
if (it != m_IccProfileMap.end()) {
return it->second->AddRef();
}
CPDF_StreamAcc stream;
stream.LoadAllData(pIccProfileStream, FALSE);
uint8_t digest[20];
CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest);
auto hash_it = m_HashProfileMap.find(CFX_ByteStringC(digest, 20));
if (hash_it != m_HashProfileMap.end()) {
auto it_copied_stream = m_IccProfileMap.find(hash_it->second);
return it_copied_stream->second->AddRef();
}
CPDF_IccProfile* pProfile =
new CPDF_IccProfile(stream.GetData(), stream.GetSize());
CPDF_CountedIccProfile* ipData = new CPDF_CountedIccProfile(pProfile);
m_IccProfileMap[pIccProfileStream] = ipData;
m_HashProfileMap[CFX_ByteStringC(digest, 20)] = pIccProfileStream;
return ipData->AddRef();
}
示例2: GetFontFileStreamAcc
CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(CPDF_Stream* pFontStream)
{
if (!pFontStream) {
return NULL;
}
CPDF_CountedObject<CPDF_StreamAcc*>* ftData;
if (m_FontFileMap.Lookup(pFontStream, ftData)) {
ftData->m_nCount ++;
return ftData->m_Obj;
}
ftData = FX_NEW CPDF_CountedObject<CPDF_StreamAcc*>;
if (!ftData) {
return NULL;
}
CPDF_StreamAcc* pFontFile = FX_NEW CPDF_StreamAcc;
if (!pFontFile) {
delete ftData;
return NULL;
}
CPDF_Dictionary* pFontDict = pFontStream->GetDict();
FX_INT32 org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->GetInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3"));
if (org_size < 0) {
org_size = 0;
}
pFontFile->LoadAllData(pFontStream, FALSE, org_size);
ftData->m_nCount = 2;
ftData->m_Obj = pFontFile;
m_FontFileMap.SetAt(pFontStream, ftData);
return pFontFile;
}
示例3: 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;
}
示例4: LoadDoc
void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc)
{
FXSYS_assert(pDoc != NULL);
((PDFDOC_LPMETADATA)m_pData)->m_pDoc = pDoc;
CPDF_Dictionary *pRoot = pDoc->GetRoot();
CPDF_Stream *pStream = pRoot->GetStream(FX_BSTRC("Metadata"));
if (!pStream) {
return;
}
CPDF_StreamAcc acc;
acc.LoadAllData(pStream, FALSE);
int size = acc.GetSize();
FX_LPCBYTE pBuf = acc.GetData();
CXML_Element *&pXmlElmnt = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt;
pXmlElmnt = CXML_Element::Parse(pBuf, size);
if (!pXmlElmnt) {
return;
}
CXML_Element *&pElmntRdf = ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf;
if (pXmlElmnt->GetTagName() == FX_BSTRC("RDF")) {
pElmntRdf = pXmlElmnt;
} else {
pElmntRdf = pXmlElmnt->GetElement(NULL, FX_BSTRC("RDF"));
}
}
示例5: GetIccProfile
CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(CPDF_Stream* pIccProfileStream, FX_INT32 nComponents)
{
if (!pIccProfileStream) {
return NULL;
}
CPDF_CountedObject<CPDF_IccProfile*>* ipData = NULL;
if (m_IccProfileMap.Lookup(pIccProfileStream, ipData)) {
ipData->m_nCount++;
return ipData->m_Obj;
}
CPDF_StreamAcc stream;
stream.LoadAllData(pIccProfileStream, FALSE);
FX_BYTE digest[20];
CPDF_Stream* pCopiedStream = NULL;
CRYPT_SHA1Generate(stream.GetData(), stream.GetSize(), digest);
if (m_HashProfileMap.Lookup(CFX_ByteStringC(digest, 20), (void*&)pCopiedStream)) {
m_IccProfileMap.Lookup(pCopiedStream, ipData);
ipData->m_nCount++;
return ipData->m_Obj;
}
CPDF_IccProfile* pProfile = FX_NEW CPDF_IccProfile(stream.GetData(), stream.GetSize(), nComponents);
if (!pProfile) {
return NULL;
}
ipData = FX_NEW CPDF_CountedObject<CPDF_IccProfile*>;
if (!ipData) {
delete pProfile;
return NULL;
}
ipData->m_nCount = 2;
ipData->m_Obj = pProfile;
m_IccProfileMap.SetAt(pIccProfileStream, ipData);
m_HashProfileMap.SetAt(CFX_ByteStringC(digest, 20), pIccProfileStream);
return pProfile;
}
示例6: v_Init
FX_BOOL CPDF_PSFunc::v_Init(CPDF_Object* pObj)
{
CPDF_Stream* pStream = (CPDF_Stream*)pObj;
CPDF_StreamAcc acc;
acc.LoadAllData(pStream, FALSE);
return m_PS.Parse((const FX_CHAR*)acc.GetData(), acc.GetSize());
}
示例7: Clone
CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, FX_LPVOID pUserData) const
{
CPDF_Dictionary *pCloneDict = (CPDF_Dictionary*)m_pDict->Clone(bDirect);
IFX_FileStream *pFS = NULL;
if (lpfCallback) {
pFS = lpfCallback((CPDF_Stream*)this, pUserData);
}
if (!pFS) {
CPDF_StreamAcc acc;
acc.LoadAllData(this, TRUE);
FX_DWORD streamSize = acc.GetSize();
return new CPDF_Stream(acc.DetachData(), streamSize, pCloneDict);
}
CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL);
CPDF_StreamFilter *pSF = GetStreamFilter(TRUE);
if (pSF) {
FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, 4096);
FX_DWORD dwRead;
do {
dwRead = pSF->ReadBlock(pBuf, 4096);
if (dwRead) {
pFS->WriteBlock(pBuf, dwRead);
}
} while (dwRead == 4096);
pFS->Flush();
FX_Free(pBuf);
delete pSF;
}
pObj->InitStream((IFX_FileRead*)pFS, pCloneDict);
return pObj;
}
示例8: v_Init
FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
if (pObj->GetType() != PDFOBJ_STREAM) {
return FALSE;
}
CPDF_Stream* pStream = (CPDF_Stream*)pObj;
CPDF_Dictionary* pDict = pStream->GetDict();
CPDF_Array* pSize = pDict->GetArray(FX_BSTRC("Size"));
CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode"));
CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample"));
if (m_nBitsPerSample > 32) {
return FALSE;
}
m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample);
m_pSampleStream = new CPDF_StreamAcc;
m_pSampleStream->LoadAllData(pStream, FALSE);
m_pEncodeInfo = FX_Alloc(SampleEncodeInfo, m_nInputs);
FX_SAFE_DWORD nTotalSampleBits = 1;
for (int i = 0; i < m_nInputs; i++) {
m_pEncodeInfo[i].sizes = pSize ? pSize->GetInteger(i) : 0;
if (!pSize && i == 0) {
m_pEncodeInfo[i].sizes = pDict->GetInteger(FX_BSTRC("Size"));
}
nTotalSampleBits *= m_pEncodeInfo[i].sizes;
if (pEncode) {
m_pEncodeInfo[i].encode_min = pEncode->GetFloat(i * 2);
m_pEncodeInfo[i].encode_max = pEncode->GetFloat(i * 2 + 1);
} else {
m_pEncodeInfo[i].encode_min = 0;
if (m_pEncodeInfo[i].sizes == 1) {
m_pEncodeInfo[i].encode_max = 1;
} else {
m_pEncodeInfo[i].encode_max = (FX_FLOAT)m_pEncodeInfo[i].sizes - 1;
}
}
}
nTotalSampleBits *= m_nBitsPerSample;
nTotalSampleBits *= m_nOutputs;
FX_SAFE_DWORD nTotalSampleBytes = nTotalSampleBits;
nTotalSampleBytes += 7;
nTotalSampleBytes /= 8;
if (!nTotalSampleBytes.IsValid() || nTotalSampleBytes.ValueOrDie() == 0 ||
nTotalSampleBytes.ValueOrDie() > m_pSampleStream->GetSize()) {
return FALSE;
}
m_pDecodeInfo = FX_Alloc(SampleDecodeInfo, m_nOutputs);
for (int i = 0; i < m_nOutputs; i++) {
if (pDecode) {
m_pDecodeInfo[i].decode_min = pDecode->GetFloat(2 * i);
m_pDecodeInfo[i].decode_max = pDecode->GetFloat(2 * i + 1);
} else {
m_pDecodeInfo[i].decode_min = m_pRanges[i * 2];
m_pDecodeInfo[i].decode_max = m_pRanges[i * 2 + 1];
}
}
return TRUE;
}
示例9: AddForm
void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) {
if (!m_Options.m_bSeparateForm) {
CPDF_Dictionary* pResources = pStream->GetDict()->GetDict("Resources");
CFX_Matrix form_matrix = pStream->GetDict()->GetMatrix("Matrix");
form_matrix.Concat(m_pCurStates->m_CTM);
CPDF_Array* pBBox = pStream->GetDict()->GetArray("BBox");
CFX_FloatRect form_bbox;
CPDF_Path ClipPath;
if (pBBox) {
form_bbox = pStream->GetDict()->GetRect("BBox");
ClipPath.New();
ClipPath.AppendRect(form_bbox.left, form_bbox.bottom, form_bbox.right,
form_bbox.top);
ClipPath.Transform(&form_matrix);
form_bbox.Transform(&form_matrix);
}
CPDF_StreamContentParser parser(m_pDocument, m_pPageResources, m_pResources,
&m_mtContentToUser, m_pObjectList,
pResources, &form_bbox, &m_Options,
m_pCurStates.get(), m_Level + 1);
parser.m_pCurStates->m_CTM = form_matrix;
if (ClipPath.NotNull()) {
parser.m_pCurStates->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING,
TRUE);
}
CPDF_StreamAcc stream;
stream.LoadAllData(pStream, FALSE);
if (stream.GetSize() == 0) {
return;
}
parser.Parse(stream.GetData(), stream.GetSize(), 0);
return;
}
CPDF_FormObject* pFormObj = new CPDF_FormObject;
pFormObj->m_pForm =
new CPDF_Form(m_pDocument, m_pPageResources, pStream, m_pResources);
pFormObj->m_FormMatrix = m_pCurStates->m_CTM;
pFormObj->m_FormMatrix.Concat(m_mtContentToUser);
CPDF_AllStates status;
status.m_GeneralState = m_pCurStates->m_GeneralState;
status.m_GraphState = m_pCurStates->m_GraphState;
status.m_ColorState = m_pCurStates->m_ColorState;
status.m_TextState = m_pCurStates->m_TextState;
pFormObj->m_pForm->ParseContent(&status, NULL, NULL, &m_Options, m_Level + 1);
if (!m_pObjectList->m_bBackgroundAlphaNeeded &&
pFormObj->m_pForm->m_bBackgroundAlphaNeeded) {
m_pObjectList->m_bBackgroundAlphaNeeded = TRUE;
}
pFormObj->CalcBoundingBox();
SetGraphicStates(pFormObj, TRUE, TRUE, TRUE);
m_pObjectList->m_ObjectList.AddTail(pFormObj);
}
示例10: GetUnicodeText
CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const
{
if (m_Type == PDFOBJ_STRING) {
return PDF_DecodeText(((CPDF_String*)this)->m_String, pCharMap);
} else if (m_Type == PDFOBJ_STREAM) {
CPDF_StreamAcc stream;
stream.LoadAllData((CPDF_Stream*)this, FALSE);
CFX_WideString result = PDF_DecodeText(stream.GetData(), stream.GetSize(), pCharMap);
return result;
} else if (m_Type == PDFOBJ_NAME) {
return PDF_DecodeText(((CPDF_Name*)this)->m_Name, pCharMap);
}
return CFX_WideString();
}
示例11: GetUnicodeText
CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const {
if (const CPDF_String* pString = AsString())
return PDF_DecodeText(pString->m_String, pCharMap);
if (const CPDF_Stream* pStream = AsStream()) {
CPDF_StreamAcc stream;
stream.LoadAllData(pStream, FALSE);
CFX_WideString result =
PDF_DecodeText(stream.GetData(), stream.GetSize(), pCharMap);
return result;
}
if (const CPDF_Name* pName = AsName())
return PDF_DecodeText(pName->m_Name, pCharMap);
return CFX_WideString();
}
示例12: CloneNonCyclic
CPDF_Object* CPDF_Stream::CloneNonCyclic(
bool bDirect,
std::set<const CPDF_Object*>* pVisited) const {
pVisited->insert(this);
CPDF_StreamAcc acc;
acc.LoadAllData(this, TRUE);
uint32_t streamSize = acc.GetSize();
CPDF_Dictionary* pDict = GetDict();
if (pDict && !pdfium::ContainsKey(*pVisited, pDict)) {
pDict = ToDictionary(
static_cast<CPDF_Object*>(pDict)->CloneNonCyclic(bDirect, pVisited));
}
return new CPDF_Stream(acc.DetachData(), streamSize, pDict);
}
示例13: GetFontFileStreamAcc
CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(
CPDF_Stream* pFontStream) {
ASSERT(pFontStream);
auto it = m_FontFileMap.find(pFontStream);
if (it != m_FontFileMap.end())
return it->second->AddRef();
CPDF_Dictionary* pFontDict = pFontStream->GetDict();
int32_t org_size = pFontDict->GetIntegerBy("Length1") +
pFontDict->GetIntegerBy("Length2") +
pFontDict->GetIntegerBy("Length3");
if (org_size < 0)
org_size = 0;
CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc;
pFontFile->LoadAllData(pFontStream, FALSE, org_size);
CPDF_CountedStreamAcc* ftData = new CPDF_CountedStreamAcc(pFontFile);
m_FontFileMap[pFontStream] = ftData;
return ftData->AddRef();
}
示例14: 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;
}
示例15: if
//.........这里部分代码省略.........
if (!pAnnotAP)continue;
CPDF_Stream* pAPStream = pAnnotAP->GetStream("N");
if (!pAPStream)
{
CPDF_Dictionary* pAPDic = pAnnotAP->GetDict("N");
if (!pAPDic)continue;
if (!sAnnotState.IsEmpty())
{
pAPStream = pAPDic->GetStream(sAnnotState);
}
else
{
FX_POSITION pos = pAPDic->GetStartPos();
if (pos)
{
CFX_ByteString sKey;
CPDF_Object* pFirstObj = pAPDic->GetNextElement(pos, sKey);
if (pFirstObj)
{
if (pFirstObj->GetType() == PDFOBJ_REFERENCE)
pFirstObj = pFirstObj->GetDirect();
if (pFirstObj->GetType() != PDFOBJ_STREAM)
continue;
pAPStream = (CPDF_Stream*)pFirstObj;
}
}
}
}
if (!pAPStream)continue;
CPDF_Dictionary* pAPDic = pAPStream->GetDict();
CFX_AffineMatrix matrix = pAPDic->GetMatrix("Matrix");
CPDF_Rect rcStream;
if (pAPDic->KeyExist("Rect"))
rcStream = pAPDic->GetRect("Rect");
else if (pAPDic->KeyExist("BBox"))
rcStream = pAPDic->GetRect("BBox");
if (rcStream.IsEmpty())continue;
CPDF_Object* pObj = pAPStream;
if (pObj)
{
CPDF_Dictionary* pObjDic = pObj->GetDict();
if (pObjDic)
{
pObjDic->SetAtName("Type", "XObject");
pObjDic->SetAtName("Subtype", "Form");
}
}
CPDF_Dictionary* pXObject = pNewXORes->GetDict("XObject");
if (!pXObject)
{
pXObject = FX_NEW CPDF_Dictionary;
pNewXORes->SetAt("XObject", pXObject);
}
CFX_ByteString sFormName;
sFormName.Format("F%d", i);
FX_DWORD dwObjNum = pDocument->AddIndirectObject(pObj);
pXObject->SetAtReference(sFormName, pDocument, dwObjNum);
CPDF_StreamAcc acc;
acc.LoadAllData(pNewXObject);
FX_LPCBYTE pData = acc.GetData();
CFX_ByteString sStream(pData, acc.GetSize());
CFX_ByteString sTemp;
if (matrix.IsIdentity())
{
matrix.a = 1.0f;
matrix.b = 0.0f;
matrix.c = 0.0f;
matrix.d = 1.0f;
matrix.e = 0.0f;
matrix.f = 0.0f;
}
CFX_AffineMatrix m = GetMatrix(rcAnnot, rcStream, matrix);
sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, sFormName.c_str());
sStream += sTemp;
pNewXObject->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE);
}
pPageDict->RemoveAt( "Annots" );
ObjectArray.RemoveAll();
RectArray.RemoveAll();
return FLATTEN_SUCCESS;
}