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