@@ -35,8 +35,8 @@ void ImageWrap::Create (const FunctionCallbackInfo<Value>& args)
3535 ISOWRAP (Image, args.Holder ());
3636
3737 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 ])));
4040}
4141
4242// //////////////////////////////////////////////////////////////////////////////
@@ -106,8 +106,8 @@ void ImageWrap::GetPixel (const FunctionCallbackInfo<Value>& args)
106106 ISOWRAP (Image, args.Holder ());
107107
108108 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 ]));
111111
112112 RETURN_COLOR (color.R , color.G ,
113113 color.B , color.A );
@@ -120,12 +120,12 @@ void ImageWrap::SetPixel (const FunctionCallbackInfo<Value>& args)
120120 ISOWRAP (Image, args.Holder ());
121121
122122 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 ])));
129129}
130130
131131// //////////////////////////////////////////////////////////////////////////////
@@ -135,10 +135,10 @@ void ImageWrap::Fill (const FunctionCallbackInfo<Value>& args)
135135 ISOWRAP (Image, args.Holder ());
136136
137137 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 ]))));
142142}
143143
144144// //////////////////////////////////////////////////////////////////////////////
@@ -151,7 +151,7 @@ void ImageWrap::Swap (const FunctionCallbackInfo<Value>& args)
151151 if (!args[0 ]->IsString ())
152152 THROW (Type, " Invalid arguments" );
153153
154- String::Utf8Value value ( args[0 ]);
154+ UTF8_VAR ( value, args[0 ]);
155155 auto swap = *value ? *value : " " ;
156156 RETURN_BOOL (mImage ->Swap (swap));
157157}
@@ -167,8 +167,8 @@ void ImageWrap::Flip (const FunctionCallbackInfo<Value>& args)
167167 !args[1 ]->IsBoolean ())
168168 THROW (Type, " Invalid arguments" );
169169
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 ]);
172172 RETURN_BOOL (mImage ->Flip (h, v));
173173}
174174
@@ -178,7 +178,7 @@ void ImageWrap::Equals (const FunctionCallbackInfo<Value>& args)
178178{
179179 ISOLATE;
180180 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 ]));
182182 RETURN_BOOL (wrapper1->mImage == wrapper2->mImage );
183183}
184184
@@ -201,13 +201,13 @@ void ImageWrap::New (const FunctionCallbackInfo<Value>& args)
201201 {
202202 // Normalize the size argument
203203 auto s = NEW_INSTANCE (
204+ Local<Function>::New (isolate, JsSize),
204205 Local<Function>::New (isolate, JsSize),
205- 2 , (_jsArgs[0 ] = args[0 ],
206- _jsArgs[1 ] = args[1 ], _jsArgs));
206+ _jsArgs[1 ] = args[1 ], _jsArgs));
207207
208208 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" ))));
211211 }
212212
213213 REGISTER_ROBOT_TYPE;
@@ -226,7 +226,7 @@ void ImageWrap::New (const FunctionCallbackInfo<Value>& args)
226226
227227// //////////////////////////////////////////////////////////////////////////////
228228
229- void ImageWrap::Initialize (Handle <Object> exports)
229+ void ImageWrap::Initialize (Local <Object> exports)
230230{
231231 // Get the current isolated V8 instance
232232 Isolate* isolate = Isolate::GetCurrent ();
@@ -256,7 +256,6 @@ void ImageWrap::Initialize (Handle<Object> exports)
256256 NODE_SET_PROTOTYPE_METHOD (tpl, " _equals" , Equals );
257257
258258 // 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));
262261}
0 commit comments