• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_
9 
10 #include "core/fpdfapi/page/cpdf_pageobject.h"
11 #include "core/fxcrt/fx_coordinates.h"
12 #include "core/fxcrt/retain_ptr.h"
13 
14 class CFX_DIBitmap;
15 class CPDF_Image;
16 
17 class CPDF_ImageObject final : public CPDF_PageObject {
18  public:
19   explicit CPDF_ImageObject(int32_t content_stream);
20   CPDF_ImageObject();
21   ~CPDF_ImageObject() override;
22 
23   // CPDF_PageObject
24   Type GetType() const override;
25   void Transform(const CFX_Matrix& matrix) override;
26   bool IsImage() const override;
27   CPDF_ImageObject* AsImage() override;
28   const CPDF_ImageObject* AsImage() const override;
29 
30   void CalcBoundingBox();
31   void SetImage(const RetainPtr<CPDF_Image>& pImage);
32   RetainPtr<CPDF_Image> GetImage() const;
33   RetainPtr<CFX_DIBitmap> GetIndependentBitmap() const;
34 
set_matrix(const CFX_Matrix & matrix)35   void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
matrix()36   const CFX_Matrix& matrix() const { return m_Matrix; }
37 
38  private:
39   void MaybePurgeCache();
40 
41   CFX_Matrix m_Matrix;
42   RetainPtr<CPDF_Image> m_pImage;
43 };
44 
45 #endif  // CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_
46