1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
7 #include "../include/fsdk_define.h"
8 #include "../include/fpdfedit.h"
9 #include "../include/fpdfxfa/fpdfxfa_doc.h"
10 #include "../include/fpdfxfa/fpdfxfa_page.h"
13 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document)
17 CPDF_ImageObject* pImageObj = FX_NEW CPDF_ImageObject;
18 CPDF_Image* pImg = FX_NEW CPDF_Image(((CPDFXFA_Document *)document)->GetPDFDoc());
19 pImageObj->m_pImage = pImg;
23 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCount,FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess)
25 if (!image_object || !fileAccess || !pages)
28 IFX_FileRead* pFile = FX_NEW CPDF_CustomAccess(fileAccess);
30 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
31 pImgObj->m_GeneralState.GetModify();
32 for (int index=0;index<nCount;index++)
34 CPDF_Page* pPage = ((CPDFXFA_Page*)pages[index])->GetPDFPage();
37 pImgObj->m_pImage->ResetCache(pPage,NULL);
39 pImgObj->m_pImage->SetJpegImage(pFile);
45 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix (FPDF_PAGEOBJECT image_object,
46 double a, double b, double c, double d, double e, double f)
50 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
51 pImgObj->m_Matrix.a = (FX_FLOAT)a;
52 pImgObj->m_Matrix.b = (FX_FLOAT)b;
53 pImgObj->m_Matrix.c = (FX_FLOAT)c;
54 pImgObj->m_Matrix.d = (FX_FLOAT)d;
55 pImgObj->m_Matrix.e = (FX_FLOAT)e;
56 pImgObj->m_Matrix.f = (FX_FLOAT)f;
57 pImgObj->CalcBoundingBox();
61 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,FPDF_PAGEOBJECT image_object,FPDF_BITMAP bitmap)
63 if (!image_object || !bitmap || !pages)
65 CFX_DIBitmap* pBmp = NULL;
66 pBmp = (CFX_DIBitmap*)bitmap;
67 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
68 pImgObj->m_GeneralState.GetModify();
69 for (int index=0;index<nCount;index++)
71 CPDF_Page* pPage = ((CPDFXFA_Page*)pages[index])->GetPDFPage();
73 pImgObj->m_pImage->ResetCache(pPage,NULL);
75 pImgObj->m_pImage->SetImage(pBmp,FALSE);
76 pImgObj->CalcBoundingBox();