@nativescript/canvas 2.0.0-alpha.45 → 2.0.0-alpha.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/canvas",
3
- "version": "2.0.0-alpha.45",
3
+ "version": "2.0.0-alpha.46",
4
4
  "description": "DOM Canvas API for NativeScript",
5
5
  "main": "index",
6
6
  "typings": "index.d.ts",
@@ -34,6 +34,16 @@ v8::CFunction CanvasRenderingContext2DImpl::fast_clear_rect_(
34
34
  v8::CFunction::Make(CanvasRenderingContext2DImpl::FastClearRect));
35
35
 
36
36
 
37
+ v8::CFunction CanvasRenderingContext2DImpl::fast_fill_rect_(
38
+ v8::CFunction::Make(CanvasRenderingContext2DImpl::FastFillRect));
39
+
40
+ v8::CFunction CanvasRenderingContext2DImpl::fast_stroke_rect_(
41
+ v8::CFunction::Make(CanvasRenderingContext2DImpl::FastStrokeRect));
42
+
43
+ v8::CFunction CanvasRenderingContext2DImpl::fast_rotate_(
44
+ v8::CFunction::Make(CanvasRenderingContext2DImpl::FastRotate));
45
+
46
+
37
47
  v8::CFunction CanvasRenderingContext2DImpl::fast_fill_(
38
48
  v8::CFunction::Make(CanvasRenderingContext2DImpl::FastFill));
39
49
 
@@ -46,6 +56,7 @@ const v8::CFunction fast_fill_overloads_[] = {
46
56
  };
47
57
 
48
58
 
59
+
49
60
  v8::CFunction CanvasRenderingContext2DImpl::fast_stroke_(
50
61
  v8::CFunction::Make(CanvasRenderingContext2DImpl::FastStroke));
51
62
 
