OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_ | 7 #ifndef CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_ |
8 #define CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_ | 8 #define CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "core/fpdfapi/page/cpdf_pageobject.h" | 12 #include "core/fpdfapi/page/cpdf_pageobject.h" |
13 #include "core/fxcrt/fx_coordinates.h" | 13 #include "core/fxcrt/fx_coordinates.h" |
14 | 14 |
15 class CPDF_Image; | 15 class CPDF_Image; |
16 | 16 |
17 class CPDF_ImageObject : public CPDF_PageObject { | 17 class CPDF_ImageObject : public CPDF_PageObject { |
18 public: | 18 public: |
19 CPDF_ImageObject(); | 19 CPDF_ImageObject(); |
20 ~CPDF_ImageObject() override; | 20 ~CPDF_ImageObject() override; |
21 | 21 |
22 // CPDF_PageObject | 22 // CPDF_PageObject |
23 CPDF_ImageObject* Clone() const override; | |
24 Type GetType() const override; | 23 Type GetType() const override; |
25 void Transform(const CFX_Matrix& matrix) override; | 24 void Transform(const CFX_Matrix& matrix) override; |
26 bool IsImage() const override; | 25 bool IsImage() const override; |
27 CPDF_ImageObject* AsImage() override; | 26 CPDF_ImageObject* AsImage() override; |
28 const CPDF_ImageObject* AsImage() const override; | 27 const CPDF_ImageObject* AsImage() const override; |
29 | 28 |
30 void CalcBoundingBox(); | 29 void CalcBoundingBox(); |
31 CPDF_Image* GetImage() const { return m_pImage; } | 30 CPDF_Image* GetImage() const { return m_pImage; } |
32 void SetOwnedImage(std::unique_ptr<CPDF_Image> pImage); | 31 void SetOwnedImage(std::unique_ptr<CPDF_Image> pImage); |
33 void SetUnownedImage(CPDF_Image* pImage); | 32 void SetUnownedImage(CPDF_Image* pImage); |
34 | 33 |
35 void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; } | 34 void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; } |
36 const CFX_Matrix& matrix() const { return m_Matrix; } | 35 const CFX_Matrix& matrix() const { return m_Matrix; } |
37 | 36 |
38 private: | 37 private: |
39 void Release(); | 38 void Release(); |
40 | 39 |
41 CFX_Matrix m_Matrix; | 40 CFX_Matrix m_Matrix; |
42 CPDF_Image* m_pImage; | 41 CPDF_Image* m_pImage; |
43 bool m_pImageOwned; | 42 bool m_pImageOwned; |
44 }; | 43 }; |
45 | 44 |
46 #endif // CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_ | 45 #endif // CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_ |
OLD | NEW |