DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, int nCount, FPDF_PAGEOBJECT image_object, FPDF_BITMAP bitmap) { if (!image_object || !bitmap || !pages) return false; CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); for (int index = 0; index < nCount; index++) { CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); if (pPage) pImgObj->GetImage()->ResetCache(pPage, nullptr); } pImgObj->GetImage()->SetImage(reinterpret_cast<CFX_DIBitmap*>(bitmap), false); pImgObj->CalcBoundingBox(); return true; }
DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCount, FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess) { if (!image_object || !fileAccess || !pages) return false; IFX_SeekableReadStream* pFile = new CPDF_CustomAccess(fileAccess); CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); for (int index = 0; index < nCount; index++) { CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); if (pPage) pImgObj->GetImage()->ResetCache(pPage, nullptr); } pImgObj->GetImage()->SetJpegImage(pFile); return true; }