Пример #1
0
DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj)
{
	CPDF_Page* pPage = (CPDF_Page*)page;
	if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || !pPage->m_pFormDict->GetElement("Type")->GetDirect()
		|| pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare("Page"))
	{
		return;
	}
	CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj;
	if(pPageObj == NULL)
		return;
	FX_POSITION LastPersition = pPage->GetLastObjectPosition();

	pPage->InsertObject(LastPersition, pPageObj);
	switch(pPageObj->m_Type)
	{
	case FPDF_PAGEOBJ_PATH:
		{
			CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj;
			pPathObj->CalcBoundingBox();
			break;
		}
	case FPDF_PAGEOBJ_TEXT:
		{
			//	CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj;
			//	pPathObj->CalcBoundingBox();
			break;
		}
	case FPDF_PAGEOBJ_IMAGE:
		{
			CPDF_ImageObject* pImageObj = (CPDF_ImageObject*)pPageObj;
			pImageObj->CalcBoundingBox();
			break;
		}
	case FPDF_PAGEOBJ_SHADING:
		{
			CPDF_ShadingObject* pShadingObj = (CPDF_ShadingObject*)pPageObj;
			pShadingObj->CalcBoundingBox();
			break;
		}
	case FPDF_PAGEOBJ_FORM:
		{
			CPDF_FormObject* pFormObj = (CPDF_FormObject*)pPageObj;
			pFormObj->CalcBoundingBox();
			break;
		}
	default:
		break;
	}

	//	pPage->ParseContent();
	//pPage->GenerateContent();

}
Пример #2
0
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;
}
Пример #3
0
DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
                                             FPDF_PAGEOBJECT page_obj) {
  CPDF_PageObject* pPageObj = reinterpret_cast<CPDF_PageObject*>(page_obj);
  if (!pPageObj)
    return;

  std::unique_ptr<CPDF_PageObject> pPageObjHolder(pPageObj);
  CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
  if (!IsPageObject(pPage))
    return;

  pPage->GetPageObjectList()->push_back(std::move(pPageObjHolder));
  switch (pPageObj->GetType()) {
    case CPDF_PageObject::TEXT: {
      break;
    }
    case CPDF_PageObject::PATH: {
      CPDF_PathObject* pPathObj = pPageObj->AsPath();
      pPathObj->CalcBoundingBox();
      break;
    }
    case CPDF_PageObject::IMAGE: {
      CPDF_ImageObject* pImageObj = pPageObj->AsImage();
      pImageObj->CalcBoundingBox();
      break;
    }
    case CPDF_PageObject::SHADING: {
      CPDF_ShadingObject* pShadingObj = pPageObj->AsShading();
      pShadingObj->CalcBoundingBox();
      break;
    }
    case CPDF_PageObject::FORM: {
      CPDF_FormObject* pFormObj = pPageObj->AsForm();
      pFormObj->CalcBoundingBox();
      break;
    }
    default: {
      ASSERT(false);
      break;
    }
  }
}