コード例 #1
0
ファイル: fpdf_page_doc.cpp プロジェクト: Gottox/pdfium
CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream)
{
    if (!pImageStream) {
        return NULL;
    }
    FX_DWORD dwImageObjNum = pImageStream->GetObjNum();
    CPDF_CountedObject<CPDF_Image*>* imageData;
    if (m_ImageMap.Lookup(dwImageObjNum, imageData)) {
        imageData->m_nCount ++;
        return imageData->m_Obj;
    }
    imageData = FX_NEW CPDF_CountedObject<CPDF_Image*>;
    if (!imageData) {
        return NULL;
    }
    CPDF_Image* pImage = FX_NEW CPDF_Image(m_pPDFDoc);
    if (!pImage) {
        delete imageData;
        return NULL;
    }
    pImage->LoadImageF((CPDF_Stream*)pImageStream, FALSE);
    imageData->m_nCount = 2;
    imageData->m_Obj = pImage;
    m_ImageMap.SetAt(dwImageObjNum, imageData);
    return pImage;
}
コード例 #2
0
CPDF_Image* CPDF_Image::Clone() {
  if (m_pStream->GetObjNum())
    return m_pDocument->GetPageData()->GetImage(m_pStream);

  CPDF_Image* pImage = new CPDF_Image(m_pDocument);
  pImage->LoadImageF(ToStream(m_pStream->CPDF_Object::Clone()), m_bInline);
  if (m_bInline)
    pImage->SetInlineDict(ToDictionary(m_pInlineDict->Clone(TRUE)));

  return pImage;
}
コード例 #3
0
ファイル: fpdf_page_image.cpp プロジェクト: 151706061/PDFium
CPDF_Image* CPDF_Image::Clone()
{
    if (m_pStream->GetObjNum()) {
        return m_pDocument->GetPageData()->GetImage(m_pStream);
    }
    CPDF_Image* pImage = FX_NEW CPDF_Image(m_pDocument);
    pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(), m_bInline);
    if (m_bInline) {
        CPDF_Dictionary *pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(TRUE);
        pImage->SetInlineDict(pInlineDict);
    }
    return pImage;
}
コード例 #4
0
ファイル: fpdf_page_doc.cpp プロジェクト: JinAirsOs/pdfium
CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) {
  if (!pImageStream)
    return nullptr;

  const FX_DWORD dwImageObjNum = pImageStream->GetObjNum();
  auto it = m_ImageMap.find(dwImageObjNum);
  if (it != m_ImageMap.end()) {
    return it->second->AddRef();
  }

  CPDF_Image* pImage = new CPDF_Image(m_pPDFDoc);
  pImage->LoadImageF(pImageStream->AsStream(), FALSE);

  CPDF_CountedImage* imageData = new CPDF_CountedImage(pImage);
  m_ImageMap[dwImageObjNum] = imageData;
  return imageData->AddRef();
}
コード例 #5
0
void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf,
                                             CPDF_ImageObject* pImageObj) {
  if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) ||
      (pImageObj->m_Matrix.c == 0 && pImageObj->m_Matrix.d == 0)) {
    return;
  }
  buf << "q " << pImageObj->m_Matrix << " cm ";
  CPDF_Image* pImage = pImageObj->GetImage();
  if (!pImage->IsInline()) {
    CPDF_Stream* pStream = pImage->GetStream();
    uint32_t dwSavedObjNum = pStream->GetObjNum();
    CFX_ByteString name = RealizeResource(pStream, "XObject");
    if (dwSavedObjNum == 0) {
      pImageObj->SetUnownedImage(m_pDocument->GetPageData()->GetImage(pStream));
    }
    buf << "/" << PDF_NameEncode(name) << " Do Q\n";
  }
}