• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 FPDFSDK_INCLUDE_JAVASCRIPT_COLOR_H_
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_COLOR_H_
9 
10 #include "JS_Define.h"
11 // TODO(tsepez): include CPWL_Color.h once its own IWYU is fixed.
12 
13 class color : public CJS_EmbedObj
14 {
15 public:
16 	color(CJS_Object* pJSObject);
17 	virtual ~color(void);
18 
19 	FX_BOOL black(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
20 	FX_BOOL blue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
21 	FX_BOOL cyan(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
22 	FX_BOOL dkGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
23 	FX_BOOL gray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
24 	FX_BOOL green(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
25 	FX_BOOL ltGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
26 	FX_BOOL magenta(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
27 	FX_BOOL red(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
28 	FX_BOOL transparent(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
29 	FX_BOOL white(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
30 	FX_BOOL yellow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
31 
32 	FX_BOOL convert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
33 	FX_BOOL equal(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
34 
35 public:
36 	static void		ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array);
37 	static void		ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color);
38 
39 private:
40 	CPWL_Color		m_crTransparent;
41 	CPWL_Color		m_crBlack;
42 	CPWL_Color		m_crWhite;
43 	CPWL_Color		m_crRed;
44 	CPWL_Color		m_crGreen;
45 	CPWL_Color		m_crBlue;
46 	CPWL_Color		m_crCyan;
47 	CPWL_Color		m_crMagenta;
48 	CPWL_Color		m_crYellow;
49 	CPWL_Color		m_crDKGray;
50 	CPWL_Color		m_crGray;
51 	CPWL_Color		m_crLTGray;
52 };
53 
54 class CJS_Color : public CJS_Object
55 {
56 public:
CJS_Color(JSFXObject pObject)57 	CJS_Color(JSFXObject  pObject) : CJS_Object(pObject) {};
~CJS_Color(void)58 	virtual ~CJS_Color(void){};
59 
60 	DECLARE_JS_CLASS(CJS_Color);
61 
62 	JS_STATIC_PROP(black, color);
63 	JS_STATIC_PROP(blue, color);
64 	JS_STATIC_PROP(cyan, color);
65 	JS_STATIC_PROP(dkGray, color);
66 	JS_STATIC_PROP(gray, color);
67 	JS_STATIC_PROP(green, color);
68 	JS_STATIC_PROP(ltGray, color);
69 	JS_STATIC_PROP(magenta, color);
70 	JS_STATIC_PROP(red, color);
71 	JS_STATIC_PROP(transparent, color);
72 	JS_STATIC_PROP(white, color);
73 	JS_STATIC_PROP(yellow, color);
74 
75 	JS_STATIC_METHOD(convert,color);
76 	JS_STATIC_METHOD(equal,color);
77 
78 };
79 
80 #endif  // FPDFSDK_INCLUDE_JAVASCRIPT_COLOR_H_
81