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_SHADINGOBJECT_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_SHADINGOBJECT_H_
9 
10 #include "core/fpdfapi/page/cpdf_pageobject.h"
11 #include "core/fxcrt/fx_coordinates.h"
12 #include "core/fxcrt/unowned_ptr.h"
13 
14 class CPDF_ShadingPattern;
15 
16 class CPDF_ShadingObject : public CPDF_PageObject {
17  public:
18   CPDF_ShadingObject(CPDF_ShadingPattern* pattern, const CFX_Matrix& matrix);
19   ~CPDF_ShadingObject() override;
20 
21   // CPDF_PageObject:
22   Type GetType() const override;
23   void Transform(const CFX_Matrix& matrix) override;
24   bool IsShading() const override;
25   CPDF_ShadingObject* AsShading() override;
26   const CPDF_ShadingObject* AsShading() const override;
27 
28   void CalcBoundingBox();
29 
30   const CPDF_ShadingPattern* pattern() const { return m_pShading.Get(); }
31   const CFX_Matrix& matrix() const { return m_Matrix; }
32 
33  private:
34   UnownedPtr<CPDF_ShadingPattern> m_pShading;
35   CFX_Matrix m_Matrix;
36 };
37 
38 #endif  // CORE_FPDFAPI_PAGE_CPDF_SHADINGOBJECT_H_
39