@@ -35,8 +35,8 @@ void ImageWrap::Create (const FunctionCallbackInfo<Value>& args)
35
35
ISOWRAP (Image, args.Holder ());
36
36
37
37
RETURN_BOOL (mImage ->Create
38
- ((uint16) args[0 ]-> Int32Value ( ),
39
- (uint16) args[1 ]-> Int32Value ( )));
38
+ ((uint16) INT32_VALUE ( args[0 ]),
39
+ (uint16) INT32_VALUE ( args[1 ])));
40
40
}
41
41
42
42
// //////////////////////////////////////////////////////////////////////////////
@@ -106,8 +106,8 @@ void ImageWrap::GetPixel (const FunctionCallbackInfo<Value>& args)
106
106
ISOWRAP (Image, args.Holder ());
107
107
108
108
Color color = mImage ->GetPixel
109
- ((uint16) args[0 ]-> Int32Value ( ),
110
- (uint16) args[1 ]-> Int32Value ( ));
109
+ ((uint16) INT32_VALUE ( args[0 ]),
110
+ (uint16) INT32_VALUE ( args[1 ]));
111
111
112
112
RETURN_COLOR (color.R , color.G ,
113
113
color.B , color.A );
@@ -120,12 +120,12 @@ void ImageWrap::SetPixel (const FunctionCallbackInfo<Value>& args)
120
120
ISOWRAP (Image, args.Holder ());
121
121
122
122
mImage ->SetPixel
123
- ((uint16) args[0 ]-> Int32Value ( ),
124
- (uint16) args[1 ]-> Int32Value ( ),
125
- Color ((uint8 ) args[2 ]-> Int32Value ( ),
126
- (uint8 ) args[3 ]-> Int32Value ( ),
127
- (uint8 ) args[4 ]-> Int32Value ( ),
128
- (uint8 ) args[5 ]-> Int32Value ( )));
123
+ ((uint16) INT32_VALUE ( args[0 ]),
124
+ (uint16) INT32_VALUE ( args[1 ]),
125
+ Color ((uint8 ) INT32_VALUE ( args[2 ]),
126
+ (uint8 ) INT32_VALUE ( args[3 ]),
127
+ (uint8 ) INT32_VALUE ( args[4 ]),
128
+ (uint8 ) INT32_VALUE ( args[5 ])));
129
129
}
130
130
131
131
// //////////////////////////////////////////////////////////////////////////////
@@ -135,10 +135,10 @@ void ImageWrap::Fill (const FunctionCallbackInfo<Value>& args)
135
135
ISOWRAP (Image, args.Holder ());
136
136
137
137
RETURN_BOOL (mImage ->Fill (Color
138
- ((uint8) args[0 ]-> Int32Value ( ),
139
- (uint8) args[1 ]-> Int32Value ( ),
140
- (uint8) args[2 ]-> Int32Value ( ),
141
- (uint8) args[3 ]-> Int32Value ( ))));
138
+ ((uint8) INT32_VALUE ( args[0 ]),
139
+ (uint8) INT32_VALUE ( args[1 ]),
140
+ (uint8) INT32_VALUE ( args[2 ]),
141
+ (uint8) INT32_VALUE ( args[3 ]))));
142
142
}
143
143
144
144
// //////////////////////////////////////////////////////////////////////////////
@@ -151,7 +151,7 @@ void ImageWrap::Swap (const FunctionCallbackInfo<Value>& args)
151
151
if (!args[0 ]->IsString ())
152
152
THROW (Type, " Invalid arguments" );
153
153
154
- String::Utf8Value value ( args[0 ]);
154
+ UTF8_VAR ( value, args[0 ]);
155
155
auto swap = *value ? *value : " " ;
156
156
RETURN_BOOL (mImage ->Swap (swap));
157
157
}
@@ -167,8 +167,8 @@ void ImageWrap::Flip (const FunctionCallbackInfo<Value>& args)
167
167
!args[1 ]->IsBoolean ())
168
168
THROW (Type, " Invalid arguments" );
169
169
170
- bool h = args[0 ]-> BooleanValue ( );
171
- bool v = args[1 ]-> BooleanValue ( );
170
+ bool h = BOOLEAN_VALUE ( args[0 ]);
171
+ bool v = BOOLEAN_VALUE ( args[1 ]);
172
172
RETURN_BOOL (mImage ->Flip (h, v));
173
173
}
174
174
@@ -178,7 +178,7 @@ void ImageWrap::Equals (const FunctionCallbackInfo<Value>& args)
178
178
{
179
179
ISOLATE;
180
180
auto * wrapper1 = ObjectWrap::Unwrap<ImageWrap> (args .Holder ());
181
- auto * wrapper2 = ObjectWrap::Unwrap<ImageWrap> (args[0 ]-> ToObject ( ));
181
+ auto * wrapper2 = ObjectWrap::Unwrap<ImageWrap> (TO_OBJECT ( args[0 ]));
182
182
RETURN_BOOL (wrapper1->mImage == wrapper2->mImage );
183
183
}
184
184
@@ -201,13 +201,13 @@ void ImageWrap::New (const FunctionCallbackInfo<Value>& args)
201
201
{
202
202
// Normalize the size argument
203
203
auto s = NEW_INSTANCE (
204
+ Local<Function>::New (isolate, JsSize),
204
205
Local<Function>::New (isolate, JsSize),
205
- 2 , (_jsArgs[0 ] = args[0 ],
206
- _jsArgs[1 ] = args[1 ], _jsArgs));
206
+ _jsArgs[1 ] = args[1 ], _jsArgs));
207
207
208
208
wrapper->mImage .Create
209
- (( uint16) s-> Get ( NEW_STR (" w" ))-> Int32Value ( ),
210
- ( uint16) s-> Get ( NEW_STR (" h" ))-> Int32Value ( ));
209
+ (INT32_VALUE (( uint16) OBJECT_GET (s, NEW_STR (" w" ))),
210
+ INT32_VALUE (( uint16) OBJECT_GET (s, NEW_STR (" h" ))));
211
211
}
212
212
213
213
REGISTER_ROBOT_TYPE;
@@ -226,7 +226,7 @@ void ImageWrap::New (const FunctionCallbackInfo<Value>& args)
226
226
227
227
// //////////////////////////////////////////////////////////////////////////////
228
228
229
- void ImageWrap::Initialize (Handle <Object> exports)
229
+ void ImageWrap::Initialize (Local <Object> exports)
230
230
{
231
231
// Get the current isolated V8 instance
232
232
Isolate* isolate = Isolate::GetCurrent ();
@@ -256,7 +256,6 @@ void ImageWrap::Initialize (Handle<Object> exports)
256
256
NODE_SET_PROTOTYPE_METHOD (tpl, " _equals" , Equals );
257
257
258
258
// Assign function template to our class creator
259
- constructor.Reset (isolate, tpl->GetFunction ());
260
- exports->Set
261
- (NEW_STR (" Image" ), tpl->GetFunction ());
259
+ constructor.Reset (isolate, GET_FUNCTION (tpl));
260
+ OBJECT_SET (exports, NEW_STR (" Image" ), GET_FUNCTION (tpl));
262
261
}
0 commit comments