Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cjs_color.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
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 FXJS_CJS_COLOR_H_
8#define FXJS_CJS_COLOR_H_
9
10#include "core/fxcrt/span.h"
11#include "core/fxge/cfx_color.h"
12#include "fxjs/cjs_object.h"
13#include "fxjs/js_define.h"
14
15class CJS_Color final : public CJS_Object {
16 public:
17 static uint32_t GetObjDefnID();
18 static void DefineJSObjects(CFXJS_Engine* pEngine);
19 static v8::Local<v8::Array> ConvertPWLColorToArray(CJS_Runtime* pRuntime,
20 const CFX_Color& color);
21 static CFX_Color ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
22 v8::Local<v8::Array> array);
23
24 CJS_Color(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
25 ~CJS_Color() override;
26
27 JS_STATIC_PROP(black, black, CJS_Color)
28 JS_STATIC_PROP(blue, blue, CJS_Color)
29 JS_STATIC_PROP(cyan, cyan, CJS_Color)
30 JS_STATIC_PROP(dkGray, dark_gray, CJS_Color)
31 JS_STATIC_PROP(gray, gray, CJS_Color)
32 JS_STATIC_PROP(green, green, CJS_Color)
33 JS_STATIC_PROP(ltGray, light_gray, CJS_Color)
34 JS_STATIC_PROP(magenta, magenta, CJS_Color)
35 JS_STATIC_PROP(red, red, CJS_Color)
36 JS_STATIC_PROP(transparent, transparent, CJS_Color)
37 JS_STATIC_PROP(white, white, CJS_Color)
38 JS_STATIC_PROP(yellow, yellow, CJS_Color)
39
40 JS_STATIC_METHOD(convert, CJS_Color)
41 JS_STATIC_METHOD(equal, CJS_Color)
42
43 private:
44 static uint32_t ObjDefnID;
45 static const char kName[];
46 static const JSPropertySpec PropertySpecs[];
47 static const JSMethodSpec MethodSpecs[];
48
49 CJS_Result get_black(CJS_Runtime* pRuntime);
50 CJS_Result set_black(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
51
52 CJS_Result get_blue(CJS_Runtime* pRuntime);
53 CJS_Result set_blue(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
54
55 CJS_Result get_cyan(CJS_Runtime* pRuntime);
56 CJS_Result set_cyan(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
57
58 CJS_Result get_dark_gray(CJS_Runtime* pRuntime);
59 CJS_Result set_dark_gray(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
60
61 CJS_Result get_gray(CJS_Runtime* pRuntime);
62 CJS_Result set_gray(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
63
64 CJS_Result get_green(CJS_Runtime* pRuntime);
65 CJS_Result set_green(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
66
67 CJS_Result get_light_gray(CJS_Runtime* pRuntime);
68 CJS_Result set_light_gray(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
69
70 CJS_Result get_magenta(CJS_Runtime* pRuntime);
71 CJS_Result set_magenta(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
72
73 CJS_Result get_red(CJS_Runtime* pRuntime);
74 CJS_Result set_red(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
75
76 CJS_Result get_transparent(CJS_Runtime* pRuntime);
77 CJS_Result set_transparent(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
78
79 CJS_Result get_white(CJS_Runtime* pRuntime);
80 CJS_Result set_white(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
81
82 CJS_Result get_yellow(CJS_Runtime* pRuntime);
83 CJS_Result set_yellow(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
84
85 CJS_Result convert(CJS_Runtime* pRuntime,
86 pdfium::span<v8::Local<v8::Value>> params);
87 CJS_Result equal(CJS_Runtime* pRuntime,
88 pdfium::span<v8::Local<v8::Value>> params);
89
90 CJS_Result GetPropertyHelper(CJS_Runtime* pRuntime, CFX_Color* val);
91 CJS_Result SetPropertyHelper(CJS_Runtime* pRuntime,
92 v8::Local<v8::Value> vp,
93 CFX_Color* val);
94
95 CFX_Color m_crTransparent;
96 CFX_Color m_crBlack;
97 CFX_Color m_crWhite;
98 CFX_Color m_crRed;
99 CFX_Color m_crGreen;
100 CFX_Color m_crBlue;
101 CFX_Color m_crCyan;
102 CFX_Color m_crMagenta;
103 CFX_Color m_crYellow;
104 CFX_Color m_crDKGray;
105 CFX_Color m_crGray;
106 CFX_Color m_crLTGray;
107};
108
109#endif // FXJS_CJS_COLOR_H_
bool operator==(const CFX_Color &c1, const CFX_Color &c2)
Definition cfx_color.h:61
@ FXJSOBJTYPE_STATIC
static v8::Local< v8::Array > ConvertPWLColorToArray(CJS_Runtime *pRuntime, const CFX_Color &color)
Definition cjs_color.cpp:54
static CFX_Color ConvertArrayToPWLColor(CJS_Runtime *pRuntime, v8::Local< v8::Array > array)
Definition cjs_color.cpp:87
~CJS_Color() override
static uint32_t GetObjDefnID()
Definition cjs_color.cpp:41
CJS_Color(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
static void DefineJSObjects(CFXJS_Engine *pEngine)
Definition cjs_color.cpp:46
static CJS_Result Success()
Definition cjs_result.h:28
static CJS_Result Failure(JSMessage id)
Definition cjs_result.h:35
bool EqualsASCII(ByteStringView that) const
Definition widestring.h:111
#define JS_STATIC_METHOD(method_name, class_name)
Definition js_define.h:159
#define JS_STATIC_PROP(err_name, prop_name, class_name)
Definition js_define.h:145
JSMessage
CFX_Color ConvertColorType(Type nConvertColorType) const
Definition cfx_color.cpp:75
Type nColorType
Definition cfx_color.h:54
constexpr CFX_Color(Type type=CFX_Color::Type::kTransparent, float color1=0.0f, float color2=0.0f, float color3=0.0f, float color4=0.0f)
Definition cfx_color.h:27
fxcrt::WideString WideString
Definition widestring.h:207