Ocean
JSColor.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_INTERACTION_JS_COLOR_H
9 #define META_OCEAN_INTERACTION_JS_COLOR_H
10 
13 
14 namespace Ocean
15 {
16 
17 namespace Interaction
18 {
19 
20 namespace JavaScript
21 {
22 
23 /**
24  * This class implements a wrapper for a JavaScript Color object.
25  * @ingroup interactionjs
26  */
27 class OCEAN_INTERACTION_JS_EXPORT JSColor : public JSObject<JSColor, RGBAColor>
28 {
29  friend class JSObject<JSColor, RGBAColor>;
30  friend class JSLibrary;
31 
32  public:
33 
34  /**
35  * Definition of ids for individual accessors.
36  */
37  enum AccessorId : unsigned int
38  {
39  /// The accessor for the red property, a number value.
41  /// The accessor for the green property, a number value.
43  /// The accessor for the blue property, a number value.
45  /// The accessor for the alpha property, a number value.
46  AI_ALPHA
47  };
48 
49  /**
50  * Definition of ids for individual functions.
51  */
52  enum FunctionId : unsigned int
53  {
64  FI_STRING
65  };
66 
67  public:
68 
69  /**
70  * Returns the JavaScript name of this object.
71  * @return The object's JavaScript name
72  */
73  static inline const char* objectName();
74 
75  protected:
76 
77  /**
78  * Creates the function template and object template for this object.
79  */
80  static void createFunctionTemplate();
81 };
82 
83 inline const char* JSColor::objectName()
84 {
85  return "Color";
86 }
87 
88 }
89 
90 }
91 
92 }
93 
94 #endif // META_OCEAN_INTERACTION_JS_COLOR_H
This class implements a wrapper for a JavaScript Color object.
Definition: JSColor.h:28
static void createFunctionTemplate()
Creates the function template and object template for this object.
FunctionId
Definition of ids for individual functions.
Definition: JSColor.h:53
@ FI_CLAMP
Definition: JSColor.h:54
@ FI_INVERT
Definition: JSColor.h:57
@ FI_NORMALIZED
Definition: JSColor.h:63
@ FI_CLAMPED
Definition: JSColor.h:55
@ FI_IS_NORMALIZED
Definition: JSColor.h:60
@ FI_INTERPOLATE
Definition: JSColor.h:56
@ FI_IS_EQUAL
Definition: JSColor.h:59
@ FI_NORMALIZE
Definition: JSColor.h:62
@ FI_MULTIPLY
Definition: JSColor.h:61
@ FI_INVERTED
Definition: JSColor.h:58
AccessorId
Definition of ids for individual accessors.
Definition: JSColor.h:38
@ AI_GREEN
The accessor for the green property, a number value.
Definition: JSColor.h:42
@ AI_RED
The accessor for the red property, a number value.
Definition: JSColor.h:40
@ AI_BLUE
The accessor for the blue property, a number value.
Definition: JSColor.h:44
static const char * objectName()
Returns the JavaScript name of this object.
Definition: JSColor.h:83
This class implements the java script interaction library object.
Definition: JSLibrary.h:32
This class implements the base class for all native wrapper of JavaScript objects.
Definition: JSObject.h:31
This class implements a color defined by red, green, blue and alpha parameters.
Definition: RGBAColor.h:41
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15