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 <memory>
11
12#include "core/fpdfapi/page/cpdf_pageobject.h"
13#include "core/fxcrt/fx_coordinates.h"
14
15class CPDF_Image;
16
17class CPDF_ImageObject : public CPDF_PageObject {
18 public:
19  CPDF_ImageObject();
20  ~CPDF_ImageObject() override;
21
22  // CPDF_PageObject
23  Type GetType() const override;
24  void Transform(const CFX_Matrix& matrix) override;
25  bool IsImage() const override;
26  CPDF_ImageObject* AsImage() override;
27  const CPDF_ImageObject* AsImage() const override;
28
29  void CalcBoundingBox();
30  RetainPtr<CPDF_Image> GetImage() const { return m_pImage; }
31  void SetImage(const RetainPtr<CPDF_Image>& pImage);
32  void set_matrix(const CFX_Matrix& matrix) { m_Matrix = matrix; }
33  const CFX_Matrix& matrix() const { return m_Matrix; }
34
35 private:
36  void MaybePurgeCache();
37
38  CFX_Matrix m_Matrix;
39  RetainPtr<CPDF_Image> m_pImage;
40};
41
42#endif  // CORE_FPDFAPI_PAGE_CPDF_IMAGEOBJECT_H_
43