// Copyright 2016 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef CORE_FPDFAPI_PAGE_CPDF_TRANSFERFUNC_H_ #define CORE_FPDFAPI_PAGE_CPDF_TRANSFERFUNC_H_ #include #include "core/fxcrt/observed_ptr.h" #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" #include "core/fxge/fx_dib.h" #include "third_party/base/span.h" class CPDF_Document; class CFX_DIBBase; class CPDF_TransferFunc final : public Retainable, public Observable { public: template friend RetainPtr pdfium::MakeRetain(Args&&... args); static constexpr size_t kChannelSampleSize = 256; FX_COLORREF TranslateColor(FX_COLORREF colorref) const; RetainPtr TranslateImage(const RetainPtr& pSrc); const CPDF_Document* GetDocument() const { return m_pPDFDoc.Get(); } // Spans are |kChannelSampleSize| in size. pdfium::span GetSamplesR() const; pdfium::span GetSamplesG() const; pdfium::span GetSamplesB() const; bool GetIdentity() const { return m_bIdentity; } private: CPDF_TransferFunc(CPDF_Document* pDoc, bool bIdentify, std::vector samples_r, std::vector samples_g, std::vector samples_b); ~CPDF_TransferFunc() override; UnownedPtr const m_pPDFDoc; const bool m_bIdentity; const std::vector m_SamplesR; const std::vector m_SamplesG; const std::vector m_SamplesB; }; #endif // CORE_FPDFAPI_PAGE_CPDF_TRANSFERFUNC_H_