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 XFA_FXGRAPHICS_CFX_COLOR_H_ 8 #define XFA_FXGRAPHICS_CFX_COLOR_H_ 9 10 #include "core/fxge/include/fx_dib.h" 11 #include "xfa/fxgraphics/include/cfx_graphics.h" 12 13 class CFX_Pattern; 14 class CFX_Shading; 15 16 enum { FX_COLOR_None = 0, FX_COLOR_Solid, FX_COLOR_Pattern, FX_COLOR_Shading }; 17 18 class CFX_Color { 19 public: 20 CFX_Color(); 21 // TODO(weili): Remove implicit conversions. Make this explicit. 22 CFX_Color(const FX_ARGB argb); 23 24 explicit CFX_Color(CFX_Pattern* pattern, const FX_ARGB argb = 0x0); 25 explicit CFX_Color(CFX_Shading* shading); 26 virtual ~CFX_Color(); 27 28 FWL_Error Set(const FX_ARGB argb); 29 FWL_Error Set(CFX_Pattern* pattern, const FX_ARGB argb = 0x0); 30 FWL_Error Set(CFX_Shading* shading); 31 32 private: 33 friend class CFX_Graphics; 34 35 int32_t m_type; 36 union { 37 struct { 38 FX_ARGB argb; 39 CFX_Pattern* pattern; 40 } m_info; 41 CFX_Shading* m_shading; 42 }; 43 }; 44 45 #endif // XFA_FXGRAPHICS_CFX_COLOR_H_ 46