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"
11 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document)
15 CPDF_ImageObject* pImageObj = FX_NEW CPDF_ImageObject;
16 CPDF_Image* pImg = FX_NEW CPDF_Image((CPDF_Document *)document);
17 pImageObj->m_pImage = pImg;
21 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCount,FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess)
23 if (!image_object || !fileAccess)
26 IFX_FileRead* pFile = FX_NEW CPDF_CustomAccess(fileAccess);
28 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
29 pImgObj->m_GeneralState.GetModify();
30 for (int index=0;index<nCount;index++)
32 CPDF_Page* pPage = (CPDF_Page*)pages[index];
33 pImgObj->m_pImage->ResetCache(pPage,NULL);
35 pImgObj->m_pImage->SetJpegImage(pFile);
41 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix (FPDF_PAGEOBJECT image_object,
42 double a, double b, double c, double d, double e, double f)
46 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
47 pImgObj->m_Matrix.a = (FX_FLOAT)a;
48 pImgObj->m_Matrix.b = (FX_FLOAT)b;
49 pImgObj->m_Matrix.c = (FX_FLOAT)c;
50 pImgObj->m_Matrix.d = (FX_FLOAT)d;
51 pImgObj->m_Matrix.e = (FX_FLOAT)e;
52 pImgObj->m_Matrix.f = (FX_FLOAT)f;
53 pImgObj->CalcBoundingBox();
57 DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,FPDF_PAGEOBJECT image_object,FPDF_BITMAP bitmap)
59 if (!image_object || !bitmap)
61 CFX_DIBitmap* pBmp = NULL;
62 pBmp = (CFX_DIBitmap*)bitmap;
63 CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
64 pImgObj->m_GeneralState.GetModify();
65 for (int index=0;index<nCount;index++)
67 CPDF_Page* pPage = (CPDF_Page*)pages[index];
68 pImgObj->m_pImage->ResetCache(pPage,NULL);
70 pImgObj->m_pImage->SetImage(pBmp,FALSE);
71 pImgObj->CalcBoundingBox();