本文整理汇总了C++中CPDF_DocPageData类的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_DocPageData类的具体用法?C++ CPDF_DocPageData怎么用?C++ CPDF_DocPageData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPDF_DocPageData类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: FX_Free
void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps)
{
if (ncomps > MAX_PATTERN_COLORCOMPS) {
return;
}
if (m_pCS == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) {
if (m_pBuffer) {
FX_Free(m_pBuffer);
}
m_pCS = CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN);
m_pBuffer = m_pCS->CreateBuf();
}
CPDF_DocPageData *pDocPageData = NULL;
PatternValue* pvalue = (PatternValue*)m_pBuffer;
if (pvalue->m_pPattern && pvalue->m_pPattern->m_pDocument) {
pDocPageData = pvalue->m_pPattern->m_pDocument->GetPageData();
if (pDocPageData) {
pDocPageData->ReleasePattern(pvalue->m_pPattern->m_pPatternObj);
}
}
pvalue->m_nComps = ncomps;
pvalue->m_pPattern = pPattern;
if (ncomps) {
FXSYS_memcpy(pvalue->m_Comps, comps, ncomps * sizeof(FX_FLOAT));
}
pvalue->m_pCountedPattern = NULL;
if (pPattern && pPattern->m_pDocument)
{
if (!pDocPageData) {
pDocPageData = pPattern->m_pDocument->GetPageData();
}
pvalue->m_pCountedPattern = pDocPageData->FindPatternPtr(pPattern->m_pPatternObj);
}
}
示例3: if
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;
}
示例4: CopyData
void CPDF_ShadingObject::CopyData(const CPDF_PageObject* pSrc)
{
CPDF_ShadingObject* pSrcObj = (CPDF_ShadingObject*)pSrc;
m_pShading = pSrcObj->m_pShading;
if (m_pShading && m_pShading->m_pDocument) {
CPDF_DocPageData* pDocPageData = m_pShading->m_pDocument->GetPageData();
m_pShading = (CPDF_ShadingPattern*)pDocPageData->GetPattern(m_pShading->m_pShadingObj, m_pShading->m_bShadingObj, &m_pShading->m_ParentMatrix);
}
m_Matrix = pSrcObj->m_Matrix;
}
示例5: Clone
CPDF_ShadingObject* CPDF_ShadingObject::Clone() const {
CPDF_ShadingObject* obj = new CPDF_ShadingObject;
obj->CopyData(this);
obj->m_pShading = m_pShading;
if (obj->m_pShading && obj->m_pShading->document()) {
CPDF_DocPageData* pDocPageData = obj->m_pShading->document()->GetPageData();
CPDF_Pattern* pattern = pDocPageData->GetPattern(
obj->m_pShading->GetShadingObject(), m_pShading->IsShadingObject(),
obj->m_pShading->parent_matrix());
obj->m_pShading = pattern ? pattern->AsShadingPattern() : nullptr;
}
obj->m_Matrix = m_Matrix;
return obj;
}
示例6: ReleaseBuffer
void CPDF_Color::ReleaseBuffer()
{
if (!m_pBuffer) {
return;
}
if (m_pCS->GetFamily() == PDFCS_PATTERN) {
PatternValue* pvalue = (PatternValue*)m_pBuffer;
CPDF_Pattern* pPattern = pvalue->m_pCountedPattern ? pvalue->m_pCountedPattern->get() : NULL;
if (pPattern && pPattern->m_pDocument) {
CPDF_DocPageData *pPageData = pPattern->m_pDocument->GetPageData();
if (pPageData) {
pPageData->ReleasePattern(pPattern->m_pPatternObj);
}
}
}
FX_Free(m_pBuffer);
m_pBuffer = NULL;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}