Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_transferfunc.cpp
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
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#include "core/fpdfapi/page/cpdf_transferfunc.h"
8
9#include <stdint.h>
10
11#include <utility>
12
13#include "core/fpdfapi/page/cpdf_transferfuncdib.h"
14#include "core/fpdfapi/parser/cpdf_document.h"
15#include "core/fxcrt/fixed_size_data_vector.h"
16#include "core/fxge/dib/cfx_dibbase.h"
17#include "third_party/base/check_op.h"
18
19CPDF_TransferFunc::CPDF_TransferFunc(bool bIdentify,
20 FixedSizeDataVector<uint8_t> samples_r,
21 FixedSizeDataVector<uint8_t> samples_g,
22 FixedSizeDataVector<uint8_t> samples_b)
23 : m_bIdentity(bIdentify),
24 m_SamplesR(std::move(samples_r)),
25 m_SamplesG(std::move(samples_g)),
26 m_SamplesB(std::move(samples_b)) {
27 DCHECK_EQ(m_SamplesR.size(), kChannelSampleSize);
28 DCHECK_EQ(m_SamplesG.size(), kChannelSampleSize);
29 DCHECK_EQ(m_SamplesB.size(), kChannelSampleSize);
30}
31
32CPDF_TransferFunc::~CPDF_TransferFunc() = default;
33
34FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF colorref) const {
35 return FXSYS_BGR(m_SamplesB.span()[FXSYS_GetBValue(colorref)],
36 m_SamplesG.span()[FXSYS_GetGValue(colorref)],
37 m_SamplesR.span()[FXSYS_GetRValue(colorref)]);
38}
39
41 RetainPtr<CFX_DIBBase> pSrc) {
42 return pdfium::MakeRetain<CPDF_TransferFuncDIB>(std::move(pSrc),
43 pdfium::WrapRetain(this));
44}
45
46pdfium::span<const uint8_t> CPDF_TransferFunc::GetSamplesR() const {
47 return m_SamplesR;
48}
49
50pdfium::span<const uint8_t> CPDF_TransferFunc::GetSamplesG() const {
51 return m_SamplesG;
52}
53
54pdfium::span<const uint8_t> CPDF_TransferFunc::GetSamplesB() const {
55 return m_SamplesB;
56}
~CPDF_TransferFunc() override
pdfium::span< const uint8_t > GetSamplesR() const
RetainPtr< CFX_DIBBase > TranslateImage(RetainPtr< CFX_DIBBase > pSrc)
pdfium::span< const uint8_t > GetSamplesB() const
FX_COLORREF TranslateColor(FX_COLORREF colorref) const
pdfium::span< const uint8_t > GetSamplesG() const