• 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_PATTERN_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_PATTERN_H_
9 
10 #include "core/fxcrt/fx_coordinates.h"
11 #include "core/fxcrt/fx_system.h"
12 #include "core/fxcrt/observed_ptr.h"
13 #include "core/fxcrt/retain_ptr.h"
14 #include "core/fxcrt/unowned_ptr.h"
15 
16 class CPDF_Document;
17 class CPDF_Object;
18 class CPDF_ShadingPattern;
19 class CPDF_TilingPattern;
20 
21 class CPDF_Pattern : public Retainable, public Observable {
22  public:
23   // Values used in PDFs. Do not change.
24   enum PatternType { kTiling = 1, kShading = 2 };
25 
26   ~CPDF_Pattern() override;
27 
28   virtual CPDF_TilingPattern* AsTilingPattern();
29   virtual CPDF_ShadingPattern* AsShadingPattern();
30 
31   // All the getters that return pointers return non-NULL pointers.
document()32   CPDF_Document* document() const { return m_pDocument.Get(); }
pattern_obj()33   CPDF_Object* pattern_obj() const { return m_pPatternObj.Get(); }
pattern_to_form()34   const CFX_Matrix& pattern_to_form() const { return m_Pattern2Form; }
parent_matrix()35   const CFX_Matrix& parent_matrix() const { return m_ParentMatrix; }
36 
37  protected:
38   CPDF_Pattern(CPDF_Document* pDoc,
39                CPDF_Object* pObj,
40                const CFX_Matrix& parentMatrix);
41 
42   void SetPatternToFormMatrix();
43 
44  private:
45   UnownedPtr<CPDF_Document> const m_pDocument;
46   RetainPtr<CPDF_Object> const m_pPatternObj;
47   CFX_Matrix m_Pattern2Form;
48   const CFX_Matrix m_ParentMatrix;
49 };
50 
51 #endif  // CORE_FPDFAPI_PAGE_CPDF_PATTERN_H_
52