Home | History | Annotate | Download | only in render
      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_RENDER_CPDF_TRANSFERFUNC_H_
      8 #define CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_
      9 
     10 #include "core/fxcrt/retain_ptr.h"
     11 #include "core/fxcrt/unowned_ptr.h"
     12 #include "core/fxge/fx_dib.h"
     13 
     14 class CPDF_Document;
     15 class CFX_DIBSource;
     16 
     17 class CPDF_TransferFunc : public Retainable {
     18  public:
     19   template <typename T, typename... Args>
     20   friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
     21 
     22   FX_COLORREF TranslateColor(FX_COLORREF src) const;
     23   RetainPtr<CFX_DIBSource> TranslateImage(const RetainPtr<CFX_DIBSource>& pSrc);
     24 
     25   const CPDF_Document* GetDocument() const { return m_pPDFDoc.Get(); }
     26 
     27   const uint8_t* GetSamples() const { return m_Samples; }
     28   uint8_t* GetSamples() { return m_Samples; }
     29 
     30   bool GetIdentity() const { return m_bIdentity; }
     31   void SetIdentity(bool identity) { m_bIdentity = identity; }
     32 
     33  private:
     34   explicit CPDF_TransferFunc(CPDF_Document* pDoc);
     35   ~CPDF_TransferFunc() override;
     36 
     37   UnownedPtr<CPDF_Document> const m_pPDFDoc;
     38   bool m_bIdentity;
     39   uint8_t m_Samples[256 * 3];
     40 };
     41 
     42 #endif  // CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_
     43