@shopify/react-native-skia 0.1.162 → 0.1.164
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/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +2 -0
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +2 -2
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +5 -5
- package/cpp/api/JsiSkCanvas.h +8 -8
- package/cpp/api/JsiSkColor.h +1 -1
- package/cpp/api/JsiSkColorFilter.h +1 -1
- package/cpp/api/JsiSkColorFilterFactory.h +2 -2
- package/cpp/api/JsiSkContourMeasure.h +1 -1
- package/cpp/api/JsiSkContourMeasureIter.h +2 -2
- package/cpp/api/JsiSkData.h +2 -2
- package/cpp/api/JsiSkDataFactory.h +1 -1
- package/cpp/api/JsiSkFont.h +2 -2
- package/cpp/api/JsiSkImage.h +3 -3
- package/cpp/api/JsiSkImageFilter.h +1 -1
- package/cpp/api/JsiSkImageFilterFactory.h +1 -1
- package/cpp/api/JsiSkImageInfo.h +1 -1
- package/cpp/api/JsiSkMaskFilter.h +1 -1
- package/cpp/api/JsiSkMaskFilterFactory.h +1 -1
- package/cpp/api/JsiSkMatrix.h +1 -1
- package/cpp/api/JsiSkPaint.h +7 -1
- package/cpp/api/JsiSkPath.h +15 -15
- package/cpp/api/JsiSkPathEffect.h +1 -1
- package/cpp/api/JsiSkPathEffectFactory.h +4 -4
- package/cpp/api/JsiSkPathFactory.h +2 -2
- package/cpp/api/JsiSkPicture.h +1 -1
- package/cpp/api/JsiSkPictureFactory.h +2 -2
- package/cpp/api/JsiSkPictureRecorder.h +2 -2
- package/cpp/api/JsiSkPoint.h +1 -1
- package/cpp/api/JsiSkRRect.h +1 -1
- package/cpp/api/JsiSkRSXform.h +1 -1
- package/cpp/api/JsiSkRect.h +1 -1
- package/cpp/api/JsiSkRuntimeEffect.h +1 -1
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +1 -1
- package/cpp/api/JsiSkSVGFactory.h +1 -1
- package/cpp/api/JsiSkShader.h +2 -2
- package/cpp/api/JsiSkShaderFactory.h +3 -3
- package/cpp/api/JsiSkSurface.h +1 -1
- package/cpp/api/JsiSkSurfaceFactory.h +2 -2
- package/cpp/api/JsiSkTextBlob.h +1 -1
- package/cpp/api/JsiSkTextBlobFactory.h +1 -1
- package/cpp/api/JsiSkTypeface.h +2 -2
- package/cpp/api/JsiSkVertices.h +1 -1
- package/cpp/jsi/JsiHostObject.h +25 -25
- package/cpp/rnskia/RNSkJsView.h +3 -3
- package/cpp/rnskia/RNSkPictureView.h +3 -3
- package/cpp/rnskia/RNSkPlatformContext.h +5 -3
- package/cpp/rnskia/RNSkView.h +2 -2
- package/cpp/rnskia/dom/base/DrawingContext.cpp +24 -9
- package/cpp/rnskia/dom/base/DrawingContext.h +3 -2
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +12 -2
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +4 -4
- package/cpp/rnskia/dom/base/JsiDomNode.h +68 -10
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +26 -61
- package/cpp/rnskia/dom/base/NodeProp.h +2 -1
- package/cpp/rnskia/dom/base/NodePropsContainer.h +10 -0
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +7 -9
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +3 -6
- package/cpp/rnskia/dom/nodes/JsiBoxNode.h +2 -4
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiCircleNode.h +2 -3
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +4 -8
- package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +2 -7
- package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +4 -8
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +19 -37
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +2 -4
- package/cpp/rnskia/dom/nodes/JsiLineNode.h +2 -7
- package/cpp/rnskia/dom/nodes/JsiOvalNode.h +1 -3
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +2 -3
- package/cpp/rnskia/dom/nodes/JsiPatchNode.h +4 -8
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +14 -28
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +16 -24
- package/cpp/rnskia/dom/nodes/JsiPictureNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiPointsNode.h +2 -5
- package/cpp/rnskia/dom/nodes/JsiRRectNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiRectNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +37 -69
- package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +3 -6
- package/cpp/rnskia/dom/nodes/JsiTextNode.h +4 -8
- package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +2 -4
- package/cpp/rnskia/dom/props/BlendModeProp.h +2 -2
- package/cpp/rnskia/dom/props/PaintProps.h +3 -0
- package/cpp/rnskia/dom/props/TransformProp.h +0 -2
- package/cpp/utils/RNSkLog.h +1 -1
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +8 -7
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -1
- package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +4 -4
- package/ios/RNSkia-iOS/SkiaManager.mm +5 -5
- package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +3 -3
- package/ios/RNSkia-iOS/SkiaUIView.mm +10 -10
- package/lib/commonjs/dom/nodes/RenderNode.js +12 -16
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/index.js +0 -13
- package/lib/commonjs/dom/nodes/datatypes/index.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js +6 -6
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/PatchNode.js +3 -7
- package/lib/commonjs/dom/nodes/drawings/PatchNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/VerticesNode.js +1 -1
- package/lib/commonjs/dom/nodes/drawings/VerticesNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js +1 -3
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/Shaders.js +1 -3
- package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +2 -11
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Container.js +2 -1
- package/lib/commonjs/renderer/Container.js.map +1 -1
- package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
- package/lib/commonjs/renderer/components/Mask.js +11 -25
- package/lib/commonjs/renderer/components/Mask.js.map +1 -1
- package/lib/commonjs/renderer/index.js +0 -13
- package/lib/commonjs/renderer/index.js.map +1 -1
- package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +4 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/web/LoadSkiaWeb.js +1 -1
- package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.js +12 -16
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/index.js +0 -1
- package/lib/module/dom/nodes/datatypes/index.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Box.js +6 -5
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/module/dom/nodes/drawings/PatchNode.js +4 -8
- package/lib/module/dom/nodes/drawings/PatchNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/VerticesNode.js +2 -2
- package/lib/module/dom/nodes/drawings/VerticesNode.js.map +1 -1
- package/lib/module/dom/nodes/paint/ColorFilters.js +1 -2
- package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/ImageFilters.js +2 -2
- package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/Shaders.js +1 -2
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/module/dom/types/DrawingContext.js.map +1 -1
- package/lib/module/renderer/Canvas.js +3 -10
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Container.js +2 -1
- package/lib/module/renderer/Container.js.map +1 -1
- package/lib/module/renderer/DrawingContext.js.map +1 -1
- package/lib/module/renderer/components/Mask.js +9 -21
- package/lib/module/renderer/components/Mask.js.map +1 -1
- package/lib/module/renderer/index.js +0 -1
- package/lib/module/renderer/index.js.map +1 -1
- package/lib/module/skia/types/Paint/Paint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +4 -0
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/web/LoadSkiaWeb.js +1 -1
- package/lib/module/web/LoadSkiaWeb.js.map +1 -1
- package/lib/typescript/src/dom/nodes/datatypes/index.d.ts +0 -1
- package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/drawings/PatchNode.d.ts +1 -1
- package/lib/typescript/src/dom/types/DrawingContext.d.ts +0 -1
- package/lib/typescript/src/renderer/Container.d.ts +1 -1
- package/lib/typescript/src/renderer/DrawingContext.d.ts +3 -5
- package/lib/typescript/src/renderer/index.d.ts +0 -1
- package/lib/typescript/src/skia/types/Paint/Paint.d.ts +4 -0
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/package.json +1 -1
- package/src/dom/nodes/RenderNode.ts +11 -21
- package/src/dom/nodes/datatypes/index.ts +0 -1
- package/src/dom/nodes/drawings/Box.ts +7 -4
- package/src/dom/nodes/drawings/PatchNode.ts +4 -18
- package/src/dom/nodes/drawings/VerticesNode.ts +2 -2
- package/src/dom/nodes/paint/ColorFilters.ts +1 -2
- package/src/dom/nodes/paint/ImageFilters.ts +2 -2
- package/src/dom/nodes/paint/Shaders.ts +1 -2
- package/src/dom/types/DrawingContext.ts +0 -1
- package/src/renderer/Canvas.tsx +2 -12
- package/src/renderer/Container.tsx +1 -1
- package/src/renderer/DrawingContext.ts +5 -5
- package/src/renderer/components/Mask.tsx +11 -20
- package/src/renderer/index.ts +0 -1
- package/src/skia/types/Paint/Paint.ts +5 -0
- package/src/skia/web/JsiSkPaint.ts +4 -0
- package/src/web/LoadSkiaWeb.tsx +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Color.js +0 -27
- package/lib/commonjs/dom/nodes/datatypes/Color.js.map +0 -1
- package/lib/commonjs/renderer/useCanvas.js +0 -32
- package/lib/commonjs/renderer/useCanvas.js.map +0 -1
- package/lib/module/dom/nodes/datatypes/Color.js +0 -11
- package/lib/module/dom/nodes/datatypes/Color.js.map +0 -1
- package/lib/module/renderer/useCanvas.js +0 -15
- package/lib/module/renderer/useCanvas.js.map +0 -1
- package/lib/typescript/src/dom/nodes/datatypes/Color.d.ts +0 -7
- package/lib/typescript/src/renderer/useCanvas.d.ts +0 -9
- package/src/dom/nodes/datatypes/Color.ts +0 -15
- package/src/renderer/useCanvas.ts +0 -21
|
@@ -89,12 +89,10 @@ protected:
|
|
|
89
89
|
|
|
90
90
|
void defineProperties(NodePropsContainer *container) override {
|
|
91
91
|
JsiBaseDomDeclarationNode::defineProperties(container);
|
|
92
|
-
_sourceProp = container->defineProperty(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
_transformProp = container->defineProperty(
|
|
97
|
-
std::make_shared<TransformProp>(JsiPropId::get("transform")));
|
|
92
|
+
_sourceProp = container->defineProperty<NodeProp>("source");
|
|
93
|
+
_uniformsProp =
|
|
94
|
+
container->defineProperty<UniformsProp>("uniforms", _sourceProp);
|
|
95
|
+
_transformProp = container->defineProperty<TransformProp>("transform");
|
|
98
96
|
|
|
99
97
|
_sourceProp->require();
|
|
100
98
|
}
|
|
@@ -141,18 +139,13 @@ protected:
|
|
|
141
139
|
|
|
142
140
|
void defineProperties(NodePropsContainer *container) override {
|
|
143
141
|
JsiBaseDomDeclarationNode::defineProperties(container);
|
|
144
|
-
_txProp = container->defineProperty(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
std::make_shared<NodeProp>(JsiPropId::get("mm")));
|
|
152
|
-
|
|
153
|
-
_imageProps = container->defineProperty(std::make_shared<ImageProps>());
|
|
154
|
-
_transformProp = container->defineProperty(
|
|
155
|
-
std::make_shared<TransformProp>(JsiPropId::get("transform")));
|
|
142
|
+
_txProp = container->defineProperty<TileModeProp>("tx");
|
|
143
|
+
_tyProp = container->defineProperty<TileModeProp>("ty");
|
|
144
|
+
_filterModeProp = container->defineProperty<NodeProp>("fm");
|
|
145
|
+
_mipmapModeProp = container->defineProperty<NodeProp>("mm");
|
|
146
|
+
|
|
147
|
+
_imageProps = container->defineProperty<ImageProps>();
|
|
148
|
+
_transformProp = container->defineProperty<TransformProp>("transform");
|
|
156
149
|
|
|
157
150
|
_txProp->require();
|
|
158
151
|
_tyProp->require();
|
|
@@ -161,10 +154,8 @@ protected:
|
|
|
161
154
|
|
|
162
155
|
_transformProp->require();
|
|
163
156
|
|
|
164
|
-
//
|
|
165
|
-
container
|
|
166
|
-
->defineProperty(std::make_shared<NodeProp>(JsiPropId::get("image")))
|
|
167
|
-
->require();
|
|
157
|
+
// Add and require the image
|
|
158
|
+
container->defineProperty<NodeProp>("image")->require();
|
|
168
159
|
}
|
|
169
160
|
|
|
170
161
|
private:
|
|
@@ -221,8 +212,7 @@ protected:
|
|
|
221
212
|
|
|
222
213
|
void defineProperties(NodePropsContainer *container) override {
|
|
223
214
|
JsiBaseDomDeclarationNode::defineProperties(container);
|
|
224
|
-
_colorProp = container->defineProperty(
|
|
225
|
-
std::make_shared<ColorProp>(JsiPropId::get("color")));
|
|
215
|
+
_colorProp = container->defineProperty<ColorProp>("color");
|
|
226
216
|
_colorProp->require();
|
|
227
217
|
}
|
|
228
218
|
|
|
@@ -239,18 +229,12 @@ public:
|
|
|
239
229
|
protected:
|
|
240
230
|
void defineProperties(NodePropsContainer *container) override {
|
|
241
231
|
JsiBaseDomDeclarationNode::defineProperties(container);
|
|
242
|
-
_freqXProp = container->defineProperty(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
_seedProp = container->defineProperty(
|
|
249
|
-
std::make_shared<NodeProp>(JsiPropId::get("seed")));
|
|
250
|
-
_tileWidthProp = container->defineProperty(
|
|
251
|
-
std::make_shared<NodeProp>(JsiPropId::get("tileWidth")));
|
|
252
|
-
_tileHeightProp = container->defineProperty(
|
|
253
|
-
std::make_shared<NodeProp>(JsiPropId::get("tileHeight")));
|
|
232
|
+
_freqXProp = container->defineProperty<NodeProp>("freqX");
|
|
233
|
+
_freqYProp = container->defineProperty<NodeProp>("freqY");
|
|
234
|
+
_octavesProp = container->defineProperty<NodeProp>("octaves");
|
|
235
|
+
_seedProp = container->defineProperty<NodeProp>("seed");
|
|
236
|
+
_tileWidthProp = container->defineProperty<NodeProp>("tileWidth");
|
|
237
|
+
_tileHeightProp = container->defineProperty<NodeProp>("tileHeight");
|
|
254
238
|
|
|
255
239
|
_freqXProp->require();
|
|
256
240
|
_freqYProp->require();
|
|
@@ -317,17 +301,12 @@ public:
|
|
|
317
301
|
|
|
318
302
|
void defineProperties(NodePropsContainer *container) override {
|
|
319
303
|
JsiBaseDomDeclarationNode::defineProperties(container);
|
|
320
|
-
_transformsProps =
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
std::make_shared<NumbersProp>(JsiPropId::get("positions")));
|
|
327
|
-
_modeProp = container->defineProperty(
|
|
328
|
-
std::make_shared<TileModeProp>(JsiPropId::get("mode")));
|
|
329
|
-
_flagsProp = container->defineProperty(
|
|
330
|
-
std::make_shared<NodeProp>(JsiPropId::get("flags")));
|
|
304
|
+
_transformsProps = container->defineProperty<TransformsProps>();
|
|
305
|
+
|
|
306
|
+
_colorsProp = container->defineProperty<ColorsProp>("colors");
|
|
307
|
+
_positionsProp = container->defineProperty<NumbersProp>("positions");
|
|
308
|
+
_modeProp = container->defineProperty<TileModeProp>("mode");
|
|
309
|
+
_flagsProp = container->defineProperty<NodeProp>("flags");
|
|
331
310
|
|
|
332
311
|
_colorsProp->require();
|
|
333
312
|
}
|
|
@@ -385,10 +364,8 @@ protected:
|
|
|
385
364
|
|
|
386
365
|
void defineProperties(NodePropsContainer *container) override {
|
|
387
366
|
JsiBaseGradientNode::defineProperties(container);
|
|
388
|
-
_startProp = container->defineProperty(
|
|
389
|
-
|
|
390
|
-
_endProp = container->defineProperty(
|
|
391
|
-
std::make_shared<PointProp>(JsiPropId::get("end")));
|
|
367
|
+
_startProp = container->defineProperty<PointProp>("start");
|
|
368
|
+
_endProp = container->defineProperty<PointProp>("end");
|
|
392
369
|
|
|
393
370
|
_startProp->require();
|
|
394
371
|
_endProp->require();
|
|
@@ -420,10 +397,8 @@ protected:
|
|
|
420
397
|
|
|
421
398
|
void defineProperties(NodePropsContainer *container) override {
|
|
422
399
|
JsiBaseGradientNode::defineProperties(container);
|
|
423
|
-
_centerProp = container->defineProperty(
|
|
424
|
-
|
|
425
|
-
_radiusProp = container->defineProperty(
|
|
426
|
-
std::make_shared<NodeProp>(JsiPropId::get("r")));
|
|
400
|
+
_centerProp = container->defineProperty<PointProp>("c");
|
|
401
|
+
_radiusProp = container->defineProperty<NodeProp>("r");
|
|
427
402
|
|
|
428
403
|
_centerProp->require();
|
|
429
404
|
_radiusProp->require();
|
|
@@ -457,12 +432,9 @@ protected:
|
|
|
457
432
|
|
|
458
433
|
void defineProperties(NodePropsContainer *container) override {
|
|
459
434
|
JsiBaseGradientNode::defineProperties(container);
|
|
460
|
-
_startProp = container->defineProperty(
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
std::make_shared<NodeProp>(JsiPropId::get("end")));
|
|
464
|
-
_centerProp = container->defineProperty(
|
|
465
|
-
std::make_shared<PointProp>(JsiPropId::get("c")));
|
|
435
|
+
_startProp = container->defineProperty<NodeProp>("start");
|
|
436
|
+
_endProp = container->defineProperty<NodeProp>("end");
|
|
437
|
+
_centerProp = container->defineProperty<PointProp>("c");
|
|
466
438
|
}
|
|
467
439
|
|
|
468
440
|
private:
|
|
@@ -497,14 +469,10 @@ protected:
|
|
|
497
469
|
|
|
498
470
|
void defineProperties(NodePropsContainer *container) override {
|
|
499
471
|
JsiBaseGradientNode::defineProperties(container);
|
|
500
|
-
_startProp = container->defineProperty(
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
_endProp = container->defineProperty(
|
|
505
|
-
std::make_shared<PointProp>(JsiPropId::get("end")));
|
|
506
|
-
_endRProp = container->defineProperty(
|
|
507
|
-
std::make_shared<NodeProp>(JsiPropId::get("endR")));
|
|
472
|
+
_startProp = container->defineProperty<PointProp>("start");
|
|
473
|
+
_startRProp = container->defineProperty<NodeProp>("startR");
|
|
474
|
+
_endProp = container->defineProperty<PointProp>("end");
|
|
475
|
+
_endRProp = container->defineProperty<NodeProp>("endR");
|
|
508
476
|
}
|
|
509
477
|
|
|
510
478
|
private:
|
|
@@ -26,12 +26,9 @@ protected:
|
|
|
26
26
|
void defineProperties(NodePropsContainer *container) override {
|
|
27
27
|
JsiDomDrawingNode::defineProperties(container);
|
|
28
28
|
|
|
29
|
-
_textBlobProp = container->defineProperty(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
std::make_shared<NodeProp>(JsiPropId::get("x")));
|
|
33
|
-
_yProp = container->defineProperty(
|
|
34
|
-
std::make_shared<NodeProp>(JsiPropId::get("y")));
|
|
29
|
+
_textBlobProp = container->defineProperty<TextBlobProp>("blob");
|
|
30
|
+
_xProp = container->defineProperty<NodeProp>("x");
|
|
31
|
+
_yProp = container->defineProperty<NodeProp>("y");
|
|
35
32
|
|
|
36
33
|
_textBlobProp->require();
|
|
37
34
|
_xProp->require();
|
|
@@ -29,14 +29,10 @@ protected:
|
|
|
29
29
|
void defineProperties(NodePropsContainer *container) override {
|
|
30
30
|
JsiDomDrawingNode::defineProperties(container);
|
|
31
31
|
|
|
32
|
-
_fontProp = container->defineProperty(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_xProp = container->defineProperty(
|
|
37
|
-
std::make_shared<NodeProp>(JsiPropId::get("x")));
|
|
38
|
-
_yProp = container->defineProperty(
|
|
39
|
-
std::make_shared<NodeProp>(JsiPropId::get("y")));
|
|
32
|
+
_fontProp = container->defineProperty<FontProp>("font");
|
|
33
|
+
_textProp = container->defineProperty<NodeProp>("text");
|
|
34
|
+
_xProp = container->defineProperty<NodeProp>("x");
|
|
35
|
+
_yProp = container->defineProperty<NodeProp>("y");
|
|
40
36
|
|
|
41
37
|
_fontProp->require();
|
|
42
38
|
_textProp->require();
|
|
@@ -21,8 +21,7 @@ protected:
|
|
|
21
21
|
|
|
22
22
|
void defineProperties(NodePropsContainer *container) override {
|
|
23
23
|
JsiDomDrawingNode::defineProperties(container);
|
|
24
|
-
_textBlobProp =
|
|
25
|
-
container->defineProperty(std::make_shared<TextPathBlobProp>());
|
|
24
|
+
_textBlobProp = container->defineProperty<TextPathBlobProp>();
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
private:
|
|
@@ -29,10 +29,8 @@ protected:
|
|
|
29
29
|
|
|
30
30
|
void defineProperties(NodePropsContainer *container) override {
|
|
31
31
|
JsiDomDrawingNode::defineProperties(container);
|
|
32
|
-
_verticesProps =
|
|
33
|
-
|
|
34
|
-
_blendModeProp = container->defineProperty(
|
|
35
|
-
std::make_shared<BlendModeProp>(JsiPropId::get("blendMode")));
|
|
32
|
+
_verticesProps = container->defineProperty<VerticesProps>();
|
|
33
|
+
_blendModeProp = container->defineProperty<BlendModeProp>("blendMode");
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
private:
|
|
@@ -43,11 +43,11 @@ private:
|
|
|
43
43
|
return SkBlendMode::kDstOver;
|
|
44
44
|
} else if (value == "srcIn") {
|
|
45
45
|
return SkBlendMode::kSrcIn;
|
|
46
|
-
} else if (value == "
|
|
46
|
+
} else if (value == "dstIn") {
|
|
47
47
|
return SkBlendMode::kDstIn;
|
|
48
48
|
} else if (value == "srcOut") {
|
|
49
49
|
return SkBlendMode::kSrcOut;
|
|
50
|
-
} else if (value == "
|
|
50
|
+
} else if (value == "dstOut") {
|
|
51
51
|
return SkBlendMode::kDstOut;
|
|
52
52
|
} else if (value == "srcATop") {
|
|
53
53
|
return SkBlendMode::kSrcATop;
|
|
@@ -105,6 +105,9 @@ public:
|
|
|
105
105
|
paint->setShader(nullptr);
|
|
106
106
|
paint->setColor(*_color->getDerivedValue());
|
|
107
107
|
paint->setAlphaf(context->getOpacity() * paint->getColor4f().fA);
|
|
108
|
+
} else if (context->isChanged()) {
|
|
109
|
+
auto paint = context->getMutablePaint();
|
|
110
|
+
paint->setAlphaf(context->getOpacity());
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
// Style
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
namespace RNSkia {
|
|
10
10
|
|
|
11
|
-
static PropId PropNameTransform = JsiPropId::get("transform");
|
|
12
|
-
|
|
13
11
|
static PropId PropNameTranslateX = JsiPropId::get("translateX");
|
|
14
12
|
static PropId PropNameTranslateY = JsiPropId::get("translateY");
|
|
15
13
|
static PropId PropNameScale = JsiPropId::get("scale");
|
package/cpp/utils/RNSkLog.h
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
#pragma clang diagnostic push
|
|
5
5
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
6
6
|
|
|
7
|
-
#import
|
|
8
|
-
#import
|
|
9
|
-
#import
|
|
7
|
+
#import "SkColorSpace.h"
|
|
8
|
+
#import "SkSurface.h"
|
|
9
|
+
#import "SkCanvas.h"
|
|
10
10
|
|
|
11
11
|
#import <include/gpu/GrDirectContext.h>
|
|
12
12
|
|
|
@@ -33,9 +33,9 @@ RNSkCanvasProvider(requestRedraw),
|
|
|
33
33
|
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
|
34
34
|
_layer = [CAMetalLayer layer];
|
|
35
35
|
#pragma clang diagnostic pop
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
auto device = MTLCreateSystemDefaultDevice();
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
_layer.framebufferOnly = NO;
|
|
40
40
|
_layer.device = device;
|
|
41
41
|
_layer.opaque = false;
|
|
@@ -74,12 +74,13 @@ void RNSkMetalCanvasProvider::renderToCanvas(const std::function<void(SkCanvas*)
|
|
|
74
74
|
renderContext->commandQueue = id<MTLCommandQueue>(CFRetain((GrMTLHandle)[device newCommandQueue]));
|
|
75
75
|
renderContext->skContext = GrDirectContext::MakeMetal((__bridge void*)device, (__bridge void*)renderContext->commandQueue);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
// Wrap in auto release pool since we want the system to clean up after rendering
|
|
79
79
|
// and not wait until later - we've seen some example of memory usage growing very
|
|
80
80
|
// fast in the simulator without this.
|
|
81
81
|
@autoreleasepool
|
|
82
82
|
{
|
|
83
|
+
|
|
83
84
|
GrMTLHandle drawableHandle;
|
|
84
85
|
auto skSurface = SkSurface::MakeFromCAMetalLayer(renderContext->skContext.get(),
|
|
85
86
|
(__bridge GrMTLHandle)_layer,
|
|
@@ -114,7 +115,7 @@ void RNSkMetalCanvasProvider::setSize(int width, int height) {
|
|
|
114
115
|
_layer.frame = CGRectMake(0, 0, width, height);
|
|
115
116
|
_layer.drawableSize = CGSizeMake(width * _context->getPixelDensity(),
|
|
116
117
|
height* _context->getPixelDensity());
|
|
117
|
-
|
|
118
|
+
|
|
118
119
|
_requestRedraw();
|
|
119
120
|
}
|
|
120
121
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#pragma clang diagnostic push
|
|
13
13
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
14
14
|
|
|
15
|
-
#include
|
|
15
|
+
#include "SkStream.h"
|
|
16
16
|
|
|
17
17
|
#pragma clang diagnostic pop
|
|
18
18
|
|
|
@@ -48,6 +48,7 @@ public:
|
|
|
48
48
|
~RNSkiOSPlatformContext() {
|
|
49
49
|
CFNotificationCenterRemoveEveryObserver(
|
|
50
50
|
CFNotificationCenterGetLocalCenter(), this);
|
|
51
|
+
stopDrawLoop();
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
void startDrawLoop() override;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#include
|
|
1
|
+
#include "SkiaDrawViewManager.h"
|
|
2
2
|
#include <React/RCTBridge+Private.h>
|
|
3
3
|
|
|
4
4
|
#include <RNSkPlatformContext.h>
|
|
5
5
|
#include <RNSkJsView.h>
|
|
6
6
|
#include <RNSkIOSView.h>
|
|
7
7
|
|
|
8
|
-
#include
|
|
8
|
+
#include "SkiaManager.h"
|
|
9
9
|
#include <RNSkiaModule.h>
|
|
10
|
-
#include
|
|
10
|
+
#include "SkiaUIView.h"
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -24,7 +24,7 @@ RCT_EXPORT_MODULE(SkiaDrawView)
|
|
|
24
24
|
RCT_CUSTOM_VIEW_PROPERTY(nativeID, NSNumber, SkiaUIView) {
|
|
25
25
|
// Get parameter
|
|
26
26
|
int nativeId = [[RCTConvert NSString:json] intValue];
|
|
27
|
-
[(SkiaUIView*)view setNativeId:nativeId];
|
|
27
|
+
[(SkiaUIView*)view setNativeId:nativeId];
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
RCT_CUSTOM_VIEW_PROPERTY(mode, NSString, SkiaUIView) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#import
|
|
1
|
+
#import "SkiaManager.h"
|
|
2
2
|
|
|
3
3
|
#import <Foundation/Foundation.h>
|
|
4
4
|
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
if (self) {
|
|
33
33
|
RCTCxxBridge *cxxBridge = (RCTCxxBridge *)bridge;
|
|
34
34
|
if (cxxBridge.runtime) {
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
auto callInvoker = bridge.jsCallInvoker;
|
|
37
37
|
facebook::jsi::Runtime* jsRuntime = (facebook::jsi::Runtime*)cxxBridge.runtime;
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
// Create platform context
|
|
40
40
|
_platformContext = std::make_shared<RNSkia::RNSkiOSPlatformContext>(jsRuntime, callInvoker);
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
// Create the RNSkiaManager (cross platform)
|
|
43
43
|
_skManager = std::make_shared<RNSkia::RNSkManager>(jsRuntime, callInvoker, _platformContext);
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
return self;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
#include
|
|
2
|
+
#include "SkiaPictureViewManager.h"
|
|
3
3
|
#include <React/RCTBridge+Private.h>
|
|
4
4
|
|
|
5
5
|
#include <RNSkPlatformContext.h>
|
|
6
6
|
#include <RNSkPictureView.h>
|
|
7
7
|
#include <RNSkIOSView.h>
|
|
8
8
|
|
|
9
|
-
#include
|
|
9
|
+
#include "SkiaManager.h"
|
|
10
10
|
#include <RNSkiaModule.h>
|
|
11
|
-
#include
|
|
11
|
+
#include "SkiaUIView.h"
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#import <React/RCTBridge.h>
|
|
2
2
|
|
|
3
|
-
#import
|
|
3
|
+
#import "SkiaUIView.h"
|
|
4
4
|
|
|
5
5
|
#include <utility>
|
|
6
6
|
#include <vector>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
_debugMode = false;
|
|
30
30
|
_drawingMode = RNSkia::RNSkDrawingMode::Default;
|
|
31
31
|
_factory = factory;
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
// Listen to notifications about module invalidation
|
|
34
34
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
35
35
|
selector:@selector(willInvalidateModules)
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
// Remove implementation view when the parent view is not set
|
|
52
52
|
if(_impl != nullptr) {
|
|
53
53
|
[_impl->getLayer() removeFromSuperlayer];
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
if(_nativeId != 0 && _manager != nullptr) {
|
|
56
56
|
_manager->setSkiaView(_nativeId, nullptr);
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
_impl = nullptr;
|
|
60
60
|
}
|
|
61
61
|
} else {
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
if(_manager != nullptr && _nativeId != 0) {
|
|
80
80
|
_manager->unregisterSkiaView(_nativeId);
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
assert(_impl == nullptr);
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
|
|
99
99
|
-(void) setDrawingMode:(std::string) mode {
|
|
100
100
|
_drawingMode = mode.compare("continuous") == 0 ? RNSkia::RNSkDrawingMode::Continuous : RNSkia::RNSkDrawingMode::Default;
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
if(_impl != nullptr) {
|
|
103
103
|
_impl->getDrawView()->setDrawingMode(_drawingMode);
|
|
104
104
|
}
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
|
|
114
114
|
- (void) setNativeId:(size_t) nativeId {
|
|
115
115
|
_nativeId = nativeId;
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
if(_impl != nullptr) {
|
|
118
118
|
_manager->registerSkiaView(nativeId, _impl->getDrawView());
|
|
119
119
|
}
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
RNSkia::RNSkTouchInfo nextTouch;
|
|
148
148
|
nextTouch.x = position.x;
|
|
149
149
|
nextTouch.y = position.y;
|
|
150
|
-
nextTouch.force = [touch force];
|
|
150
|
+
nextTouch.force = [touch force];
|
|
151
151
|
nextTouch.id = [touch hash];
|
|
152
152
|
auto phase = [touch phase];
|
|
153
153
|
switch(phase) {
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
|
|
168
168
|
break;
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
nextTouches.push_back(nextTouch);
|
|
172
172
|
}
|
|
173
173
|
if(_impl != nullptr) {
|
|
@@ -115,7 +115,9 @@ class JsiRenderNode extends _Node.JsiNode {
|
|
|
115
115
|
} = this.props;
|
|
116
116
|
|
|
117
117
|
if (color !== undefined || strokeWidth !== undefined || blendMode !== undefined || style !== undefined || strokeJoin !== undefined || strokeCap !== undefined || strokeMiter !== undefined || opacity !== undefined || antiAlias !== undefined) {
|
|
118
|
-
ctx = {
|
|
118
|
+
ctx = {
|
|
119
|
+
opacity: 1
|
|
120
|
+
};
|
|
119
121
|
|
|
120
122
|
if (color !== undefined) {
|
|
121
123
|
ctx.color = this.Skia.Color(color);
|
|
@@ -193,11 +195,10 @@ class JsiRenderNode extends _Node.JsiNode {
|
|
|
193
195
|
const {
|
|
194
196
|
canvas
|
|
195
197
|
} = parentCtx;
|
|
196
|
-
const opacity = this.props.opacity !== undefined ? parentCtx.opacity * this.props.opacity : parentCtx.opacity;
|
|
197
198
|
|
|
198
199
|
if (this.paintCache === null || this.paintCache.parent !== parentCtx.paint) {
|
|
199
200
|
const paintCtx = this.getPaintCtx();
|
|
200
|
-
const child = paintCtx ? concatPaint(parentCtx.paint, paintCtx
|
|
201
|
+
const child = paintCtx ? concatPaint(parentCtx.paint.copy(), paintCtx) : parentCtx.paint;
|
|
201
202
|
this.paintCache = {
|
|
202
203
|
parent: parentCtx.paint,
|
|
203
204
|
child
|
|
@@ -207,7 +208,6 @@ class JsiRenderNode extends _Node.JsiNode {
|
|
|
207
208
|
const paint = this.paintCache.child; // TODO: can we only recreate a new context here if needed?
|
|
208
209
|
|
|
209
210
|
const ctx = { ...parentCtx,
|
|
210
|
-
opacity,
|
|
211
211
|
paint
|
|
212
212
|
};
|
|
213
213
|
const hasTransform = matrix !== undefined || transform !== undefined;
|
|
@@ -250,7 +250,7 @@ class JsiRenderNode extends _Node.JsiNode {
|
|
|
250
250
|
|
|
251
251
|
exports.JsiRenderNode = JsiRenderNode;
|
|
252
252
|
|
|
253
|
-
const concatPaint = (
|
|
253
|
+
const concatPaint = (paint, _ref) => {
|
|
254
254
|
let {
|
|
255
255
|
color,
|
|
256
256
|
strokeWidth,
|
|
@@ -261,22 +261,22 @@ const concatPaint = (parent, _ref, opacity) => {
|
|
|
261
261
|
imageFilter,
|
|
262
262
|
maskFilter,
|
|
263
263
|
pathEffect,
|
|
264
|
-
opacity
|
|
264
|
+
opacity,
|
|
265
265
|
strokeCap,
|
|
266
266
|
strokeJoin,
|
|
267
267
|
strokeMiter,
|
|
268
268
|
style
|
|
269
269
|
} = _ref;
|
|
270
|
-
|
|
270
|
+
|
|
271
|
+
if (opacity !== undefined) {
|
|
272
|
+
paint.setAlphaf(paint.getAlphaf() * opacity);
|
|
273
|
+
}
|
|
271
274
|
|
|
272
275
|
if (color !== undefined) {
|
|
276
|
+
const currentOpacity = paint.getAlphaf();
|
|
273
277
|
paint.setShader(null);
|
|
274
|
-
color[3] *= opacity;
|
|
275
278
|
paint.setColor(color);
|
|
276
|
-
|
|
277
|
-
const cl = paint.getColor();
|
|
278
|
-
cl[3] = opacity;
|
|
279
|
-
paint.setColor(cl);
|
|
279
|
+
paint.setAlphaf(currentOpacity * paint.getAlphaf());
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
if (strokeWidth !== undefined) {
|
|
@@ -311,10 +311,6 @@ const concatPaint = (parent, _ref, opacity) => {
|
|
|
311
311
|
paint.setPathEffect(pathEffect);
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
if (alpha !== undefined) {
|
|
315
|
-
paint.setAlphaf(alpha * opacity);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
314
|
if (strokeCap !== undefined) {
|
|
319
315
|
paint.setStrokeCap(strokeCap);
|
|
320
316
|
}
|