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_color_utils.cpp
Go to the documentation of this file.
1
// Copyright 2019 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/fpdfdoc/cpdf_color_utils.h"
8
9
#
include
"core/fpdfapi/parser/cpdf_array.h"
10
#
include
"core/fpdfdoc/cpdf_defaultappearance.h"
11
#
include
"core/fxcrt/bytestring.h"
12
#
include
"third_party/base/notreached.h"
13
14
namespace
fpdfdoc
{
15
16
CFX_Color
CFXColorFromArray
(
const
CPDF_Array& array) {
17
CFX_Color
rt;
18
switch
(array.size()) {
19
case
1:
20
rt
=
CFX_Color
(
CFX_Color
::
Type
::
kGray
, array.GetFloatAt(0));
21
break
;
22
case
3:
23
rt
=
CFX_Color
(
CFX_Color
::
Type
::
kRGB
, array.GetFloatAt(0),
24
array.GetFloatAt(1), array.GetFloatAt(2));
25
break
;
26
case
4:
27
rt
=
CFX_Color
(
CFX_Color
::
Type
::
kCMYK
, array.GetFloatAt(0),
28
array.GetFloatAt(1), array.GetFloatAt(2),
29
array.GetFloatAt(3));
30
break
;
31
}
32
return
rt;
33
}
34
35
CFX_Color
CFXColorFromString
(
const
ByteString& str) {
36
CPDF_DefaultAppearance
appearance
(
str
)
;
37
return
appearance.GetColor().value_or(
CFX_Color
(
)
);
38
}
39
40
}
// namespace fpdfdoc
CPDF_DefaultAppearance
Definition
cpdf_defaultappearance.h:16
CPDF_DefaultAppearance::CPDF_DefaultAppearance
CPDF_DefaultAppearance(const ByteString &csDA)
Definition
cpdf_defaultappearance.cpp:59
fpdfdoc
Definition
cpdf_color_utils.cpp:14
fpdfdoc::CFXColorFromArray
CFX_Color CFXColorFromArray(const CPDF_Array &array)
Definition
cpdf_color_utils.cpp:16
fpdfdoc::CFXColorFromString
CFX_Color CFXColorFromString(const ByteString &str)
Definition
cpdf_color_utils.cpp:35
CFX_Color
Definition
cfx_color.h:12
CFX_Color::Type
Type
Definition
cfx_color.h:14
CFX_Color::Type::kCMYK
@ kCMYK
CFX_Color::Type::kGray
@ kGray
CFX_Color::Type::kRGB
@ kRGB
CFX_Color::operator=
CFX_Color & operator=(const CFX_Color &that)=default
CFX_Color::CFX_Color
constexpr CFX_Color(Type type=CFX_Color::Type::kTransparent, float color1=0.0f, float color2=0.0f, float color3=0.0f, float color4=0.0f)
Definition
cfx_color.h:27
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fpdfdoc
cpdf_color_utils.cpp
Generated on Thu Nov 14 2024 00:57:13 for Qt by
1.12.0