| OLD | NEW |
| (Empty) |
| 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_SRC_JAVASCRIPT_COLOR_H_ | |
| 8 #define FPDFSDK_SRC_JAVASCRIPT_COLOR_H_ | |
| 9 | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | |
| 13 #include "fpdfsdk/src/javascript/JS_Define.h" | |
| 14 | |
| 15 class color : public CJS_EmbedObj { | |
| 16 public: | |
| 17 color(CJS_Object* pJSObject); | |
| 18 ~color() override; | |
| 19 | |
| 20 FX_BOOL black(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 21 FX_BOOL blue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 22 FX_BOOL cyan(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 23 FX_BOOL dkGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 24 FX_BOOL gray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 25 FX_BOOL green(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 26 FX_BOOL ltGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 27 FX_BOOL magenta(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 28 FX_BOOL red(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 29 FX_BOOL transparent(IJS_Context* cc, | |
| 30 CJS_PropValue& vp, | |
| 31 CFX_WideString& sError); | |
| 32 FX_BOOL white(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 33 FX_BOOL yellow(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | |
| 34 | |
| 35 FX_BOOL convert(IJS_Context* cc, | |
| 36 const std::vector<CJS_Value>& params, | |
| 37 CJS_Value& vRet, | |
| 38 CFX_WideString& sError); | |
| 39 FX_BOOL equal(IJS_Context* cc, | |
| 40 const std::vector<CJS_Value>& params, | |
| 41 CJS_Value& vRet, | |
| 42 CFX_WideString& sError); | |
| 43 | |
| 44 public: | |
| 45 static void ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array); | |
| 46 static void ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color); | |
| 47 | |
| 48 private: | |
| 49 CPWL_Color m_crTransparent; | |
| 50 CPWL_Color m_crBlack; | |
| 51 CPWL_Color m_crWhite; | |
| 52 CPWL_Color m_crRed; | |
| 53 CPWL_Color m_crGreen; | |
| 54 CPWL_Color m_crBlue; | |
| 55 CPWL_Color m_crCyan; | |
| 56 CPWL_Color m_crMagenta; | |
| 57 CPWL_Color m_crYellow; | |
| 58 CPWL_Color m_crDKGray; | |
| 59 CPWL_Color m_crGray; | |
| 60 CPWL_Color m_crLTGray; | |
| 61 }; | |
| 62 | |
| 63 class CJS_Color : public CJS_Object { | |
| 64 public: | |
| 65 CJS_Color(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} | |
| 66 ~CJS_Color() override {} | |
| 67 | |
| 68 DECLARE_JS_CLASS(); | |
| 69 | |
| 70 JS_STATIC_PROP(black, color); | |
| 71 JS_STATIC_PROP(blue, color); | |
| 72 JS_STATIC_PROP(cyan, color); | |
| 73 JS_STATIC_PROP(dkGray, color); | |
| 74 JS_STATIC_PROP(gray, color); | |
| 75 JS_STATIC_PROP(green, color); | |
| 76 JS_STATIC_PROP(ltGray, color); | |
| 77 JS_STATIC_PROP(magenta, color); | |
| 78 JS_STATIC_PROP(red, color); | |
| 79 JS_STATIC_PROP(transparent, color); | |
| 80 JS_STATIC_PROP(white, color); | |
| 81 JS_STATIC_PROP(yellow, color); | |
| 82 | |
| 83 JS_STATIC_METHOD(convert, color); | |
| 84 JS_STATIC_METHOD(equal, color); | |
| 85 }; | |
| 86 | |
| 87 #endif // FPDFSDK_SRC_JAVASCRIPT_COLOR_H_ | |
| OLD | NEW |