@shopify/react-native-skia 0.1.207 → 0.1.209
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +19 -12
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureView.java +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +2 -0
- package/cpp/api/JsiSkColorFilter.h +1 -1
- package/cpp/api/JsiSkContourMeasure.h +1 -1
- package/cpp/api/JsiSkContourMeasureIter.h +1 -1
- package/cpp/api/JsiSkData.h +1 -1
- package/cpp/api/JsiSkFont.h +1 -1
- package/cpp/api/JsiSkFontMgr.h +2 -2
- package/cpp/api/JsiSkFontStyle.h +11 -5
- package/cpp/api/JsiSkImage.h +1 -1
- package/cpp/api/JsiSkImageFilter.h +1 -1
- package/cpp/api/JsiSkMaskFilter.h +1 -1
- package/cpp/api/JsiSkMatrix.h +1 -1
- package/cpp/api/JsiSkPaint.h +8 -1
- package/cpp/api/JsiSkPath.h +11 -8
- package/cpp/api/JsiSkPathEffect.h +1 -1
- package/cpp/api/JsiSkPicture.h +1 -1
- package/cpp/api/JsiSkPictureRecorder.h +1 -1
- package/cpp/api/JsiSkRuntimeEffect.h +1 -1
- package/cpp/api/JsiSkSVG.h +1 -1
- package/cpp/api/JsiSkShader.h +1 -1
- package/cpp/api/JsiSkSurface.h +1 -1
- package/cpp/api/JsiSkTextBlob.h +1 -1
- package/cpp/api/JsiSkTypeFaceFontProvider.h +4 -2
- package/cpp/api/JsiSkTypeface.h +24 -2
- package/cpp/api/JsiSkVertices.h +1 -1
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +4 -0
- package/cpp/rnskia/dom/props/FontProp.h +3 -1
- package/cpp/rnskia/dom/props/PaintProps.h +3 -0
- package/lib/commonjs/dom/nodes/PaintContext.d.ts +1 -0
- package/lib/commonjs/dom/nodes/PaintContext.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintNode.js +6 -1
- package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Text.d.ts +3 -3
- package/lib/commonjs/dom/nodes/drawings/Text.js +26 -4
- package/lib/commonjs/dom/nodes/drawings/Text.js.map +1 -1
- package/lib/commonjs/dom/types/Common.d.ts +1 -0
- package/lib/commonjs/dom/types/Common.js.map +1 -1
- package/lib/commonjs/dom/types/DrawingContext.js +15 -0
- package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
- package/lib/commonjs/dom/types/Drawings.d.ts +1 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.js +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/skia/types/Font/FontMgr.d.ts +1 -1
- package/lib/commonjs/skia/types/Font/FontMgr.js.map +1 -1
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +12 -11
- package/lib/commonjs/skia/types/Image/ImageFactory.js +12 -11
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Paint/Paint.d.ts +5 -0
- package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/types/Typeface/Typeface.d.ts +10 -1
- package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js +4 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +10 -1
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkTypeface.js +4 -0
- package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/module/dom/nodes/PaintContext.d.ts +1 -0
- package/lib/module/dom/nodes/PaintContext.js.map +1 -1
- package/lib/module/dom/nodes/PaintNode.js +6 -1
- package/lib/module/dom/nodes/PaintNode.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.js +1 -1
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Text.d.ts +3 -3
- package/lib/module/dom/nodes/drawings/Text.js +26 -4
- package/lib/module/dom/nodes/drawings/Text.js.map +1 -1
- package/lib/module/dom/types/Common.d.ts +1 -0
- package/lib/module/dom/types/Common.js.map +1 -1
- package/lib/module/dom/types/DrawingContext.js +15 -0
- package/lib/module/dom/types/DrawingContext.js.map +1 -1
- package/lib/module/dom/types/Drawings.d.ts +1 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.js +1 -1
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/skia/types/Font/FontMgr.d.ts +1 -1
- package/lib/module/skia/types/Font/FontMgr.js.map +1 -1
- package/lib/module/skia/types/Image/ImageFactory.d.ts +12 -11
- package/lib/module/skia/types/Image/ImageFactory.js +12 -11
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/Paint/Paint.d.ts +5 -0
- package/lib/module/skia/types/Paint/Paint.js.map +1 -1
- package/lib/module/skia/types/Typeface/Typeface.d.ts +10 -1
- package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/module/skia/web/JsiSkPaint.js +4 -0
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +1 -1
- package/lib/module/skia/web/JsiSkPath.js +11 -1
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypeface.d.ts +1 -0
- package/lib/module/skia/web/JsiSkTypeface.js +4 -0
- package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/typescript/src/dom/nodes/PaintContext.d.ts +1 -0
- package/lib/typescript/src/dom/nodes/drawings/Text.d.ts +3 -3
- package/lib/typescript/src/dom/types/Common.d.ts +1 -0
- package/lib/typescript/src/dom/types/Drawings.d.ts +1 -1
- package/lib/typescript/src/skia/types/Font/FontMgr.d.ts +1 -1
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +12 -11
- package/lib/typescript/src/skia/types/Paint/Paint.d.ts +5 -0
- package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +10 -1
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +1 -0
- package/package.json +2 -2
- package/src/dom/nodes/PaintContext.ts +1 -0
- package/src/dom/nodes/PaintNode.ts +4 -0
- package/src/dom/nodes/RenderNode.ts +1 -0
- package/src/dom/nodes/drawings/Text.ts +31 -5
- package/src/dom/types/Common.ts +1 -0
- package/src/dom/types/DrawingContext.ts +13 -0
- package/src/dom/types/Drawings.ts +1 -1
- package/src/external/reanimated/moduleWrapper.ts +1 -1
- package/src/skia/types/Font/FontMgr.ts +1 -1
- package/src/skia/types/Image/ImageFactory.ts +1 -0
- package/src/skia/types/Paint/Paint.ts +6 -0
- package/src/skia/types/Typeface/Typeface.ts +10 -1
- package/src/skia/web/JsiSkPaint.ts +4 -0
- package/src/skia/web/JsiSkPath.ts +8 -1
- package/src/skia/web/JsiSkTypeface.ts +4 -0
@@ -18,8 +18,11 @@ public abstract class SkiaBaseView extends ReactViewGroup implements TextureView
|
|
18
18
|
|
19
19
|
private String tag = "SkiaView";
|
20
20
|
|
21
|
-
|
21
|
+
private boolean manageTexture = false;
|
22
|
+
|
23
|
+
public SkiaBaseView(Context context, boolean manageTexture) {
|
22
24
|
super(context);
|
25
|
+
this.manageTexture = manageTexture;
|
23
26
|
mTexture = new TextureView(context);
|
24
27
|
mTexture.setSurfaceTextureListener(this);
|
25
28
|
mTexture.setOpaque(false);
|
@@ -27,19 +30,23 @@ public abstract class SkiaBaseView extends ReactViewGroup implements TextureView
|
|
27
30
|
}
|
28
31
|
|
29
32
|
public void destroySurface() {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
if (mSurface != null) {
|
34
|
+
Log.i(tag, "destroySurface");
|
35
|
+
surfaceDestroyed();
|
36
|
+
mSurface.release();
|
37
|
+
mSurface = null;
|
38
|
+
}
|
34
39
|
}
|
35
40
|
|
36
41
|
private void createSurfaceTexture() {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
if (manageTexture) {
|
43
|
+
// This API Level is >= 26, we created our own SurfaceTexture to have a faster time to first frame
|
44
|
+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
45
|
+
Log.i(tag, "Create SurfaceTexture");
|
46
|
+
SurfaceTexture surface = new SurfaceTexture(false);
|
47
|
+
mTexture.setSurfaceTexture(surface);
|
48
|
+
this.onSurfaceTextureAvailable(surface, this.getMeasuredWidth(), this.getMeasuredHeight());
|
49
|
+
}
|
43
50
|
}
|
44
51
|
}
|
45
52
|
|
@@ -145,7 +152,7 @@ public abstract class SkiaBaseView extends ReactViewGroup implements TextureView
|
|
145
152
|
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
|
146
153
|
Log.i(tag, "onSurfaceTextureDestroyed");
|
147
154
|
// https://developer.android.com/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureDestroyed(android.graphics.SurfaceTexture)
|
148
|
-
|
155
|
+
destroySurface();
|
149
156
|
createSurfaceTexture();
|
150
157
|
return false;
|
151
158
|
}
|
@@ -29,7 +29,7 @@ public abstract class SkiaBaseViewManager extends ReactViewManager {
|
|
29
29
|
@Override
|
30
30
|
public void onDropViewInstance(@NonNull ReactViewGroup view) {
|
31
31
|
super.onDropViewInstance(view);
|
32
|
-
((SkiaBaseView)view).unregisterView();
|
33
32
|
((SkiaBaseView)view).destroySurface();
|
33
|
+
((SkiaBaseView)view).unregisterView();
|
34
34
|
}
|
35
35
|
}
|
@@ -11,7 +11,7 @@ public class SkiaDomView extends SkiaBaseView {
|
|
11
11
|
private HybridData mHybridData;
|
12
12
|
|
13
13
|
public SkiaDomView(Context context) {
|
14
|
-
super(context);
|
14
|
+
super(context, true);
|
15
15
|
RNSkiaModule skiaModule = ((ReactContext) context).getNativeModule(RNSkiaModule.class);
|
16
16
|
mHybridData = initHybrid(skiaModule.getSkiaManager());
|
17
17
|
}
|
@@ -11,7 +11,7 @@ public class SkiaDrawView extends SkiaBaseView {
|
|
11
11
|
private HybridData mHybridData;
|
12
12
|
|
13
13
|
public SkiaDrawView(Context context) {
|
14
|
-
super(context);
|
14
|
+
super(context, false);
|
15
15
|
RNSkiaModule skiaModule = ((ReactContext) context).getNativeModule(RNSkiaModule.class);
|
16
16
|
mHybridData = initHybrid(skiaModule.getSkiaManager());
|
17
17
|
}
|
@@ -11,7 +11,7 @@ public class SkiaPictureView extends SkiaBaseView {
|
|
11
11
|
private HybridData mHybridData;
|
12
12
|
|
13
13
|
public SkiaPictureView(Context context) {
|
14
|
-
super(context);
|
14
|
+
super(context, true);
|
15
15
|
RNSkiaModule skiaModule = ((ReactContext) context).getNativeModule(RNSkiaModule.class);
|
16
16
|
mHybridData = initHybrid(skiaModule.getSkiaManager());
|
17
17
|
}
|
@@ -93,7 +93,9 @@ public class ViewScreenshotService {
|
|
93
93
|
}
|
94
94
|
|
95
95
|
// Draw ourselves
|
96
|
+
canvas.saveLayerAlpha(null, Math.round(view.getAlpha() * 255));
|
96
97
|
view.draw(canvas);
|
98
|
+
canvas.restore();
|
97
99
|
|
98
100
|
// Enable children again
|
99
101
|
for (int i = 0; i < visibleChildren.size(); i++) {
|
@@ -23,7 +23,7 @@ public:
|
|
23
23
|
: JsiSkWrappingSkPtrHostObject<SkColorFilter>(std::move(context),
|
24
24
|
std::move(colorFilter)) {}
|
25
25
|
|
26
|
-
EXPORT_JSI_API_TYPENAME(JsiSkColorFilter,
|
26
|
+
EXPORT_JSI_API_TYPENAME(JsiSkColorFilter, ColorFilter)
|
27
27
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkColorFilter, dispose))
|
28
28
|
};
|
29
29
|
|
@@ -68,7 +68,7 @@ public:
|
|
68
68
|
return JsiSkPath::toValue(runtime, getContext(), std::move(path));
|
69
69
|
}
|
70
70
|
|
71
|
-
EXPORT_JSI_API_TYPENAME(JsiSkContourMeasure,
|
71
|
+
EXPORT_JSI_API_TYPENAME(JsiSkContourMeasure, ContourMeasure)
|
72
72
|
|
73
73
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkContourMeasure, getPosTan),
|
74
74
|
JSI_EXPORT_FUNC(JsiSkContourMeasure, length),
|
@@ -40,7 +40,7 @@ public:
|
|
40
40
|
return jsi::Object::createFromHostObject(runtime, std::move(nextObject));
|
41
41
|
}
|
42
42
|
|
43
|
-
EXPORT_JSI_API_TYPENAME(JsiSkContourMeasureIter,
|
43
|
+
EXPORT_JSI_API_TYPENAME(JsiSkContourMeasureIter, ContourMeasureIter)
|
44
44
|
|
45
45
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkContourMeasureIter, next),
|
46
46
|
JSI_EXPORT_FUNC(JsiSkContourMeasureIter, dispose))
|
package/cpp/api/JsiSkData.h
CHANGED
@@ -24,7 +24,7 @@ public:
|
|
24
24
|
JsiSkData(std::shared_ptr<RNSkPlatformContext> context, sk_sp<SkData> asset)
|
25
25
|
: JsiSkWrappingSkPtrHostObject(std::move(context), std::move(asset)) {}
|
26
26
|
|
27
|
-
EXPORT_JSI_API_TYPENAME(JsiSkData,
|
27
|
+
EXPORT_JSI_API_TYPENAME(JsiSkData, Data)
|
28
28
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkData, dispose))
|
29
29
|
};
|
30
30
|
} // namespace RNSkia
|
package/cpp/api/JsiSkFont.h
CHANGED
@@ -239,7 +239,7 @@ public:
|
|
239
239
|
return jsi::Value::undefined();
|
240
240
|
}
|
241
241
|
|
242
|
-
EXPORT_JSI_API_TYPENAME(JsiSkFont,
|
242
|
+
EXPORT_JSI_API_TYPENAME(JsiSkFont, Font)
|
243
243
|
|
244
244
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkFont, getSize),
|
245
245
|
JSI_EXPORT_FUNC(JsiSkFont, getMetrics),
|
package/cpp/api/JsiSkFontMgr.h
CHANGED
@@ -23,7 +23,7 @@ namespace jsi = facebook::jsi;
|
|
23
23
|
|
24
24
|
class JsiSkFontMgr : public JsiSkWrappingSkPtrHostObject<SkFontMgr> {
|
25
25
|
public:
|
26
|
-
EXPORT_JSI_API_TYPENAME(JsiSkFontMgr,
|
26
|
+
EXPORT_JSI_API_TYPENAME(JsiSkFontMgr, FontMgr)
|
27
27
|
|
28
28
|
JsiSkFontMgr(std::shared_ptr<RNSkPlatformContext> context,
|
29
29
|
sk_sp<SkFontMgr> fontMgr)
|
@@ -51,4 +51,4 @@ public:
|
|
51
51
|
JSI_EXPORT_FUNC(JsiSkFontMgr, matchFamilyStyle))
|
52
52
|
};
|
53
53
|
|
54
|
-
} // namespace RNSkia
|
54
|
+
} // namespace RNSkia
|
package/cpp/api/JsiSkFontStyle.h
CHANGED
@@ -36,12 +36,18 @@ public:
|
|
36
36
|
if (object.isHostObject(runtime)) {
|
37
37
|
return object.asHostObject<JsiSkFontStyle>(runtime)->getObject();
|
38
38
|
} else {
|
39
|
-
auto
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
auto weightProp = object.getProperty(runtime, "weight");
|
40
|
+
auto weight = static_cast<int>(weightProp.isUndefined()
|
41
|
+
? SkFontStyle::Weight::kNormal_Weight
|
42
|
+
: weightProp.asNumber());
|
43
|
+
auto widthProp = object.getProperty(runtime, "width");
|
44
|
+
auto width = static_cast<int>(widthProp.isUndefined()
|
45
|
+
? SkFontStyle::Width::kNormal_Width
|
46
|
+
: widthProp.asNumber());
|
47
|
+
auto slantProp = object.getProperty(runtime, "slant");
|
43
48
|
auto slant = static_cast<SkFontStyle::Slant>(
|
44
|
-
|
49
|
+
slantProp.isUndefined() ? SkFontStyle::Slant::kUpright_Slant
|
50
|
+
: slantProp.asNumber());
|
45
51
|
SkFontStyle style(weight, width, slant);
|
46
52
|
return std::make_shared<SkFontStyle>(style);
|
47
53
|
}
|
package/cpp/api/JsiSkImage.h
CHANGED
@@ -131,7 +131,7 @@ public:
|
|
131
131
|
runtime, std::make_shared<JsiSkImage>(getContext(), std::move(image)));
|
132
132
|
}
|
133
133
|
|
134
|
-
EXPORT_JSI_API_TYPENAME(JsiSkImage,
|
134
|
+
EXPORT_JSI_API_TYPENAME(JsiSkImage, Image)
|
135
135
|
|
136
136
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkImage, width),
|
137
137
|
JSI_EXPORT_FUNC(JsiSkImage, height),
|
@@ -25,7 +25,7 @@ public:
|
|
25
25
|
: JsiSkWrappingSkPtrHostObject<SkImageFilter>(std::move(context),
|
26
26
|
std::move(imageFilter)) {}
|
27
27
|
|
28
|
-
EXPORT_JSI_API_TYPENAME(JsiSkImageFilter,
|
28
|
+
EXPORT_JSI_API_TYPENAME(JsiSkImageFilter, ImageFilter)
|
29
29
|
};
|
30
30
|
|
31
31
|
} // namespace RNSkia
|
package/cpp/api/JsiSkMatrix.h
CHANGED
package/cpp/api/JsiSkPaint.h
CHANGED
@@ -25,7 +25,7 @@ namespace jsi = facebook::jsi;
|
|
25
25
|
|
26
26
|
class JsiSkPaint : public JsiSkWrappingSharedPtrHostObject<SkPaint> {
|
27
27
|
public:
|
28
|
-
EXPORT_JSI_API_TYPENAME(JsiSkPaint,
|
28
|
+
EXPORT_JSI_API_TYPENAME(JsiSkPaint, Paint)
|
29
29
|
|
30
30
|
JSI_HOST_FUNCTION(copy) {
|
31
31
|
const auto *paint = getObject().get();
|
@@ -81,6 +81,12 @@ public:
|
|
81
81
|
return jsi::Value::undefined();
|
82
82
|
}
|
83
83
|
|
84
|
+
JSI_HOST_FUNCTION(setDither) {
|
85
|
+
bool dithered = arguments[0].getBool();
|
86
|
+
getObject()->setDither(dithered);
|
87
|
+
return jsi::Value::undefined();
|
88
|
+
}
|
89
|
+
|
84
90
|
JSI_HOST_FUNCTION(setStrokeWidth) {
|
85
91
|
SkScalar width = arguments[0].asNumber();
|
86
92
|
getObject()->setStrokeWidth(width);
|
@@ -175,6 +181,7 @@ public:
|
|
175
181
|
JSI_EXPORT_FUNC(JsiSkPaint, setStrokeJoin),
|
176
182
|
JSI_EXPORT_FUNC(JsiSkPaint, setStrokeCap),
|
177
183
|
JSI_EXPORT_FUNC(JsiSkPaint, setAntiAlias),
|
184
|
+
JSI_EXPORT_FUNC(JsiSkPaint, setDither),
|
178
185
|
JSI_EXPORT_FUNC(JsiSkPaint, setStrokeWidth),
|
179
186
|
JSI_EXPORT_FUNC(JsiSkPaint, setStyle),
|
180
187
|
JSI_EXPORT_FUNC(JsiSkPaint, setColor),
|
package/cpp/api/JsiSkPath.h
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
+
#include <algorithm>
|
3
4
|
#include <memory>
|
4
5
|
#include <utility>
|
5
6
|
#include <vector>
|
@@ -34,6 +35,11 @@ namespace RNSkia {
|
|
34
35
|
namespace jsi = facebook::jsi;
|
35
36
|
|
36
37
|
class JsiSkPath : public JsiSkWrappingSharedPtrHostObject<SkPath> {
|
38
|
+
private:
|
39
|
+
float pinT(double value) {
|
40
|
+
// Clamp the double value between 0 and 1 and then cast it to float
|
41
|
+
return static_cast<float>(std::clamp(value, 0.0, 1.0));
|
42
|
+
}
|
37
43
|
|
38
44
|
public:
|
39
45
|
JSI_HOST_FUNCTION(addPath) {
|
@@ -293,24 +299,21 @@ public:
|
|
293
299
|
}
|
294
300
|
|
295
301
|
JSI_HOST_FUNCTION(trim) {
|
296
|
-
auto start = arguments[0].asNumber();
|
297
|
-
auto end = arguments[1].asNumber();
|
302
|
+
auto start = pinT(arguments[0].asNumber());
|
303
|
+
auto end = pinT(arguments[1].asNumber());
|
298
304
|
auto isComplement = arguments[2].getBool();
|
299
305
|
auto path = *getObject();
|
300
306
|
auto mode = isComplement ? SkTrimPathEffect::Mode::kInverted
|
301
307
|
: SkTrimPathEffect::Mode::kNormal;
|
302
308
|
auto pe = SkTrimPathEffect::Make(start, end, mode);
|
309
|
+
SkStrokeRec rec(SkStrokeRec::InitStyle::kHairline_InitStyle);
|
303
310
|
if (!pe) {
|
304
|
-
|
305
|
-
// [0,1]\n");
|
306
|
-
return jsi::Value::null();
|
311
|
+
return thisValue.getObject(runtime);
|
307
312
|
}
|
308
|
-
SkStrokeRec rec(SkStrokeRec::InitStyle::kHairline_InitStyle);
|
309
313
|
if (pe->filterPath(&path, path, &rec, nullptr)) {
|
310
314
|
getObject()->swap(path);
|
311
315
|
return thisValue.getObject(runtime);
|
312
316
|
}
|
313
|
-
SkDebugf("Could not trim path\n");
|
314
317
|
return jsi::Value::null();
|
315
318
|
}
|
316
319
|
|
@@ -523,7 +526,7 @@ public:
|
|
523
526
|
return cmds;
|
524
527
|
}
|
525
528
|
|
526
|
-
EXPORT_JSI_API_TYPENAME(JsiSkPath,
|
529
|
+
EXPORT_JSI_API_TYPENAME(JsiSkPath, Path)
|
527
530
|
|
528
531
|
JSI_EXPORT_FUNCTIONS(
|
529
532
|
JSI_EXPORT_FUNC(JsiSkPath, addPath), JSI_EXPORT_FUNC(JsiSkPath, addArc),
|
@@ -25,7 +25,7 @@ public:
|
|
25
25
|
: JsiSkWrappingSkPtrHostObject<SkPathEffect>(std::move(context),
|
26
26
|
std::move(pathEffect)) {}
|
27
27
|
|
28
|
-
EXPORT_JSI_API_TYPENAME(JsiSkPathEffect,
|
28
|
+
EXPORT_JSI_API_TYPENAME(JsiSkPathEffect, PathEffect)
|
29
29
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkColorFilter, dispose))
|
30
30
|
};
|
31
31
|
|
package/cpp/api/JsiSkPicture.h
CHANGED
@@ -40,7 +40,7 @@ public:
|
|
40
40
|
runtime, std::make_shared<JsiSkPicture>(getContext(), picture));
|
41
41
|
}
|
42
42
|
|
43
|
-
EXPORT_JSI_API_TYPENAME(JsiSkPictureRecorder,
|
43
|
+
EXPORT_JSI_API_TYPENAME(JsiSkPictureRecorder, PictureRecorder)
|
44
44
|
|
45
45
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPictureRecorder, beginRecording),
|
46
46
|
JSI_EXPORT_FUNC(JsiSkPictureRecorder,
|
@@ -115,7 +115,7 @@ public:
|
|
115
115
|
return jsi::String::createFromAscii(runtime, getObject()->source());
|
116
116
|
}
|
117
117
|
|
118
|
-
EXPORT_JSI_API_TYPENAME(JsiSkRuntimeEffect,
|
118
|
+
EXPORT_JSI_API_TYPENAME(JsiSkRuntimeEffect, RuntimeEffect)
|
119
119
|
|
120
120
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkRuntimeEffect, makeShader),
|
121
121
|
JSI_EXPORT_FUNC(JsiSkRuntimeEffect,
|
package/cpp/api/JsiSkSVG.h
CHANGED
@@ -24,7 +24,7 @@ public:
|
|
24
24
|
: JsiSkWrappingSkPtrHostObject<SkSVGDOM>(std::move(context),
|
25
25
|
std::move(svgdom)) {}
|
26
26
|
|
27
|
-
EXPORT_JSI_API_TYPENAME(JsiSkSVG,
|
27
|
+
EXPORT_JSI_API_TYPENAME(JsiSkSVG, SVG)
|
28
28
|
|
29
29
|
JSI_HOST_FUNCTION(width) {
|
30
30
|
return static_cast<double>(getObject()->containerSize().width());
|
package/cpp/api/JsiSkShader.h
CHANGED
@@ -26,7 +26,7 @@ public:
|
|
26
26
|
: JsiSkWrappingSkPtrHostObject<SkShader>(std::move(context),
|
27
27
|
std::move(shader)) {}
|
28
28
|
|
29
|
-
EXPORT_JSI_API_TYPENAME(JsiSkShader,
|
29
|
+
EXPORT_JSI_API_TYPENAME(JsiSkShader, Shader)
|
30
30
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkShader, dispose))
|
31
31
|
};
|
32
32
|
} // namespace RNSkia
|
package/cpp/api/JsiSkSurface.h
CHANGED
@@ -28,7 +28,7 @@ public:
|
|
28
28
|
: JsiSkWrappingSkPtrHostObject<SkSurface>(std::move(context),
|
29
29
|
std::move(surface)) {}
|
30
30
|
|
31
|
-
EXPORT_JSI_API_TYPENAME(JsiSkSurface,
|
31
|
+
EXPORT_JSI_API_TYPENAME(JsiSkSurface, Surface)
|
32
32
|
|
33
33
|
JSI_HOST_FUNCTION(getCanvas) {
|
34
34
|
return jsi::Object::createFromHostObject(
|
package/cpp/api/JsiSkTextBlob.h
CHANGED
@@ -25,7 +25,7 @@ public:
|
|
25
25
|
: JsiSkWrappingSkPtrHostObject<SkTextBlob>(std::move(context),
|
26
26
|
std::move(shader)) {}
|
27
27
|
|
28
|
-
EXPORT_JSI_API_TYPENAME(JsiSkTextBlob,
|
28
|
+
EXPORT_JSI_API_TYPENAME(JsiSkTextBlob, TextBlob)
|
29
29
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkTextBlob, dispose))
|
30
30
|
};
|
31
31
|
} // namespace RNSkia
|
@@ -27,7 +27,8 @@ namespace para = skia::textlayout;
|
|
27
27
|
class JsiSkTypefaceFontProvider
|
28
28
|
: public JsiSkWrappingSkPtrHostObject<para::TypefaceFontProvider> {
|
29
29
|
public:
|
30
|
-
EXPORT_JSI_API_TYPENAME(JsiSkTypefaceFontProvider,
|
30
|
+
EXPORT_JSI_API_TYPENAME(JsiSkTypefaceFontProvider, TypefaceFontProvider)
|
31
|
+
|
31
32
|
JSI_EXPORT_FUNCTIONS(
|
32
33
|
JSI_EXPORT_FUNC(JsiSkTypefaceFontProvider, dispose),
|
33
34
|
JSI_EXPORT_FUNC(JsiSkTypefaceFontProvider, registerFont),
|
@@ -46,7 +47,8 @@ public:
|
|
46
47
|
JSI_HOST_FUNCTION(matchFamilyStyle) {
|
47
48
|
auto name = arguments[0].asString(runtime).utf8(runtime);
|
48
49
|
auto fontStyle = JsiSkFontStyle::fromValue(runtime, arguments[1]);
|
49
|
-
|
50
|
+
sk_sp<SkFontStyleSet> set(getObject()->onMatchFamily(name.c_str()));
|
51
|
+
sk_sp<SkTypeface> typeface(set->matchStyle(*fontStyle));
|
50
52
|
return jsi::Object::createFromHostObject(
|
51
53
|
runtime, std::make_shared<JsiSkTypeface>(getContext(), typeface));
|
52
54
|
}
|
package/cpp/api/JsiSkTypeface.h
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
#include <memory>
|
4
4
|
#include <utility>
|
5
|
+
#include <vector>
|
5
6
|
|
6
7
|
#include <jsi/jsi.h>
|
7
8
|
|
@@ -22,13 +23,34 @@ namespace jsi = facebook::jsi;
|
|
22
23
|
|
23
24
|
class JsiSkTypeface : public JsiSkWrappingSkPtrHostObject<SkTypeface> {
|
24
25
|
public:
|
25
|
-
EXPORT_JSI_API_TYPENAME(JsiSkTypeface,
|
26
|
-
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkTypeface,
|
26
|
+
EXPORT_JSI_API_TYPENAME(JsiSkTypeface, Typeface)
|
27
|
+
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkTypeface, getGlyphIDs),
|
28
|
+
JSI_EXPORT_FUNC(JsiSkTypeface, dispose))
|
27
29
|
|
28
30
|
JsiSkTypeface(std::shared_ptr<RNSkPlatformContext> context,
|
29
31
|
sk_sp<SkTypeface> typeface)
|
30
32
|
: JsiSkWrappingSkPtrHostObject(std::move(context), std::move(typeface)) {}
|
31
33
|
|
34
|
+
JSI_HOST_FUNCTION(getGlyphIDs) {
|
35
|
+
auto str = arguments[0].asString(runtime).utf8(runtime);
|
36
|
+
int numGlyphIDs =
|
37
|
+
count > 1 && !arguments[1].isNull() && !arguments[1].isUndefined()
|
38
|
+
? static_cast<int>(arguments[1].asNumber())
|
39
|
+
: getObject()->textToGlyphs(str.c_str(), str.length(),
|
40
|
+
SkTextEncoding::kUTF8, nullptr, 0);
|
41
|
+
std::vector<SkGlyphID> glyphIDs;
|
42
|
+
glyphIDs.resize(numGlyphIDs);
|
43
|
+
getObject()->textToGlyphs(str.c_str(), str.length(), SkTextEncoding::kUTF8,
|
44
|
+
static_cast<SkGlyphID *>(glyphIDs.data()),
|
45
|
+
numGlyphIDs);
|
46
|
+
auto jsiGlyphIDs = jsi::Array(runtime, numGlyphIDs);
|
47
|
+
for (int i = 0; i < numGlyphIDs; i++) {
|
48
|
+
jsiGlyphIDs.setValueAtIndex(runtime, i,
|
49
|
+
jsi::Value(static_cast<int>(glyphIDs[i])));
|
50
|
+
}
|
51
|
+
return jsiGlyphIDs;
|
52
|
+
}
|
53
|
+
|
32
54
|
/**
|
33
55
|
Returns the jsi object from a host object of this type
|
34
56
|
*/
|
package/cpp/api/JsiSkVertices.h
CHANGED
@@ -25,7 +25,7 @@ public:
|
|
25
25
|
: JsiSkWrappingSkPtrHostObject<SkVertices>(std::move(context),
|
26
26
|
std::move(vertices)) {}
|
27
27
|
|
28
|
-
EXPORT_JSI_API_TYPENAME(JsiSkVertices,
|
28
|
+
EXPORT_JSI_API_TYPENAME(JsiSkVertices, Vertices)
|
29
29
|
|
30
30
|
JSI_HOST_FUNCTION(bounds) {
|
31
31
|
const auto &result = getObject()->bounds();
|
@@ -206,7 +206,7 @@ protected:
|
|
206
206
|
JsiPropId::get("blendMode"), JsiPropId::get("strokeCap"),
|
207
207
|
JsiPropId::get("strokeJoin"), JsiPropId::get("strokeMiter"),
|
208
208
|
JsiPropId::get("style"), JsiPropId::get("antiAlias"),
|
209
|
-
JsiPropId::get("opacity")};
|
209
|
+
JsiPropId::get("opacity"), JsiPropId::get("dither")};
|
210
210
|
|
211
211
|
// We'll invalidate paint if a prop change happened in a paint property
|
212
212
|
if (std::find(paintProps.begin(), paintProps.end(), prop->getName()) !=
|
@@ -67,6 +67,10 @@ public:
|
|
67
67
|
paint->setAntiAlias(_paintProps->getAntiAlias()->value().getAsBool());
|
68
68
|
}
|
69
69
|
|
70
|
+
if (_paintProps->getDither()->isSet()) {
|
71
|
+
paint->setDither(_paintProps->getDither()->value().getAsBool());
|
72
|
+
}
|
73
|
+
|
70
74
|
context->save();
|
71
75
|
decorateChildren(context);
|
72
76
|
|
@@ -100,6 +100,7 @@ public:
|
|
100
100
|
_strokeCap = defineProperty<StrokeCapProp>("strokeCap");
|
101
101
|
_strokeMiter = defineProperty<NodeProp>("strokeMiter");
|
102
102
|
_antiAlias = defineProperty<NodeProp>("antiAlias");
|
103
|
+
_dither = defineProperty<NodeProp>("dither");
|
103
104
|
_opacity = defineProperty<NodeProp>("opacity");
|
104
105
|
}
|
105
106
|
|
@@ -113,6 +114,7 @@ public:
|
|
113
114
|
StrokeCapProp *getStrokeCap() { return _strokeCap; }
|
114
115
|
NodeProp *getStrokeMiter() { return _strokeMiter; }
|
115
116
|
NodeProp *getAntiAlias() { return _antiAlias; }
|
117
|
+
NodeProp *getDither() { return _dither; }
|
116
118
|
NodeProp *getOpacity() { return _opacity; }
|
117
119
|
|
118
120
|
private:
|
@@ -124,6 +126,7 @@ private:
|
|
124
126
|
StrokeCapProp *_strokeCap;
|
125
127
|
NodeProp *_strokeMiter;
|
126
128
|
NodeProp *_antiAlias;
|
129
|
+
NodeProp *_dither;
|
127
130
|
NodeProp *_opacity;
|
128
131
|
};
|
129
132
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["PaintContext.ts"],"sourcesContent":["import type {\n BlendMode,\n PaintStyle,\n SkColorFilter,\n SkImageFilter,\n SkMaskFilter,\n SkPathEffect,\n SkShader,\n StrokeCap,\n StrokeJoin,\n} from \"../../skia/types\";\nimport type { SkColor } from \"../../skia/types/Color\";\n\n// TODO: to remove\nexport interface PaintContext {\n color?: SkColor;\n strokeWidth?: number;\n blendMode?: BlendMode;\n style?: PaintStyle;\n strokeJoin?: StrokeJoin;\n strokeCap?: StrokeCap;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n\n shader?: SkShader;\n colorFilter?: SkColorFilter;\n imageFilter?: SkImageFilter;\n maskFilter?: SkMaskFilter;\n pathEffect?: SkPathEffect;\n}\n"],"mappings":""}
|
1
|
+
{"version":3,"names":[],"sources":["PaintContext.ts"],"sourcesContent":["import type {\n BlendMode,\n PaintStyle,\n SkColorFilter,\n SkImageFilter,\n SkMaskFilter,\n SkPathEffect,\n SkShader,\n StrokeCap,\n StrokeJoin,\n} from \"../../skia/types\";\nimport type { SkColor } from \"../../skia/types/Color\";\n\n// TODO: to remove\nexport interface PaintContext {\n color?: SkColor;\n strokeWidth?: number;\n blendMode?: BlendMode;\n style?: PaintStyle;\n strokeJoin?: StrokeJoin;\n strokeCap?: StrokeCap;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n dither?: boolean;\n\n shader?: SkShader;\n colorFilter?: SkColorFilter;\n imageFilter?: SkImageFilter;\n maskFilter?: SkMaskFilter;\n pathEffect?: SkPathEffect;\n}\n"],"mappings":""}
|
@@ -29,7 +29,8 @@ class PaintNode extends _Node.JsiDeclarationNode {
|
|
29
29
|
strokeCap,
|
30
30
|
strokeMiter,
|
31
31
|
opacity,
|
32
|
-
antiAlias
|
32
|
+
antiAlias,
|
33
|
+
dither
|
33
34
|
} = this.props;
|
34
35
|
const paint = this.Skia.Paint();
|
35
36
|
|
@@ -69,6 +70,10 @@ class PaintNode extends _Node.JsiDeclarationNode {
|
|
69
70
|
paint.setAntiAlias(antiAlias);
|
70
71
|
}
|
71
72
|
|
73
|
+
if (dither !== undefined) {
|
74
|
+
paint.setDither(dither);
|
75
|
+
}
|
76
|
+
|
72
77
|
ctx.save();
|
73
78
|
|
74
79
|
this._children.forEach(child => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["PaintNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","Paint","NodeType","decorate","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","paint","Skia","undefined","setColor","Color","setStrokeWidth","setBlendMode","BlendMode","enumKey","setStyle","PaintStyle","setStrokeJoin","StrokeJoin","setStrokeCap","StrokeCap","setStrokeMiter","setAlphaf","setAntiAlias","save","_children","forEach","child","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","pop","maskFilter","maskFilters","pathEffect","pathEffects","restore","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","paints","push"],"sources":["PaintNode.ts"],"sourcesContent":["import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from \"../../skia/types\";\nimport type { DeclarationNode, PaintProps } from \"../types\";\nimport { DeclarationType, NodeType } from \"../types\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nimport { enumKey } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nexport class PaintNode\n extends JsiDeclarationNode<PaintProps>\n implements DeclarationNode<PaintProps>\n{\n constructor(ctx: NodeContext, props: PaintProps = {}) {\n super(ctx, DeclarationType.Paint, NodeType.Paint, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n } = this.props;\n const paint = this.Skia.Paint();\n if (color !== undefined) {\n paint.setColor(this.Skia.Color(color));\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (opacity !== undefined) {\n paint.setAlphaf(opacity);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n ctx.save();\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n const colorFilter = ctx.colorFilters.popAllAsOne();\n const imageFilter = ctx.imageFilters.popAllAsOne();\n const shader = ctx.shaders.pop();\n const maskFilter = ctx.maskFilters.pop();\n const pathEffect = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n if (imageFilter) {\n paint.setImageFilter(imageFilter);\n }\n if (shader) {\n paint.setShader(shader);\n }\n if (pathEffect) {\n paint.setPathEffect(pathEffect);\n }\n if (colorFilter) {\n paint.setColorFilter(colorFilter);\n }\n if (maskFilter) {\n paint.setMaskFilter(maskFilter);\n }\n ctx.paints.push(paint);\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAGA;;AAEA;;AAEO,MAAMA,SAAN,SACGC,wBADH,CAGP;EACEC,WAAW,CAACC,GAAD,EAA2C;IAAA,IAAxBC,KAAwB,uEAAJ,EAAI;IACpD,MAAMD,GAAN,EAAWE,uBAAA,CAAgBC,KAA3B,EAAkCC,gBAAA,CAASD,KAA3C,EAAkDF,KAAlD;EACD;;EAEDI,QAAQ,CAACL,GAAD,EAA0B;IAChC,MAAM;MACJM,KADI;MAEJC,WAFI;MAGJC,SAHI;MAIJC,KAJI;MAKJC,UALI;MAMJC,SANI;MAOJC,WAPI;MAQJC,OARI;MASJC;
|
1
|
+
{"version":3,"names":["PaintNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","Paint","NodeType","decorate","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","dither","paint","Skia","undefined","setColor","Color","setStrokeWidth","setBlendMode","BlendMode","enumKey","setStyle","PaintStyle","setStrokeJoin","StrokeJoin","setStrokeCap","StrokeCap","setStrokeMiter","setAlphaf","setAntiAlias","setDither","save","_children","forEach","child","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","pop","maskFilter","maskFilters","pathEffect","pathEffects","restore","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","paints","push"],"sources":["PaintNode.ts"],"sourcesContent":["import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from \"../../skia/types\";\nimport type { DeclarationNode, PaintProps } from \"../types\";\nimport { DeclarationType, NodeType } from \"../types\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nimport { enumKey } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nexport class PaintNode\n extends JsiDeclarationNode<PaintProps>\n implements DeclarationNode<PaintProps>\n{\n constructor(ctx: NodeContext, props: PaintProps = {}) {\n super(ctx, DeclarationType.Paint, NodeType.Paint, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n dither,\n } = this.props;\n const paint = this.Skia.Paint();\n if (color !== undefined) {\n paint.setColor(this.Skia.Color(color));\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (opacity !== undefined) {\n paint.setAlphaf(opacity);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (dither !== undefined) {\n paint.setDither(dither);\n }\n ctx.save();\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n const colorFilter = ctx.colorFilters.popAllAsOne();\n const imageFilter = ctx.imageFilters.popAllAsOne();\n const shader = ctx.shaders.pop();\n const maskFilter = ctx.maskFilters.pop();\n const pathEffect = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n if (imageFilter) {\n paint.setImageFilter(imageFilter);\n }\n if (shader) {\n paint.setShader(shader);\n }\n if (pathEffect) {\n paint.setPathEffect(pathEffect);\n }\n if (colorFilter) {\n paint.setColorFilter(colorFilter);\n }\n if (maskFilter) {\n paint.setMaskFilter(maskFilter);\n }\n ctx.paints.push(paint);\n }\n}\n"],"mappings":"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"}
|
@@ -13,7 +13,7 @@ var _Node = require("./Node");
|
|
13
13
|
|
14
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
15
15
|
|
16
|
-
const paintProps = ["color", "strokeWidth", "blendMode", "strokeCap", "strokeJoin", "strokeMiter", "style", "antiAlias", "opacity"];
|
16
|
+
const paintProps = ["color", "strokeWidth", "blendMode", "strokeCap", "strokeJoin", "strokeMiter", "style", "antiAlias", "dither", "opacity"];
|
17
17
|
|
18
18
|
class JsiRenderNode extends _Node.JsiNode {
|
19
19
|
constructor(ctx, type, props) {
|