| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef FPDFSDK_JAVASCRIPT_COLOR_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_COLOR_H_ |
| 8 #define FPDFSDK_JAVASCRIPT_COLOR_H_ | 8 #define FPDFSDK_JAVASCRIPT_COLOR_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "fpdfsdk/javascript/JS_Define.h" | 12 #include "fpdfsdk/javascript/JS_Define.h" |
| 13 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 13 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
| 14 | 14 |
| 15 class color : public CJS_EmbedObj { | 15 class color : public CJS_EmbedObj { |
| 16 public: | 16 public: |
| 17 color(CJS_Object* pJSObject); | 17 color(CJS_Object* pJSObject); |
| 18 ~color() override; | 18 ~color() override; |
| 19 | 19 |
| 20 FX_BOOL black(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 20 bool black(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 21 FX_BOOL blue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 21 bool blue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 22 FX_BOOL cyan(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 22 bool cyan(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 23 FX_BOOL dkGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 23 bool dkGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 24 FX_BOOL gray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 24 bool gray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 25 FX_BOOL green(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 25 bool green(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 26 FX_BOOL ltGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 26 bool ltGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 27 FX_BOOL magenta(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 27 bool magenta(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 28 FX_BOOL red(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 28 bool red(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 29 FX_BOOL transparent(IJS_Context* cc, | 29 bool transparent(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 30 CJS_PropValue& vp, | 30 bool white(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 31 CFX_WideString& sError); | 31 bool yellow(IJS_Context* cc, CJS_PropValue& vp, 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 | 32 |
| 35 FX_BOOL convert(IJS_Context* cc, | 33 bool convert(IJS_Context* cc, |
| 36 const std::vector<CJS_Value>& params, | 34 const std::vector<CJS_Value>& params, |
| 37 CJS_Value& vRet, | 35 CJS_Value& vRet, |
| 38 CFX_WideString& sError); | 36 CFX_WideString& sError); |
| 39 FX_BOOL equal(IJS_Context* cc, | 37 bool equal(IJS_Context* cc, |
| 40 const std::vector<CJS_Value>& params, | 38 const std::vector<CJS_Value>& params, |
| 41 CJS_Value& vRet, | 39 CJS_Value& vRet, |
| 42 CFX_WideString& sError); | 40 CFX_WideString& sError); |
| 43 | 41 |
| 44 static void ConvertPWLColorToArray(CJS_Runtime* pRuntime, | 42 static void ConvertPWLColorToArray(CJS_Runtime* pRuntime, |
| 45 const CPWL_Color& color, | 43 const CPWL_Color& color, |
| 46 CJS_Array* array); | 44 CJS_Array* array); |
| 47 static void ConvertArrayToPWLColor(CJS_Runtime* pRuntime, | 45 static void ConvertArrayToPWLColor(CJS_Runtime* pRuntime, |
| 48 const CJS_Array& array, | 46 const CJS_Array& array, |
| 49 CPWL_Color* color); | 47 CPWL_Color* color); |
| 50 | 48 |
| 51 private: | 49 private: |
| 52 CPWL_Color m_crTransparent; | 50 CPWL_Color m_crTransparent; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 81 JS_STATIC_PROP(red, color); | 79 JS_STATIC_PROP(red, color); |
| 82 JS_STATIC_PROP(transparent, color); | 80 JS_STATIC_PROP(transparent, color); |
| 83 JS_STATIC_PROP(white, color); | 81 JS_STATIC_PROP(white, color); |
| 84 JS_STATIC_PROP(yellow, color); | 82 JS_STATIC_PROP(yellow, color); |
| 85 | 83 |
| 86 JS_STATIC_METHOD(convert, color); | 84 JS_STATIC_METHOD(convert, color); |
| 87 JS_STATIC_METHOD(equal, color); | 85 JS_STATIC_METHOD(equal, color); |
| 88 }; | 86 }; |
| 89 | 87 |
| 90 #endif // FPDFSDK_JAVASCRIPT_COLOR_H_ | 88 #endif // FPDFSDK_JAVASCRIPT_COLOR_H_ |
| OLD | NEW |