@@ -215,8 +226,16 @@ v8::Local<v8::FunctionTemplate> CanvasRenderingContext2DImpl::GetCtor(v8::Isolat
215
226
  SetFastMethodWithOverLoads(isolate, tmpl, "fill", Fill, fast_fill_overloads_,
216
227
  v8::Local<v8::Value>());
217
228
 
218
- tmpl->Set(ConvertToV8String(isolate, "fillRect"),
219
- v8::FunctionTemplate::New(isolate, &FillRect));
229
+
230
+
231
+
232
+ SetFastMethod(isolate, tmpl, "fillRect", FillRect, &fast_fill_rect_, v8::Local<v8::Value>());
233
+
234
+
235
+
236
+ //
237
+ // tmpl->Set(ConvertToV8String(isolate, "fillRect"),
238
+ // v8::FunctionTemplate::New(isolate, &FillRect));
220
239
  tmpl->Set(ConvertToV8String(isolate, "fillText"),
221
240
  v8::FunctionTemplate::New(isolate, &FillText));
222
241
  tmpl->Set(ConvertToV8String(isolate, "getImageData"),
@@ -246,7 +265,11 @@ v8::Local<v8::FunctionTemplate> CanvasRenderingContext2DImpl::GetCtor(v8::Isolat
246
265
  SetFastMethod(isolate, tmpl, "restore", Restore, &fast_restore_, v8::Local<v8::Value>());
247
266
 
248
267
  // tmpl->Set(ConvertToV8String(isolate, "restore"), v8::FunctionTemplate::New(isolate, &Restore));
249
- tmpl->Set(ConvertToV8String(isolate, "rotate"), v8::FunctionTemplate::New(isolate, &Rotate));
268
+
269
+
270
+ SetFastMethod(isolate, tmpl, "rotate", Rotate, &fast_rotate_, v8::Local<v8::Value>());
271
+
272
+ // tmpl->Set(ConvertToV8String(isolate, "rotate"), v8::FunctionTemplate::New(isolate, &Rotate));
250
273
 
251
274
 
252
275
  SetFastMethod(isolate, tmpl, "save", Save, &fast_save_, v8::Local<v8::Value>());
@@ -266,8 +289,12 @@ v8::Local<v8::FunctionTemplate> CanvasRenderingContext2DImpl::GetCtor(v8::Isolat
266
289
  v8::Local<v8::Value>());
267
290
 
268
291
 
269
- tmpl->Set(ConvertToV8String(isolate, "strokeRect"),
270
- v8::FunctionTemplate::New(isolate, &StrokeRect));
292
+ // tmpl->Set(ConvertToV8String(isolate, "strokeRect"),
293
+ // v8::FunctionTemplate::New(isolate, &StrokeRect));
294
+
295
+ SetFastMethod(isolate, tmpl, "strokeRect", StrokeRect, &fast_stroke_rect_, v8::Local<v8::Value>());
296
+
297
+
271
298
  tmpl->Set(ConvertToV8String(isolate, "strokeText"),
272
299
  v8::FunctionTemplate::New(isolate, &StrokeText));
273
300
  tmpl->Set(ConvertToV8String(isolate, "transform"),
@@ -226,9 +226,14 @@ public:
226
226
  static v8::CFunction fast_fill_;
227
227
  static v8::CFunction fast_fill_one_path_;
228
228
 
229
+ static v8::CFunction fast_fill_rect_;
230
+
229
231
  static v8::CFunction fast_stroke_;
230
232
  static v8::CFunction fast_stroke_path_;
231
233
 
234
+ static v8::CFunction fast_stroke_rect_;
235
+
236
+ static v8::CFunction fast_rotate_;
232
237
 
233
238
  static v8::CFunction fast_restore_;
234
239
 
@@ -483,6 +488,24 @@ public:
483
488
 
484
489
  static void FillRect(const v8::FunctionCallbackInfo<v8::Value> &args);
485
490
 
491
+
492
+ static void FastFillRect(v8::Local<v8::Object> receiver_obj, double x, double y, double width,
493
+ double height) {
494
+ CanvasRenderingContext2DImpl *ptr = GetPointer(receiver_obj);
495
+ if (ptr == nullptr) {
496
+ return;
497
+ }
498
+
499
+ canvas_native_context_fill_rect(
500
+ ptr->GetContext(),
501
+ static_cast<float>(x),
502
+ static_cast<float>(y),
503
+ static_cast<float>(width),
504
+ static_cast<float>(height)
505
+ );
506
+ ptr->UpdateInvalidateState();
507
+ }
508
+
486
509
  static void FillText(const v8::FunctionCallbackInfo<v8::Value> &args);
487
510
 
488
511
  static void GetImageData(const v8::FunctionCallbackInfo<v8::Value> &args);
@@ -525,6 +548,13 @@ public:
525
548
 
526
549
  static void Rotate(const v8::FunctionCallbackInfo<v8::Value> &args);
527
550
 
551
+ static void FastRotate(v8::Local<v8::Object> receiver_obj, double angle) {
552
+ CanvasRenderingContext2DImpl *ptr = GetPointer(receiver_obj);
553
+ canvas_native_context_rotate(
554
+ ptr->GetContext(), angle);
555
+ }
556
+
557
+
528
558
  static void Save(const v8::FunctionCallbackInfo<v8::Value> &args);
529
559
 
530
560
  static void FastSave(v8::Local<v8::Object> receiver_obj) {
@@ -569,6 +599,20 @@ public:
569
599
 
570
600
  static void StrokeRect(const v8::FunctionCallbackInfo<v8::Value> &args);
571
601
 
602
+
603
+ static void FastStrokeRect(v8::Local<v8::Object> receiver_obj, double x, double y, double width,
604
+ double height) {
605
+ CanvasRenderingContext2DImpl *ptr = GetPointer(receiver_obj);
606
+
607
+ canvas_native_context_stroke_rect(
608
+ ptr->GetContext(), static_cast<float>(x),
609
+ static_cast<float>(y),
610
+ static_cast<float>(width),
611
+ static_cast<float>(height));
612
+ ptr->UpdateInvalidateState();
613
+ }
614
+
615
+
572
616
  static void StrokeText(const v8::FunctionCallbackInfo<v8::Value> &args);
573
617
 
574
618
  static void Transform(const v8::FunctionCallbackInfo<v8::Value> &args);