7#include "core/fpdfapi/page/cpdf_colorstate.h"
11#include "core/fpdfapi/page/cpdf_colorspace.h"
12#include "core/fpdfapi/page/cpdf_pattern.h"
13#include "core/fpdfapi/page/cpdf_tilingpattern.h"
14#include "core/fxge/dib/fx_dib.h"
15#include "third_party/base/check.h"
28 m_Ref.GetPrivateCopy()->SetDefault();
32 return m_Ref.GetObject()->m_FillColorRef;
36 if (!m_Ref || GetFillColorRef() != colorref) {
37 m_Ref.GetPrivateCopy()->m_FillColorRef = colorref;
42 return m_Ref.GetObject()->m_StrokeColorRef;
46 if (!m_Ref || GetStrokeColorRef() != colorref) {
47 m_Ref.GetPrivateCopy()->m_StrokeColorRef = colorref;
52 const ColorData* pData = m_Ref.GetObject();
53 return pData ? &pData->m_FillColor :
nullptr;
57 return &m_Ref.GetPrivateCopy()->m_FillColor;
66 const ColorData* pData = m_Ref.GetObject();
67 return pData ? &pData->m_StrokeColor :
nullptr;
71 return &m_Ref.GetPrivateCopy()->m_StrokeColor;
80 std::vector<
float> values) {
81 ColorData* pData = m_Ref.GetPrivateCopy();
82 SetColor(std::move(colorspace), std::move(values), &pData->m_FillColor,
83 &pData->m_FillColorRef);
87 std::vector<
float> values) {
88 ColorData* pData = m_Ref.GetPrivateCopy();
89 SetColor(std::move(colorspace), std::move(values), &pData->m_StrokeColor,
90 &pData->m_StrokeColorRef);
94 pdfium::span<
float> values) {
95 ColorData* pData = m_Ref.GetPrivateCopy();
96 SetPattern(
std::move(pattern), values, &pData->m_FillColor,
97 &pData->m_FillColorRef);
101 pdfium::span<
float> values) {
102 ColorData* pData = m_Ref.GetPrivateCopy();
103 SetPattern(
std::move(pattern), values, &pData->m_StrokeColor,
104 &pData->m_StrokeColorRef);
108 std::vector<
float> values,
110 FX_COLORREF* colorref) {
124 color->SetValueForNonPattern(
std::move(values));
132 pdfium::span<
float> values,
134 FX_COLORREF* colorref) {
145 CPDF_TilingPattern* tiling = pattern->AsTilingPattern();
146 *colorref = tiling && tiling
->colored() ? 0x00BFBFBF : 0xFFFFFFFF;
152 : m_FillColorRef(src.m_FillColorRef),
153 m_StrokeColorRef(src.m_StrokeColorRef),
154 m_FillColor(src.m_FillColor),
155 m_StrokeColor(src.m_StrokeColor) {}
161 m_StrokeColorRef = 0;
162 m_FillColor.SetColorSpace(
163 CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceGray));
164 m_StrokeColor.SetColorSpace(
165 CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceGray));
static RetainPtr< CPDF_ColorSpace > GetStockCS(Family family)
CPDF_Color * GetMutableFillColor()
FX_COLORREF GetStrokeColorRef() const
FX_COLORREF GetFillColorRef() const
void SetFillColor(RetainPtr< CPDF_ColorSpace > colorspace, std::vector< float > values)
void SetStrokeColor(RetainPtr< CPDF_ColorSpace > colorspace, std::vector< float > values)
CPDF_ColorState(const CPDF_ColorState &that)
CPDF_Color * GetMutableStrokeColor()
void SetStrokeColorRef(FX_COLORREF colorref)
void SetFillPattern(RetainPtr< CPDF_Pattern > pattern, pdfium::span< float > values)
const CPDF_Color * GetStrokeColor() const
void SetStrokePattern(RetainPtr< CPDF_Pattern > pattern, pdfium::span< float > values)
const CPDF_Color * GetFillColor() const
bool HasFillColor() const
bool HasStrokeColor() const
void SetFillColorRef(FX_COLORREF colorref)
void SetValueForPattern(RetainPtr< CPDF_Pattern > pattern, pdfium::span< float > values)
void SetColorSpace(RetainPtr< CPDF_ColorSpace > colorspace)
bool GetRGB(int *R, int *G, int *B) const
uint32_t CountComponents() const
constexpr uint32_t FXSYS_BGR(uint8_t b, uint8_t g, uint8_t r)