OLD | NEW |
(Empty) | |
| 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 #include "xfa/fxgraphics/cfx_color.h" |
| 8 |
| 9 CFX_Color::CFX_Color() : m_type(FX_COLOR_None) {} |
| 10 |
| 11 CFX_Color::CFX_Color(const FX_ARGB argb) { |
| 12 Set(argb); |
| 13 } |
| 14 |
| 15 CFX_Color::CFX_Color(CFX_Pattern* pattern, const FX_ARGB argb) { |
| 16 Set(pattern, argb); |
| 17 } |
| 18 |
| 19 CFX_Color::CFX_Color(CFX_Shading* shading) { |
| 20 Set(shading); |
| 21 } |
| 22 |
| 23 CFX_Color::~CFX_Color() { |
| 24 m_type = FX_COLOR_None; |
| 25 } |
| 26 |
| 27 FX_ERR CFX_Color::Set(const FX_ARGB argb) { |
| 28 m_type = FX_COLOR_Solid; |
| 29 m_info.argb = argb; |
| 30 m_info.pattern = nullptr; |
| 31 return FX_ERR_Succeeded; |
| 32 } |
| 33 |
| 34 FX_ERR CFX_Color::Set(CFX_Pattern* pattern, const FX_ARGB argb) { |
| 35 if (!pattern) |
| 36 return FX_ERR_Parameter_Invalid; |
| 37 m_type = FX_COLOR_Pattern; |
| 38 m_info.argb = argb; |
| 39 m_info.pattern = pattern; |
| 40 return FX_ERR_Succeeded; |
| 41 } |
| 42 |
| 43 FX_ERR CFX_Color::Set(CFX_Shading* shading) { |
| 44 if (!shading) |
| 45 return FX_ERR_Parameter_Invalid; |
| 46 m_type = FX_COLOR_Shading; |
| 47 m_shading = shading; |
| 48 return FX_ERR_Succeeded; |
| 49 } |
OLD | NEW |