summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/javascript/color.h
blob: 6eeb37be7e7c1a3c32fc9916507a62e4d2fb7fda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
 
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef _COLOR_H_
#define _COLOR_H_

#include "JS_Define.h"
// TODO(tsepez): include CPWL_Color.h once its own IWYU is fixed.

class color : public CJS_EmbedObj
{
public:
	color(CJS_Object* pJSObject);
	virtual ~color(void);

	FX_BOOL black(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
	FX_BOOL blue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
	FX_BOOL cyan(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);	
	FX_BOOL dkGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
	FX_BOOL gray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
	FX_BOOL green(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
	FX_BOOL ltGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
	FX_BOOL magenta(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
	FX_BOOL red(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);	
	FX_BOOL transparent(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
	FX_BOOL white(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
	FX_BOOL yellow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);

	FX_BOOL convert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
	FX_BOOL equal(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);

public:  
	static void		ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array);
	static void		ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color);

private:
	CPWL_Color		m_crTransparent;
	CPWL_Color		m_crBlack;
	CPWL_Color		m_crWhite;
	CPWL_Color		m_crRed;
	CPWL_Color		m_crGreen;
	CPWL_Color		m_crBlue;
	CPWL_Color		m_crCyan;
	CPWL_Color		m_crMagenta;
	CPWL_Color		m_crYellow;
	CPWL_Color		m_crDKGray;
	CPWL_Color		m_crGray;
	CPWL_Color		m_crLTGray;
};

class CJS_Color : public CJS_Object
{
public:
	CJS_Color(JSFXObject  pObject) : CJS_Object(pObject) {};
	virtual ~CJS_Color(void){};

	DECLARE_JS_CLASS(CJS_Color);

	JS_STATIC_PROP(black, color);
	JS_STATIC_PROP(blue, color);
	JS_STATIC_PROP(cyan, color);	
	JS_STATIC_PROP(dkGray, color);
	JS_STATIC_PROP(gray, color);
	JS_STATIC_PROP(green, color);
	JS_STATIC_PROP(ltGray, color);
	JS_STATIC_PROP(magenta, color);
	JS_STATIC_PROP(red, color);	
	JS_STATIC_PROP(transparent, color);
	JS_STATIC_PROP(white, color);
	JS_STATIC_PROP(yellow, color);

	JS_STATIC_METHOD(convert,color);
	JS_STATIC_METHOD(equal,color);

};

#endif //_COLOR_H_