@shopify/react-native-skia 0.1.227 → 0.1.229
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkCanvas.h +2 -1
- package/cpp/api/JsiSkMatrix.h +27 -11
- package/cpp/api/JsiSkTypeface.h +1 -0
- package/cpp/rnskia/dom/props/MatrixProp.h +14 -3
- package/lib/commonjs/dom/types/Common.d.ts +2 -2
- package/lib/commonjs/dom/types/Common.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.d.ts +1 -0
- package/lib/commonjs/external/reanimated/interpolators.js +16 -3
- package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +2 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.js +9 -7
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +7 -13
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/core/Vector.d.ts +0 -5
- package/lib/commonjs/skia/core/Vector.js +1 -17
- package/lib/commonjs/skia/core/Vector.js.map +1 -1
- package/lib/commonjs/skia/types/Canvas.d.ts +2 -2
- package/lib/commonjs/skia/types/Canvas.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix.d.ts +3 -13
- package/lib/commonjs/skia/types/Matrix.js +1 -16
- package/lib/commonjs/skia/types/Matrix.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +60 -1
- package/lib/commonjs/skia/types/Matrix4.js +159 -14
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.d.ts +2 -2
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +2 -3
- package/lib/commonjs/skia/web/Host.js +4 -12
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +12 -12
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +2 -2
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -6
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkMatrix.js +6 -1
- package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +3 -3
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +4 -4
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/module/dom/types/Common.d.ts +2 -2
- package/lib/module/dom/types/Common.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.d.ts +1 -0
- package/lib/module/external/reanimated/interpolators.js +14 -4
- package/lib/module/external/reanimated/interpolators.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.d.ts +2 -1
- package/lib/module/external/reanimated/moduleWrapper.js +7 -6
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/renderer/Canvas.js +7 -12
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/core/Vector.d.ts +0 -5
- package/lib/module/skia/core/Vector.js +0 -13
- package/lib/module/skia/core/Vector.js.map +1 -1
- package/lib/module/skia/types/Canvas.d.ts +2 -2
- package/lib/module/skia/types/Canvas.js.map +1 -1
- package/lib/module/skia/types/Matrix.d.ts +3 -13
- package/lib/module/skia/types/Matrix.js +0 -14
- package/lib/module/skia/types/Matrix.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +60 -1
- package/lib/module/skia/types/Matrix4.js +132 -18
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/skia/types/Path/Path.d.ts +2 -2
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +2 -3
- package/lib/module/skia/web/Host.js +2 -7
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +13 -13
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +2 -2
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +3 -3
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +7 -7
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +3 -3
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +4 -4
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js +2 -2
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.d.ts +2 -2
- package/lib/module/skia/web/JsiSkMatrix.js +6 -1
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +4 -4
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +5 -5
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +2 -2
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +2 -2
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +6 -6
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js +2 -2
- package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/typescript/src/dom/types/Common.d.ts +2 -2
- package/lib/typescript/src/external/reanimated/interpolators.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +2 -1
- package/lib/typescript/src/skia/core/Vector.d.ts +0 -5
- package/lib/typescript/src/skia/types/Canvas.d.ts +2 -2
- package/lib/typescript/src/skia/types/Matrix.d.ts +3 -13
- package/lib/typescript/src/skia/types/Matrix4.d.ts +60 -1
- package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -2
- package/lib/typescript/src/skia/web/Host.d.ts +2 -3
- package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +2 -2
- package/package.json +2 -1
- package/src/dom/types/Common.ts +2 -2
- package/src/external/reanimated/interpolators.ts +20 -5
- package/src/external/reanimated/moduleWrapper.ts +6 -0
- package/src/renderer/Canvas.tsx +6 -13
- package/src/skia/core/Vector.ts +0 -7
- package/src/skia/types/Canvas.ts +2 -2
- package/src/skia/types/Matrix.ts +4 -13
- package/src/skia/types/Matrix4.ts +190 -81
- package/src/skia/types/Path/Path.ts +2 -2
- package/src/skia/web/Host.ts +4 -3
- package/src/skia/web/JsiSkCanvas.ts +22 -15
- package/src/skia/web/JsiSkColorFilterFactory.ts +5 -2
- package/src/skia/web/JsiSkFont.ts +3 -3
- package/src/skia/web/JsiSkImage.ts +14 -11
- package/src/skia/web/JsiSkImageFactory.ts +3 -3
- package/src/skia/web/JsiSkImageFilterFactory.ts +5 -5
- package/src/skia/web/JsiSkMaskFilterFactory.ts +6 -2
- package/src/skia/web/JsiSkMatrix.ts +12 -3
- package/src/skia/web/JsiSkPaint.ts +4 -4
- package/src/skia/web/JsiSkPath.ts +8 -5
- package/src/skia/web/JsiSkPathEffectFactory.ts +2 -2
- package/src/skia/web/JsiSkPathFactory.ts +2 -2
- package/src/skia/web/JsiSkPicture.ts +4 -4
- package/src/skia/web/JsiSkShaderFactory.ts +6 -6
- package/src/skia/web/JsiSkVerticesFactory.ts +2 -2
@@ -59,11 +59,11 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
59
59
|
}
|
60
60
|
|
61
61
|
drawImageOptions(img, left, top, fm, mm, paint) {
|
62
|
-
this.ref.drawImageOptions(_JsiSkImage.JsiSkImage.fromValue(img), left, top, (0, _Host.
|
62
|
+
this.ref.drawImageOptions(_JsiSkImage.JsiSkImage.fromValue(img), left, top, (0, _Host.getEnum)(this.CanvasKit.FilterMode, fm), (0, _Host.getEnum)(this.CanvasKit.MipmapMode, mm), paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
63
63
|
}
|
64
64
|
|
65
65
|
drawImageNine(img, center, dest, filter, paint) {
|
66
|
-
this.ref.drawImageNine(_JsiSkImage.JsiSkImage.fromValue(img), Array.from(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, center)), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.
|
66
|
+
this.ref.drawImageNine(_JsiSkImage.JsiSkImage.fromValue(img), Array.from(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, center)), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.getEnum)(this.CanvasKit.FilterMode, filter), paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
67
67
|
}
|
68
68
|
|
69
69
|
drawImageRectCubic(img, src, dest, B, C, paint) {
|
@@ -71,7 +71,7 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
71
71
|
}
|
72
72
|
|
73
73
|
drawImageRectOptions(img, src, dest, fm, mm, paint) {
|
74
|
-
this.ref.drawImageRectOptions(_JsiSkImage.JsiSkImage.fromValue(img), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, src), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.
|
74
|
+
this.ref.drawImageRectOptions(_JsiSkImage.JsiSkImage.fromValue(img), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, src), _JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, dest), (0, _Host.getEnum)(this.CanvasKit.FilterMode, fm), (0, _Host.getEnum)(this.CanvasKit.MipmapMode, mm), paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : paint);
|
75
75
|
}
|
76
76
|
|
77
77
|
drawPaint(paint) {
|
@@ -87,7 +87,7 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
87
87
|
}
|
88
88
|
|
89
89
|
drawVertices(verts, mode, paint) {
|
90
|
-
this.ref.drawVertices(_JsiSkVertices.JsiSkVertices.fromValue(verts), (0, _Host.
|
90
|
+
this.ref.drawVertices(_JsiSkVertices.JsiSkVertices.fromValue(verts), (0, _Host.getEnum)(this.CanvasKit.BlendMode, mode), _JsiSkPaint.JsiSkPaint.fromValue(paint));
|
91
91
|
}
|
92
92
|
|
93
93
|
drawPatch(cubics, colors, texs, mode, paint) {
|
@@ -97,7 +97,7 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
97
97
|
y
|
98
98
|
} = _ref;
|
99
99
|
return [x, y];
|
100
|
-
}).flat(), colors, texs ? texs.flatMap(p => Array.from(_JsiSkPoint.JsiSkPoint.fromValue(p))) : texs, mode ? (0, _Host.
|
100
|
+
}).flat(), colors, texs ? texs.flatMap(p => Array.from(_JsiSkPoint.JsiSkPoint.fromValue(p))) : texs, mode ? (0, _Host.getEnum)(this.CanvasKit.BlendMode, mode) : null, paint ? _JsiSkPaint.JsiSkPaint.fromValue(paint) : undefined);
|
101
101
|
}
|
102
102
|
|
103
103
|
restoreToCount(saveCount) {
|
@@ -105,7 +105,7 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
105
105
|
}
|
106
106
|
|
107
107
|
drawPoints(mode, points, paint) {
|
108
|
-
this.ref.drawPoints((0, _Host.
|
108
|
+
this.ref.drawPoints((0, _Host.getEnum)(this.CanvasKit.PointMode, mode), points.map(_ref2 => {
|
109
109
|
let {
|
110
110
|
x,
|
111
111
|
y
|
@@ -179,7 +179,7 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
179
179
|
}
|
180
180
|
|
181
181
|
drawColor(color, blendMode) {
|
182
|
-
this.ref.drawColor(color, blendMode ? (0, _Host.
|
182
|
+
this.ref.drawColor(color, blendMode ? (0, _Host.getEnum)(this.CanvasKit.BlendMode, blendMode) : undefined);
|
183
183
|
}
|
184
184
|
|
185
185
|
clear(color) {
|
@@ -187,15 +187,15 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
187
187
|
}
|
188
188
|
|
189
189
|
clipPath(path, op, doAntiAlias) {
|
190
|
-
this.ref.clipPath(_JsiSkPath.JsiSkPath.fromValue(path), (0, _Host.
|
190
|
+
this.ref.clipPath(_JsiSkPath.JsiSkPath.fromValue(path), (0, _Host.getEnum)(this.CanvasKit.PathOp, op), doAntiAlias);
|
191
191
|
}
|
192
192
|
|
193
193
|
clipRect(rect, op, doAntiAlias) {
|
194
|
-
this.ref.clipRect(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, rect), (0, _Host.
|
194
|
+
this.ref.clipRect(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, rect), (0, _Host.getEnum)(this.CanvasKit.PathOp, op), doAntiAlias);
|
195
195
|
}
|
196
196
|
|
197
197
|
clipRRect(rrect, op, doAntiAlias) {
|
198
|
-
this.ref.clipRRect(_JsiSkRRect.JsiSkRRect.fromValue(this.CanvasKit, rrect), (0, _Host.
|
198
|
+
this.ref.clipRRect(_JsiSkRRect.JsiSkRRect.fromValue(this.CanvasKit, rrect), (0, _Host.getEnum)(this.CanvasKit.PathOp, op), doAntiAlias);
|
199
199
|
}
|
200
200
|
|
201
201
|
concat(m) {
|
@@ -211,8 +211,8 @@ class JsiSkCanvas extends _Host.HostObject {
|
|
211
211
|
width: imageInfo.width,
|
212
212
|
height: imageInfo.height,
|
213
213
|
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
214
|
-
alphaType: (0, _Host.
|
215
|
-
colorType: (0, _Host.
|
214
|
+
alphaType: (0, _Host.getEnum)(this.CanvasKit.AlphaType, imageInfo.alphaType),
|
215
|
+
colorType: (0, _Host.getEnum)(this.CanvasKit.ColorType, imageInfo.colorType)
|
216
216
|
};
|
217
217
|
return this.ref.readPixels(srcX, srcY, pxInfo);
|
218
218
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkCanvas","HostObject","constructor","CanvasKit","ref","delete","drawRect","rect","paint","JsiSkRect","fromValue","JsiSkPaint","drawImage","image","x","y","JsiSkImage","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","ckEnum","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","JsiSkVertices","drawPatch","cubics","colors","texs","map","flat","flatMap","p","JsiSkPoint","undefined","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","JsiSkRRect","drawDRRect","outer","inner","drawOval","drawPath","path","JsiSkPath","drawText","str","font","JsiSkFont","drawTextBlob","blob","JsiSkTextBlob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","JsiSkImageFilter","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","isArray","JsiSkMatrix","drawPicture","skp","JsiSkPicture","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","getCkEnum","AlphaType","colorType","ColorType"],"sources":["JsiSkCanvas.ts"],"sourcesContent":["import type { Canvas, CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n ImageInfo,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n SkRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport { ckEnum, getCkEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n ckEnum(fm),\n ckEnum(mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n ckEnum(filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n ckEnum(fm),\n ckEnum(mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n ckEnum(mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? ckEnum(mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n ckEnum(mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: SkRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(color, blendMode ? ckEnum(blendMode) : undefined);\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(JsiSkPath.fromValue(path), ckEnum(op), doAntiAlias);\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix | number[]) {\n this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n\n readPixels(srcX: number, srcY: number, imageInfo: ImageInfo) {\n const pxInfo = {\n width: imageInfo.width,\n height: imageInfo.height,\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n alphaType: getCkEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),\n colorType: getCkEnum(this.CanvasKit.ColorType, imageInfo.colorType),\n };\n return this.ref.readPixels(srcX, srcY, pxInfo);\n }\n}\n"],"mappings":";;;;;;;AA2BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEO,MAAMA,WAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAoC;IAC7C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;;IAD6C,iCAIrC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAN8C;EAE9C;;EAMDC,QAAQ,CAACC,IAAD,EAAeC,KAAf,EAA+B;IACrC,KAAKJ,GAAL,CAASE,QAAT,CACEG,oBAAA,CAAUC,SAAV,CAAoB,KAAKP,SAAzB,EAAoCI,IAApC,CADF,EAEEI,sBAAA,CAAWD,SAAX,CAAqBF,KAArB,CAFF;EAID;;EAEDI,SAAS,CAACC,KAAD,EAAiBC,CAAjB,EAA4BC,CAA5B,EAAuCP,KAAvC,EAAwD;IAC/D,KAAKJ,GAAL,CAASQ,SAAT,CACEI,sBAAA,CAAWN,SAAX,CAAqBG,KAArB,CADF,EAEEC,CAFF,EAGEC,CAHF,EAIEP,KAAK,GAAGG,sBAAA,CAAWD,SAAX,CAAqBF,KAArB,CAAH,GAAiCA,KAJxC;EAMD;;EAEDS,aAAa,CACXC,GADW,EAEXC,GAFW,EAGXC,IAHW,EAIXZ,KAJW,EAKXa,UALW,EAMX;IACA,KAAKjB,GAAL,CAASa,aAAT,CACED,sBAAA,CAAWN,SAAX,CAAqBQ,GAArB,CADF,EAEET,oBAAA,CAAUC,SAAV,CAAo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GAAvB,CAArB;EACD;;EAEDE,UAAU,CAACC,IAAD,EAAeC,IAAf,EAA6BC,SAA7B,EAAmD;IAC3D,MAAMC,MAAM,GAAG;MACbC,KAAK,EAAEF,SAAS,CAACE,KADJ;MAEbC,MAAM,EAAEH,SAAS,CAACG,MAFL;MAGbC,UAAU,EAAE,KAAKtI,SAAL,CAAeuI,UAAf,CAA0BC,IAHzB;MAIbC,SAAS,EAAE,IAAAC,eAAA,EAAU,KAAK1I,SAAL,CAAe2I,SAAzB,EAAoCT,SAAS,CAACO,SAA9C,CAJE;MAKbG,SAAS,EAAE,IAAAF,eAAA,EAAU,KAAK1I,SAAL,CAAe6I,SAAzB,EAAoCX,SAAS,CAACU,SAA9C;IALE,CAAf;IAOA,OAAO,KAAK3I,GAAL,CAAS8H,UAAT,CAAoBC,IAApB,EAA0BC,IAA1B,EAAgCE,MAAhC,CAAP;EACD;;AAvVH"}
|
1
|
+
{"version":3,"names":["JsiSkCanvas","HostObject","constructor","CanvasKit","ref","delete","drawRect","rect","paint","JsiSkRect","fromValue","JsiSkPaint","drawImage","image","x","y","JsiSkImage","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","getEnum","FilterMode","MipmapMode","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","JsiSkVertices","BlendMode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","JsiSkPoint","undefined","restoreToCount","saveCount","drawPoints","points","PointMode","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","JsiSkRRect","drawDRRect","outer","inner","drawOval","drawPath","path","JsiSkPath","drawText","str","font","JsiSkFont","drawTextBlob","blob","JsiSkTextBlob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","JsiSkImageFilter","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","PathOp","clipRect","clipRRect","concat","m","isArray","JsiSkMatrix","drawPicture","skp","JsiSkPicture","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","AlphaType","colorType","ColorType"],"sources":["JsiSkCanvas.ts"],"sourcesContent":["import type { Canvas, CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n ImageInfo,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n SkRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n getEnum(this.CanvasKit.BlendMode, mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? getEnum(this.CanvasKit.BlendMode, mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n getEnum(this.CanvasKit.PointMode, mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: SkRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(\n color,\n blendMode ? getEnum(this.CanvasKit.BlendMode, blendMode) : undefined\n );\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix | number[]) {\n this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n\n readPixels(srcX: number, srcY: number, imageInfo: ImageInfo) {\n const pxInfo = {\n width: imageInfo.width,\n height: imageInfo.height,\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n alphaType: getEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),\n colorType: getEnum(this.CanvasKit.ColorType, imageInfo.colorType),\n };\n return this.ref.readPixels(srcX, srcY, pxInfo);\n }\n}\n"],"mappings":";;;;;;;AA2BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEO,MAAMA,WAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAoC;IAC7C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;;IAD6C,iCAIrC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAN8C;EAE9C;;EAMDC,QAAQ,CAACC,IAAD,EAAeC,KAAf,EAA+B;IACrC,KAAKJ,GAAL,CAASE,QAAT,CACEG,oBAAA,CAAUC,SAAV,CAAoB,KAAKP,SAAzB,EAAoCI,IAApC,CADF,EAEEI,sBAAA,CAAWD,SAAX,CAAqBF,KAArB,CAFF;EAID;;EAEDI,SAAS,CAACC,KAAD,EAAiBC,CAAjB,EAA4BC,CAA5B,EAAuCP,KAAvC,EAAwD;IAC/D,KAAKJ,GAAL,CAASQ,SAAT,CACEI,sBAAA,CAAWN,SAAX,CAAqBG,KAArB,CADF,EAEEC,CAFF,EAGEC,CAHF,EAIEP,KAAK,GAAGG,sBAAA,CAAWD,SAAX,CAAqBF,KAArB,CAAH,GAAiCA,KAJxC;EAMD;;EAEDS,aAAa,CACXC,GADW,EAEXC,GAFW,EAGXC,IAHW,EAIXZ,KAJW,EAKXa,UALW,EAMX;IACA,KAAKjB,GAAL,CAASa,aAAT,CACED,sBAAA,CAAWN,SAAX,CAAqBQ,GAArB,CADF,EAEET,oBAAA,CAAUC,SAAV,CAAoB,KAAKP,SAAzB,EAAoCgB,GAApC,CAFF,EAGEV,oBAAA,CAAUC,SAAV,CAAoB,KAAKP,SAAzB,EAAoCiB,IAApC,CAHF,EAIET,sBAAA,CAAWD,SAAX,CAAqBF,KAArB,CAJ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;;EAEDI,MAAM,CAACC,CAAD,EAAyB;IAC7B,KAAK7H,GAAL,CAAS4H,MAAT,CAAgB5F,KAAK,CAAC8F,OAAN,CAAcD,CAAd,IAAmBA,CAAnB,GAAuBE,wBAAA,CAAYzH,SAAZ,CAAsBuH,CAAtB,CAAvC;EACD;;EAEDG,WAAW,CAACC,GAAD,EAAiB;IAC1B,KAAKjI,GAAL,CAASgI,WAAT,CAAqBE,0BAAA,CAAa5H,SAAb,CAAuB2H,GAAvB,CAArB;EACD;;EAEDE,UAAU,CAACC,IAAD,EAAeC,IAAf,EAA6BC,SAA7B,EAAmD;IAC3D,MAAMC,MAAM,GAAG;MACbC,KAAK,EAAEF,SAAS,CAACE,KADJ;MAEbC,MAAM,EAAEH,SAAS,CAACG,MAFL;MAGbC,UAAU,EAAE,KAAK3I,SAAL,CAAe4I,UAAf,CAA0BC,IAHzB;MAIbC,SAAS,EAAE,IAAAnH,aAAA,EAAQ,KAAK3B,SAAL,CAAe+I,SAAvB,EAAkCR,SAAS,CAACO,SAA5C,CAJE;MAKbE,SAAS,EAAE,IAAArH,aAAA,EAAQ,KAAK3B,SAAL,CAAeiJ,SAAvB,EAAkCV,SAAS,CAACS,SAA5C;IALE,CAAf;IAOA,OAAO,KAAK/I,GAAL,CAASmI,UAAT,CAAoBC,IAApB,EAA0BC,IAA1B,EAAgCE,MAAhC,CAAP;EACD;;AA9VH"}
|
@@ -19,7 +19,7 @@ class JsiSkColorFilterFactory extends _Host.Host {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
MakeBlend(color, mode) {
|
22
|
-
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(color, (0, _Host.
|
22
|
+
return new _JsiSkColorFilter.JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(color, (0, _Host.getEnum)(this.CanvasKit.BlendMode, mode)));
|
23
23
|
}
|
24
24
|
|
25
25
|
MakeCompose(outer, inner) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkColorFilterFactory","Host","constructor","CanvasKit","MakeMatrix","cMatrix","JsiSkColorFilter","ColorFilter","MakeBlend","color","mode","
|
1
|
+
{"version":3,"names":["JsiSkColorFilterFactory","Host","constructor","CanvasKit","MakeMatrix","cMatrix","JsiSkColorFilter","ColorFilter","MakeBlend","color","mode","getEnum","BlendMode","MakeCompose","outer","inner","fromValue","MakeLerp","t","dst","src","MakeLinearToSRGBGamma","MakeSRGBToLinearGamma","MakeLumaColorFilter","MakeLuma"],"sources":["JsiSkColorFilterFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n ColorFilterFactory,\n SkColorFilter,\n InputColorMatrix,\n SkColor,\n BlendMode,\n} from \"../types\";\n\nimport { getEnum, Host } from \"./Host\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\n\nexport class JsiSkColorFilterFactory\n extends Host\n implements ColorFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeMatrix(cMatrix: InputColorMatrix) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeMatrix(cMatrix)\n );\n }\n\n MakeBlend(color: SkColor, mode: BlendMode) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeBlend(\n color,\n getEnum(this.CanvasKit.BlendMode, mode)\n )\n );\n }\n\n MakeCompose(outer: SkColorFilter, inner: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeCompose(\n JsiSkColorFilter.fromValue(outer),\n JsiSkColorFilter.fromValue(inner)\n )\n );\n }\n\n MakeLerp(t: number, dst: SkColorFilter, src: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLerp(\n t,\n JsiSkColorFilter.fromValue(dst),\n JsiSkColorFilter.fromValue(src)\n )\n );\n }\n\n MakeLinearToSRGBGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLinearToSRGBGamma()\n );\n }\n\n MakeSRGBToLinearGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeSRGBToLinearGamma()\n );\n }\n\n MakeLumaColorFilter(): SkColorFilter {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLuma()\n );\n }\n}\n"],"mappings":";;;;;;;AAUA;;AACA;;AAEO,MAAMA,uBAAN,SACGC,UADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,UAAU,CAACC,OAAD,EAA4B;IACpC,OAAO,IAAIC,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BH,UAA3B,CAAsCC,OAAtC,CAFK,CAAP;EAID;;EAEDG,SAAS,CAACC,KAAD,EAAiBC,IAAjB,EAAkC;IACzC,OAAO,IAAIJ,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BC,SAA3B,CACEC,KADF,EAEE,IAAAE,aAAA,EAAQ,KAAKR,SAAL,CAAeS,SAAvB,EAAkCF,IAAlC,CAFF,CAFK,CAAP;EAOD;;EAEDG,WAAW,CAACC,KAAD,EAAuBC,KAAvB,EAA6C;IACtD,OAAO,IAAIT,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BM,WAA3B,CACEP,kCAAA,CAAiBU,SAAjB,CAA2BF,KAA3B,CADF,EAEER,kCAAA,CAAiBU,SAAjB,CAA2BD,KAA3B,CAFF,CAFK,CAAP;EAOD;;EAEDE,QAAQ,CAACC,CAAD,EAAYC,GAAZ,EAAgCC,GAAhC,EAAoD;IAC1D,OAAO,IAAId,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BU,QAA3B,CACEC,CADF,EAEEZ,kCAAA,CAAiBU,SAAjB,CAA2BG,GAA3B,CAFF,EAGEb,kCAAA,CAAiBU,SAAjB,CAA2BI,GAA3B,CAHF,CAFK,CAAP;EAQD;;EAEDC,qBAAqB,GAAG;IACtB,OAAO,IAAIf,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2Bc,qBAA3B,EAFK,CAAP;EAID;;EAEDC,qBAAqB,GAAG;IACtB,OAAO,IAAIhB,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2Be,qBAA3B,EAFK,CAAP;EAID;;EAEDC,mBAAmB,GAAkB;IACnC,OAAO,IAAIjB,kCAAJ,CACL,KAAKH,SADA,EAEL,KAAKA,SAAL,CAAeI,WAAf,CAA2BiB,QAA3B,EAFK,CAAP;EAID;;AA9DH"}
|
@@ -82,7 +82,7 @@ class JsiSkFont extends _Host.HostObject {
|
|
82
82
|
}
|
83
83
|
|
84
84
|
setEdging(edging) {
|
85
|
-
this.ref.setEdging((0, _Host.
|
85
|
+
this.ref.setEdging((0, _Host.getEnum)(this.CanvasKit.FontEdging, edging));
|
86
86
|
}
|
87
87
|
|
88
88
|
setEmbeddedBitmaps(embeddedBitmaps) {
|
@@ -90,7 +90,7 @@ class JsiSkFont extends _Host.HostObject {
|
|
90
90
|
}
|
91
91
|
|
92
92
|
setHinting(hinting) {
|
93
|
-
this.ref.setHinting((0, _Host.
|
93
|
+
this.ref.setHinting((0, _Host.getEnum)(this.CanvasKit.FontHinting, hinting));
|
94
94
|
}
|
95
95
|
|
96
96
|
setLinearMetrics(linearMetrics) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkFont","HostObject","constructor","CanvasKit","ref","delete","measureText","_text","_paint","NotImplementedOnRNWeb","getTextWidth","text","paint","ids","getGlyphIDs","widths","getGlyphWidths","reduce","a","b","getMetrics","result","ascent","descent","leading","bounds","JsiSkRect","undefined","str","numCodePoints","glyphs","JsiSkPaint","fromValue","getGlyphIntercepts","positions","top","bottom","map","p","Array","from","JsiSkPoint","flat","getScaleX","getSize","getSkewX","isEmbolden","getTypeface","tf","JsiSkTypeface","setEdging","edging","
|
1
|
+
{"version":3,"names":["JsiSkFont","HostObject","constructor","CanvasKit","ref","delete","measureText","_text","_paint","NotImplementedOnRNWeb","getTextWidth","text","paint","ids","getGlyphIDs","widths","getGlyphWidths","reduce","a","b","getMetrics","result","ascent","descent","leading","bounds","JsiSkRect","undefined","str","numCodePoints","glyphs","JsiSkPaint","fromValue","getGlyphIntercepts","positions","top","bottom","map","p","Array","from","JsiSkPoint","flat","getScaleX","getSize","getSkewX","isEmbolden","getTypeface","tf","JsiSkTypeface","setEdging","edging","getEnum","FontEdging","setEmbeddedBitmaps","embeddedBitmaps","setHinting","hinting","FontHinting","setLinearMetrics","linearMetrics","setScaleX","sx","setSize","points","setSkewX","setEmbolden","embolden","setSubpixel","subpixel","setTypeface","face"],"sources":["JsiSkFont.ts"],"sourcesContent":["import type { CanvasKit, Font } from \"canvaskit-wasm\";\n\nimport type {\n FontEdging,\n FontHinting,\n SkFont,\n SkPaint,\n SkPoint,\n SkRect,\n SkTypeface,\n} from \"../types\";\n\nimport { HostObject, NotImplementedOnRNWeb, getEnum } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\n\nexport class JsiSkFont extends HostObject<Font, \"Font\"> implements SkFont {\n constructor(CanvasKit: CanvasKit, ref: Font) {\n super(CanvasKit, ref, \"Font\");\n }\n\n measureText(_text: string, _paint?: SkPaint | undefined): SkRect {\n throw new NotImplementedOnRNWeb();\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n getTextWidth(text: string, paint?: SkPaint | undefined) {\n const ids = this.getGlyphIDs(text);\n const widths = this.getGlyphWidths(ids, paint);\n return widths.reduce((a, b) => a + b, 0);\n }\n\n getMetrics() {\n const result = this.ref.getMetrics();\n return {\n ascent: result.ascent,\n descent: result.descent,\n leading: result.leading,\n bounds: result.bounds\n ? new JsiSkRect(this.CanvasKit, result.bounds)\n : undefined,\n };\n }\n\n getGlyphIDs(str: string, numCodePoints?: number) {\n // TODO: Fix return value in the C++ implementation\n return [...this.ref.getGlyphIDs(str, numCodePoints)];\n }\n\n // TODO: Fix return value in the C++ implementation, it return float32\n getGlyphWidths(glyphs: number[], paint?: SkPaint | null) {\n return [\n ...this.ref.getGlyphWidths(\n glyphs,\n paint ? JsiSkPaint.fromValue(paint) : null\n ),\n ];\n }\n\n getGlyphIntercepts(\n glyphs: number[],\n positions: SkPoint[],\n top: number,\n bottom: number\n ) {\n return [\n ...this.ref.getGlyphIntercepts(\n glyphs,\n positions.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),\n top,\n bottom\n ),\n ];\n }\n\n getScaleX() {\n return this.ref.getScaleX();\n }\n\n getSize() {\n return this.ref.getSize();\n }\n\n getSkewX() {\n return this.ref.getSkewX();\n }\n\n isEmbolden() {\n return this.ref.isEmbolden();\n }\n\n getTypeface() {\n const tf = this.ref.getTypeface();\n return tf ? new JsiSkTypeface(this.CanvasKit, tf) : null;\n }\n\n setEdging(edging: FontEdging) {\n this.ref.setEdging(getEnum(this.CanvasKit.FontEdging, edging));\n }\n\n setEmbeddedBitmaps(embeddedBitmaps: boolean) {\n this.ref.setEmbeddedBitmaps(embeddedBitmaps);\n }\n\n setHinting(hinting: FontHinting) {\n this.ref.setHinting(getEnum(this.CanvasKit.FontHinting, hinting));\n }\n\n setLinearMetrics(linearMetrics: boolean) {\n this.ref.setLinearMetrics(linearMetrics);\n }\n\n setScaleX(sx: number) {\n this.ref.setScaleX(sx);\n }\n\n setSize(points: number) {\n this.ref.setSize(points);\n }\n\n setSkewX(sx: number) {\n this.ref.setSkewX(sx);\n }\n\n setEmbolden(embolden: boolean) {\n this.ref.setEmbolden(embolden);\n }\n\n setSubpixel(subpixel: boolean) {\n this.ref.setSubpixel(subpixel);\n }\n\n setTypeface(face: SkTypeface | null) {\n this.ref.setTypeface(face ? JsiSkTypeface.fromValue(face) : null);\n }\n}\n"],"mappings":";;;;;;;AAYA;;AACA;;AACA;;AACA;;AACA;;;;AAEO,MAAMA,SAAN,SAAwBC,gBAAxB,CAAmE;EACxEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAkC;IAC3C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,MAAtB;;IAD2C,iCAQnC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAV4C;EAE5C;;EAEDC,WAAW,CAACC,KAAD,EAAgBC,MAAhB,EAAsD;IAC/D,MAAM,IAAIC,2BAAJ,EAAN;EACD;;EAMDC,YAAY,CAACC,IAAD,EAAeC,KAAf,EAA4C;IACtD,MAAMC,GAAG,GAAG,KAAKC,WAAL,CAAiBH,IAAjB,CAAZ;IACA,MAAMI,MAAM,GAAG,KAAKC,cAAL,CAAoBH,GAApB,EAAyBD,KAAzB,CAAf;IACA,OAAOG,MAAM,CAACE,MAAP,CAAc,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,GAAGC,CAA5B,EAA+B,CAA/B,CAAP;EACD;;EAEDC,UAAU,GAAG;IACX,MAAMC,MAAM,GAAG,KAAKjB,GAAL,CAASgB,UAAT,EAAf;IACA,OAAO;MACLE,MAAM,EAAED,MAAM,CAACC,MADV;MAELC,OAAO,EAAEF,MAAM,CAACE,OAFX;MAGLC,OAAO,EAAEH,MAAM,CAACG,OAHX;MAILC,MAAM,EAAEJ,MAAM,CAACI,MAAP,GACJ,IAAIC,oBAAJ,CAAc,KAAKvB,SAAnB,EAA8BkB,MAAM,CAACI,MAArC,CADI,GAEJE;IANC,CAAP;EAQD;;EAEDb,WAAW,CAACc,GAAD,EAAcC,aAAd,EAAsC;IAC/C;IACA,OAAO,CAAC,GAAG,K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C,CAAnB;EACD;;EAEDG,kBAAkB,CAACC,eAAD,EAA2B;IAC3C,KAAKnD,GAAL,CAASkD,kBAAT,CAA4BC,eAA5B;EACD;;EAEDC,UAAU,CAACC,OAAD,EAAuB;IAC/B,KAAKrD,GAAL,CAASoD,UAAT,CAAoB,IAAAJ,aAAA,EAAQ,KAAKjD,SAAL,CAAeuD,WAAvB,EAAoCD,OAApC,CAApB;EACD;;EAEDE,gBAAgB,CAACC,aAAD,EAAyB;IACvC,KAAKxD,GAAL,CAASuD,gBAAT,CAA0BC,aAA1B;EACD;;EAEDC,SAAS,CAACC,EAAD,EAAa;IACpB,KAAK1D,GAAL,CAASyD,SAAT,CAAmBC,EAAnB;EACD;;EAEDC,OAAO,CAACC,MAAD,EAAiB;IACtB,KAAK5D,GAAL,CAAS2D,OAAT,CAAiBC,MAAjB;EACD;;EAEDC,QAAQ,CAACH,EAAD,EAAa;IACnB,KAAK1D,GAAL,CAAS6D,QAAT,CAAkBH,EAAlB;EACD;;EAEDI,WAAW,CAACC,QAAD,EAAoB;IAC7B,KAAK/D,GAAL,CAAS8D,WAAT,CAAqBC,QAArB;EACD;;EAEDC,WAAW,CAACC,QAAD,EAAoB;IAC7B,KAAKjE,GAAL,CAASgE,WAAT,CAAqBC,QAArB;EACD;;EAEDC,WAAW,CAACC,IAAD,EAA0B;IACnC,KAAKnE,GAAL,CAASkE,WAAT,CAAqBC,IAAI,GAAGtB,4BAAA,CAAcjB,SAAd,CAAwBuC,IAAxB,CAAH,GAAmC,IAA5D;EACD;;AAzHuE"}
|
@@ -73,20 +73,20 @@ class JsiSkImage extends _Host.HostObject {
|
|
73
73
|
}
|
74
74
|
|
75
75
|
makeShaderOptions(tx, ty, fm, mm, localMatrix) {
|
76
|
-
return new _JsiSkShader.JsiSkShader(this.CanvasKit, this.ref.makeShaderOptions((0, _Host.
|
76
|
+
return new _JsiSkShader.JsiSkShader(this.CanvasKit, this.ref.makeShaderOptions((0, _Host.getEnum)(this.CanvasKit.TileMode, tx), (0, _Host.getEnum)(this.CanvasKit.TileMode, ty), (0, _Host.getEnum)(this.CanvasKit.FilterMode, fm), (0, _Host.getEnum)(this.CanvasKit.MipmapMode, mm), localMatrix ? _JsiSkMatrix.JsiSkMatrix.fromValue(localMatrix) : undefined));
|
77
77
|
}
|
78
78
|
|
79
79
|
makeShaderCubic(tx, ty, B, C, localMatrix) {
|
80
|
-
return new _JsiSkShader.JsiSkShader(this.CanvasKit, this.ref.makeShaderCubic((0, _Host.
|
80
|
+
return new _JsiSkShader.JsiSkShader(this.CanvasKit, this.ref.makeShaderCubic((0, _Host.getEnum)(this.CanvasKit.TileMode, tx), (0, _Host.getEnum)(this.CanvasKit.TileMode, ty), B, C, localMatrix ? _JsiSkMatrix.JsiSkMatrix.fromValue(localMatrix) : undefined));
|
81
81
|
}
|
82
82
|
|
83
83
|
encodeToBytes(fmt, quality) {
|
84
84
|
let result;
|
85
85
|
|
86
86
|
if (fmt && quality) {
|
87
|
-
result = this.ref.encodeToBytes((0, _Host.
|
87
|
+
result = this.ref.encodeToBytes((0, _Host.getEnum)(this.CanvasKit.ImageFormat, fmt), quality);
|
88
88
|
} else if (fmt) {
|
89
|
-
result = this.ref.encodeToBytes((0, _Host.
|
89
|
+
result = this.ref.encodeToBytes((0, _Host.getEnum)(this.CanvasKit.ImageFormat, fmt));
|
90
90
|
} else {
|
91
91
|
result = this.ref.encodeToBytes();
|
92
92
|
}
|
@@ -109,8 +109,8 @@ class JsiSkImage extends _Host.HostObject {
|
|
109
109
|
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
110
110
|
width: (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.width) ?? info.width,
|
111
111
|
height: (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.height) ?? info.height,
|
112
|
-
alphaType: (0, _Host.
|
113
|
-
colorType: (0, _Host.
|
112
|
+
alphaType: (0, _Host.getEnum)(this.CanvasKit.AlphaType, (imageInfo ?? info).alphaType),
|
113
|
+
colorType: (0, _Host.getEnum)(this.CanvasKit.ColorType, (imageInfo ?? info).colorType)
|
114
114
|
};
|
115
115
|
return this.ref.readPixels(srcX ?? 0, srcY ?? 0, pxInfo);
|
116
116
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["toBase64String","bytes","Buffer","from","toString","CHUNK_SIZE","index","length","result","slice","Math","min","String","fromCharCode","apply","btoa","JsiSkImage","HostObject","constructor","CanvasKit","ref","delete","height","width","getImageInfo","info","colorType","value","alphaType","makeShaderOptions","tx","ty","fm","mm","localMatrix","JsiSkShader","
|
1
|
+
{"version":3,"names":["toBase64String","bytes","Buffer","from","toString","CHUNK_SIZE","index","length","result","slice","Math","min","String","fromCharCode","apply","btoa","JsiSkImage","HostObject","constructor","CanvasKit","ref","delete","height","width","getImageInfo","info","colorType","value","alphaType","makeShaderOptions","tx","ty","fm","mm","localMatrix","JsiSkShader","getEnum","TileMode","FilterMode","MipmapMode","JsiSkMatrix","fromValue","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","quality","ImageFormat","Error","encodeToBase64","readPixels","srcX","srcY","imageInfo","pxInfo","colorSpace","ColorSpace","SRGB","AlphaType","ColorType","makeNonTextureImage","MakeImageFromEncoded"],"sources":["JsiSkImage.ts"],"sourcesContent":["import type {\n CanvasKit,\n ImageInfo as CKImageInfo,\n Image,\n} from \"canvaskit-wasm\";\n\nimport type {\n FilterMode,\n MipmapMode,\n SkImage,\n SkMatrix,\n SkShader,\n TileMode,\n ImageFormat,\n ImageInfo,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\n// https://github.com/google/skia/blob/1f193df9b393d50da39570dab77a0bb5d28ec8ef/modules/canvaskit/htmlcanvas/util.js\nexport const toBase64String = (bytes: Uint8Array) => {\n if (typeof Buffer !== \"undefined\") {\n // Are we on node?\n return Buffer.from(bytes).toString(\"base64\");\n } else {\n // From https://stackoverflow.com/a/25644409\n // because the naive solution of\n // btoa(String.fromCharCode.apply(null, bytes));\n // would occasionally throw \"Maximum call stack size exceeded\"\n var CHUNK_SIZE = 0x8000; //arbitrary number\n var index = 0;\n var { length } = bytes;\n var result = \"\";\n var slice;\n while (index < length) {\n slice = bytes.slice(index, Math.min(index + CHUNK_SIZE, length));\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result += String.fromCharCode.apply(null, slice as any);\n index += CHUNK_SIZE;\n }\n return btoa(result);\n }\n};\n\nexport class JsiSkImage extends HostObject<Image, \"Image\"> implements SkImage {\n constructor(CanvasKit: CanvasKit, ref: Image) {\n super(CanvasKit, ref, \"Image\");\n }\n\n height() {\n return this.ref.height();\n }\n\n width() {\n return this.ref.width();\n }\n\n getImageInfo(): ImageInfo {\n const info = this.ref.getImageInfo();\n return {\n width: info.width,\n height: info.height,\n colorType: info.colorType.value,\n alphaType: info.alphaType.value,\n };\n }\n\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderOptions(\n getEnum(this.CanvasKit.TileMode, tx),\n getEnum(this.CanvasKit.TileMode, ty),\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderCubic(\n getEnum(this.CanvasKit.TileMode, tx),\n getEnum(this.CanvasKit.TileMode, ty),\n B,\n C,\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n encodeToBytes(fmt?: ImageFormat, quality?: number) {\n let result: Uint8Array | null;\n if (fmt && quality) {\n result = this.ref.encodeToBytes(\n getEnum(this.CanvasKit.ImageFormat, fmt),\n quality\n );\n } else if (fmt) {\n result = this.ref.encodeToBytes(getEnum(this.CanvasKit.ImageFormat, fmt));\n } else {\n result = this.ref.encodeToBytes();\n }\n if (!result) {\n throw new Error(\"encodeToBytes failed\");\n }\n return result;\n }\n\n encodeToBase64(fmt?: ImageFormat, quality?: number) {\n const bytes = this.encodeToBytes(fmt, quality);\n return toBase64String(bytes);\n }\n\n readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo) {\n const info = this.getImageInfo();\n const pxInfo: CKImageInfo = {\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n width: imageInfo?.width ?? info.width,\n height: imageInfo?.height ?? info.height,\n alphaType: getEnum(\n this.CanvasKit.AlphaType,\n (imageInfo ?? info).alphaType\n ),\n colorType: getEnum(\n this.CanvasKit.ColorType,\n (imageInfo ?? info).colorType\n ),\n };\n return this.ref.readPixels(srcX ?? 0, srcY ?? 0, pxInfo);\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n makeNonTextureImage(): SkImage {\n return new JsiSkImage(\n this.CanvasKit,\n this.CanvasKit.MakeImageFromEncoded(this.encodeToBytes())!\n );\n }\n}\n"],"mappings":";;;;;;;AAiBA;;AACA;;AACA;;;;AAEA;AACO,MAAMA,cAAc,GAAIC,KAAD,IAAuB;EACnD,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;IACjC;IACA,OAAOA,MAAM,CAACC,IAAP,CAAYF,KAAZ,EAAmBG,QAAnB,CAA4B,QAA5B,CAAP;EACD,CAHD,MAGO;IACL;IACA;IACA;IACA;IACA,IAAIC,UAAU,GAAG,MAAjB,CALK,CAKoB;;IACzB,IAAIC,KAAK,GAAG,CAAZ;IACA,IAAI;MAAEC;IAAF,IAAaN,KAAjB;IACA,IAAIO,MAAM,GAAG,EAAb;IACA,IAAIC,KAAJ;;IACA,OAAOH,KAAK,GAAGC,MAAf,EAAuB;MACrBE,KAAK,GAAGR,KAAK,CAACQ,KAAN,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
36
|
MakeImage(info, data, bytesPerRow) {
|
37
37
|
// see toSkImageInfo() from canvaskit
|
38
38
|
const image = this.CanvasKit.MakeImage({
|
39
|
-
alphaType: (0, _Host.
|
39
|
+
alphaType: (0, _Host.getEnum)(this.CanvasKit.AlphaType, info.alphaType),
|
40
40
|
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
41
|
-
colorType: (0, _Host.
|
41
|
+
colorType: (0, _Host.getEnum)(this.CanvasKit.ColorType, info.colorType),
|
42
42
|
height: info.height,
|
43
43
|
width: info.width
|
44
44
|
}, _JsiSkData.JsiSkData.fromValue(data), bytesPerRow);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkImageFactory","Host","constructor","CanvasKit","MakeImageFromViewTag","viewTag","view","console","log","Promise","resolve","MakeImageFromEncoded","encoded","image","JsiSkData","fromValue","JsiSkImage","MakeImage","info","data","bytesPerRow","alphaType","
|
1
|
+
{"version":3,"names":["JsiSkImageFactory","Host","constructor","CanvasKit","MakeImageFromViewTag","viewTag","view","console","log","Promise","resolve","MakeImageFromEncoded","encoded","image","JsiSkData","fromValue","JsiSkImage","MakeImage","info","data","bytesPerRow","alphaType","getEnum","AlphaType","colorSpace","ColorSpace","SRGB","colorType","ColorType","height","width"],"sources":["JsiSkImageFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkData, ImageInfo, SkImage } from \"../types\";\nimport type { ImageFactory } from \"../types/Image/ImageFactory\";\n\nimport { Host, getEnum } from \"./Host\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkData } from \"./JsiSkData\";\n\nexport class JsiSkImageFactory extends Host implements ImageFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeImageFromViewTag(viewTag: number): Promise<SkImage | null> {\n const view = viewTag as unknown as HTMLElement;\n // TODO: Implement screenshot from view in React JS\n console.log(view);\n return Promise.resolve(null);\n }\n\n MakeImageFromEncoded(encoded: SkData) {\n const image = this.CanvasKit.MakeImageFromEncoded(\n JsiSkData.fromValue(encoded)\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number) {\n // see toSkImageInfo() from canvaskit\n const image = this.CanvasKit.MakeImage(\n {\n alphaType: getEnum(this.CanvasKit.AlphaType, info.alphaType),\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n colorType: getEnum(this.CanvasKit.ColorType, info.colorType),\n height: info.height,\n width: info.width,\n },\n JsiSkData.fromValue(data),\n bytesPerRow\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n}\n"],"mappings":";;;;;;;AAKA;;AACA;;AACA;;AAEO,MAAMA,iBAAN,SAAgCC,UAAhC,CAA6D;EAClEC,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,oBAAoB,CAACC,OAAD,EAA2C;IAC7D,MAAMC,IAAI,GAAGD,OAAb,CAD6D,CAE7D;;IACAE,OAAO,CAACC,GAAR,CAAYF,IAAZ;IACA,OAAOG,OAAO,CAACC,OAAR,CAAgB,IAAhB,CAAP;EACD;;EAEDC,oBAAoB,CAACC,OAAD,EAAkB;IACpC,MAAMC,KAAK,GAAG,KAAKV,SAAL,CAAeQ,oBAAf,CACZG,oBAAA,CAAUC,SAAV,CAAoBH,OAApB,CADY,CAAd;;IAGA,IAAIC,KAAK,KAAK,IAAd,EAAoB;MAClB,OAAO,IAAP;IACD;;IACD,OAAO,IAAIG,sBAAJ,CAAe,KAAKb,SAApB,EAA+BU,KAA/B,CAAP;EACD;;EAEDI,SAAS,CAACC,IAAD,EAAkBC,IAAlB,EAAgCC,WAAhC,EAAqD;IAC5D;IACA,MAAMP,KAAK,GAAG,KAAKV,SAAL,CAAec,SAAf,CACZ;MACEI,SAAS,EAAE,IAAAC,aAAA,EAAQ,KAAKnB,SAAL,CAAeoB,SAAvB,EAAkCL,IAAI,CAACG,SAAvC,CADb;MAEEG,UAAU,EAAE,KAAKrB,SAAL,CAAesB,UAAf,CAA0BC,IAFxC;MAGEC,SAAS,EAAE,IAAAL,aAAA,EAAQ,KAAKnB,SAAL,CAAeyB,SAAvB,EAAkCV,IAAI,CAACS,SAAvC,CAHb;MAIEE,MAAM,EAAEX,IAAI,CAACW,MAJf;MAKEC,KAAK,EAAEZ,IAAI,CAACY;IALd,CADY,EAQZhB,oBAAA,CAAUC,SAAV,CAAoBI,IAApB,CARY,EASZC,WATY,CAAd;;IAWA,IAAIP,KAAK,KAAK,IAAd,EAAoB;MAClB,OAAO,IAAP;IACD;;IACD,OAAO,IAAIG,sBAAJ,CAAe,KAAKb,SAApB,EAA+BU,KAA/B,CAAP;EACD;;AAvCiE"}
|
@@ -24,7 +24,7 @@ class JsiSkImageFilterFactory extends _Host.Host {
|
|
24
24
|
|
25
25
|
MakeDisplacementMap(channelX, channelY, scale, in1, input) {
|
26
26
|
const inputFilter = input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input);
|
27
|
-
const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap((0, _Host.
|
27
|
+
const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap((0, _Host.getEnum)(this.CanvasKit.ColorChannel, channelX), (0, _Host.getEnum)(this.CanvasKit.ColorChannel, channelY), scale, _JsiSkImageFilter.JsiSkImageFilter.fromValue(in1), inputFilter);
|
28
28
|
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
29
29
|
}
|
30
30
|
|
@@ -34,7 +34,7 @@ class JsiSkImageFilterFactory extends _Host.Host {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
MakeBlur(sigmaX, sigmaY, mode, input) {
|
37
|
-
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeBlur(sigmaX, sigmaY, (0, _Host.
|
37
|
+
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, this.CanvasKit.ImageFilter.MakeBlur(sigmaX, sigmaY, (0, _Host.getEnum)(this.CanvasKit.TileMode, mode), input === null ? null : _JsiSkImageFilter.JsiSkImageFilter.fromValue(input)));
|
38
38
|
}
|
39
39
|
|
40
40
|
MakeColorFilter(cf, input) {
|
@@ -96,7 +96,7 @@ class JsiSkImageFilterFactory extends _Host.Host {
|
|
96
96
|
throw new _Host.NotImplementedOnRNWeb("The cropRect argument is not yet supported on React Native Web.");
|
97
97
|
}
|
98
98
|
|
99
|
-
const filter = this.CanvasKit.ImageFilter.MakeBlend((0, _Host.
|
99
|
+
const filter = this.CanvasKit.ImageFilter.MakeBlend((0, _Host.getEnum)(this.CanvasKit.BlendMode, mode), _JsiSkImageFilter.JsiSkImageFilter.fromValue(background), inputFilter);
|
100
100
|
return new _JsiSkImageFilter.JsiSkImageFilter(this.CanvasKit, filter);
|
101
101
|
}
|
102
102
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkImageFilterFactory","Host","constructor","CanvasKit","MakeOffset","dx","dy","input","inputFilter","JsiSkImageFilter","fromValue","filter","ImageFilter","MakeDisplacementMap","channelX","channelY","scale","in1","ckEnum","MakeShader","shader","_input","MakeBlur","sigmaX","sigmaY","mode","MakeColorFilter","cf","JsiSkColorFilter","MakeCompose","outer","inner","MakeDropShadow","color","cropRect","NotImplementedOnRNWeb","MakeDropShadowOnly","MakeErode","rx","ry","MakeDilate","MakeBlend","background","foreground","MakeRuntimeShader","_builder","_childShaderName"],"sources":["JsiSkImageFilterFactory.ts"],"sourcesContent":["import type { CanvasKit, ImageFilter } from \"canvaskit-wasm\";\n\nimport type {\n ColorChannel,\n ImageFilterFactory,\n SkColor,\n SkColorFilter,\n SkImageFilter,\n BlendMode,\n SkRect,\n SkRuntimeShaderBuilder,\n SkShader,\n TileMode,\n} from \"../types\";\n\nimport { Host, NotImplementedOnRNWeb, ckEnum } from \"./Host\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\n\nexport class JsiSkImageFilterFactory\n extends Host\n implements ImageFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeOffset(dx: number, dy: number, input: SkImageFilter | null) {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n const filter = this.CanvasKit.ImageFilter.MakeOffset(dx, dy, inputFilter);\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeDisplacementMap(\n channelX: ColorChannel,\n channelY: ColorChannel,\n scale: number,\n in1: SkImageFilter,\n input: SkImageFilter | null\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap(\n ckEnum(channelX),\n ckEnum(channelY),\n scale,\n JsiSkImageFilter.fromValue(in1),\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeShader(shader: SkShader, _input: SkImageFilter | null): SkImageFilter {\n const filter = this.CanvasKit.ImageFilter.MakeShader(\n JsiSkImageFilter.fromValue(shader)\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeBlur(\n sigmaX,\n sigmaY,\n ckEnum(mode),\n input === null ? null : JsiSkImageFilter.fromValue(input)\n )\n );\n }\n\n MakeColorFilter(cf: SkColorFilter, input: SkImageFilter | null) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeColorFilter(\n JsiSkColorFilter.fromValue(cf),\n input === null ? null : JsiSkImageFilter.fromValue(input)\n )\n );\n }\n\n MakeCompose(outer: SkImageFilter | null, inner: SkImageFilter | null) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeCompose(\n outer === null ? null : JsiSkImageFilter.fromValue(outer),\n inner === null ? null : JsiSkImageFilter.fromValue(inner)\n )\n );\n }\n\n MakeDropShadow(\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeDropShadow(\n dx,\n dy,\n sigmaX,\n sigmaY,\n color,\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeDropShadowOnly(\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeDropShadowOnly(\n dx,\n dy,\n sigmaX,\n sigmaY,\n color,\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeErode(\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeErode(rx, ry, inputFilter);\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeDilate(\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeDilate(rx, ry, inputFilter);\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeBlend(\n mode: BlendMode,\n background: SkImageFilter,\n foreground: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n foreground === null\n ? null\n : JsiSkImageFilter.fromValue<ImageFilter>(foreground);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeBlend(\n ckEnum(mode),\n JsiSkImageFilter.fromValue(background),\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeRuntimeShader(\n _builder: SkRuntimeShaderBuilder,\n _childShaderName: string | null,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n}\n"],"mappings":";;;;;;;AAeA;;AACA;;AACA;;AAEO,MAAMA,uBAAN,SACGC,UADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,UAAU,CAACC,EAAD,EAAaC,EAAb,EAAyBC,KAAzB,EAAsD;IAC9D,MAAMC,WAAW,GACfD,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwBE,kCAAA,CAAiBC,SAAjB,CAAwCH,KAAxC,CAD1B;IAEA,MAAMI,MAAM,GAAG,KAAKR,SAAL,CAAeS,WAAf,CAA2BR,UAA3B,CAAsCC,EAAtC,EAA0CC,EAA1C,EAA8CE,WAA9C,CAAf;IACA,OAAO,IAAIC,kCAAJ,CAAqB,KAAKN,SAA1B,EAAqCQ,MAArC,CAAP;EACD;;EAEDE,mBAAmB,CACjBC,QADiB,EAEjBC,QAFiB,EAGjBC,KAHiB,EAIjBC,GAJiB,EAKjBV,KALiB,EAMF;IACf,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SAAS,CACPhB,IADO,EAEPiB,UAFO,EAGPC,UAHO,EAIPT,QAJO,EAKQ;IACf,MAAM1B,WAAW,GACfmC,UAAU,KAAK,IAAf,GACI,IADJ,GAEIlC,kCAAA,CAAiBC,SAAjB,CAAwCiC,UAAxC,CAHN;;IAIA,IAAIT,QAAJ,EAAc;MACZ,MAAM,IAAIC,2BAAJ,CACJ,iEADI,CAAN;IAGD;;IACD,MAAMxB,MAAM,GAAG,KAAKR,SAAL,CAAeS,WAAf,CAA2B6B,SAA3B,CACb,IAAAvB,YAAA,EAAOO,IAAP,CADa,EAEbhB,kCAAA,CAAiBC,SAAjB,CAA2BgC,UAA3B,CAFa,EAGblC,WAHa,CAAf;IAKA,OAAO,IAAIC,kCAAJ,CAAqB,KAAKN,SAA1B,EAAqCQ,MAArC,CAAP;EACD;;EAEDiC,iBAAiB,CACfC,QADe,EAEfC,gBAFe,EAGfzB,MAHe,EAIA;IACf,MAAM,IAAIc,2BAAJ,EAAN;EACD;;AAhMH"}
|
1
|
+
{"version":3,"names":["JsiSkImageFilterFactory","Host","constructor","CanvasKit","MakeOffset","dx","dy","input","inputFilter","JsiSkImageFilter","fromValue","filter","ImageFilter","MakeDisplacementMap","channelX","channelY","scale","in1","getEnum","ColorChannel","MakeShader","shader","_input","MakeBlur","sigmaX","sigmaY","mode","TileMode","MakeColorFilter","cf","JsiSkColorFilter","MakeCompose","outer","inner","MakeDropShadow","color","cropRect","NotImplementedOnRNWeb","MakeDropShadowOnly","MakeErode","rx","ry","MakeDilate","MakeBlend","background","foreground","BlendMode","MakeRuntimeShader","_builder","_childShaderName"],"sources":["JsiSkImageFilterFactory.ts"],"sourcesContent":["import type { CanvasKit, ImageFilter } from \"canvaskit-wasm\";\n\nimport type {\n ColorChannel,\n ImageFilterFactory,\n SkColor,\n SkColorFilter,\n SkImageFilter,\n BlendMode,\n SkRect,\n SkRuntimeShaderBuilder,\n SkShader,\n TileMode,\n} from \"../types\";\n\nimport { Host, NotImplementedOnRNWeb, getEnum } from \"./Host\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\n\nexport class JsiSkImageFilterFactory\n extends Host\n implements ImageFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeOffset(dx: number, dy: number, input: SkImageFilter | null) {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n const filter = this.CanvasKit.ImageFilter.MakeOffset(dx, dy, inputFilter);\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeDisplacementMap(\n channelX: ColorChannel,\n channelY: ColorChannel,\n scale: number,\n in1: SkImageFilter,\n input: SkImageFilter | null\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap(\n getEnum(this.CanvasKit.ColorChannel, channelX),\n getEnum(this.CanvasKit.ColorChannel, channelY),\n scale,\n JsiSkImageFilter.fromValue(in1),\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeShader(shader: SkShader, _input: SkImageFilter | null): SkImageFilter {\n const filter = this.CanvasKit.ImageFilter.MakeShader(\n JsiSkImageFilter.fromValue(shader)\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeBlur(\n sigmaX,\n sigmaY,\n getEnum(this.CanvasKit.TileMode, mode),\n input === null ? null : JsiSkImageFilter.fromValue(input)\n )\n );\n }\n\n MakeColorFilter(cf: SkColorFilter, input: SkImageFilter | null) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeColorFilter(\n JsiSkColorFilter.fromValue(cf),\n input === null ? null : JsiSkImageFilter.fromValue(input)\n )\n );\n }\n\n MakeCompose(outer: SkImageFilter | null, inner: SkImageFilter | null) {\n return new JsiSkImageFilter(\n this.CanvasKit,\n this.CanvasKit.ImageFilter.MakeCompose(\n outer === null ? null : JsiSkImageFilter.fromValue(outer),\n inner === null ? null : JsiSkImageFilter.fromValue(inner)\n )\n );\n }\n\n MakeDropShadow(\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeDropShadow(\n dx,\n dy,\n sigmaX,\n sigmaY,\n color,\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeDropShadowOnly(\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeDropShadowOnly(\n dx,\n dy,\n sigmaX,\n sigmaY,\n color,\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeErode(\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeErode(rx, ry, inputFilter);\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeDilate(\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeDilate(rx, ry, inputFilter);\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeBlend(\n mode: BlendMode,\n background: SkImageFilter,\n foreground: SkImageFilter | null,\n cropRect?: SkRect\n ): SkImageFilter {\n const inputFilter =\n foreground === null\n ? null\n : JsiSkImageFilter.fromValue<ImageFilter>(foreground);\n if (cropRect) {\n throw new NotImplementedOnRNWeb(\n \"The cropRect argument is not yet supported on React Native Web.\"\n );\n }\n const filter = this.CanvasKit.ImageFilter.MakeBlend(\n getEnum(this.CanvasKit.BlendMode, mode),\n JsiSkImageFilter.fromValue(background),\n inputFilter\n );\n return new JsiSkImageFilter(this.CanvasKit, filter);\n }\n\n MakeRuntimeShader(\n _builder: SkRuntimeShaderBuilder,\n _childShaderName: string | null,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n}\n"],"mappings":";;;;;;;AAeA;;AACA;;AACA;;AAEO,MAAMA,uBAAN,SACGC,UADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,UAAU,CAACC,EAAD,EAAaC,EAAb,EAAyBC,KAAzB,EAAsD;IAC9D,MAAMC,WAAW,GACfD,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwBE,kCAAA,CAAiBC,SAAjB,CAAwCH,KAAxC,CAD1B;IAEA,MAAMI,MAAM,GAAG,KAAKR,SAAL,CAAeS,WAAf,CAA2BR,UAA3B,CAAsCC,EAAtC,EAA0CC,EAA1C,EAA8CE,WAA9C,CAAf;IACA,OAAO,IAAIC,kCAAJ,CAAqB,KAAKN,SAA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AIC,2BAAJ,CACJ,iEADI,CAAN;IAGD;;IACD,MAAM1B,MAAM,GAAG,KAAKR,SAAL,CAAeS,WAAf,CAA2B8B,UAA3B,CAAsCF,EAAtC,EAA0CC,EAA1C,EAA8CjC,WAA9C,CAAf;IACA,OAAO,IAAIC,kCAAJ,CAAqB,KAAKN,SAA1B,EAAqCQ,MAArC,CAAP;EACD;;EAEDgC,SAAS,CACPjB,IADO,EAEPkB,UAFO,EAGPC,UAHO,EAIPT,QAJO,EAKQ;IACf,MAAM5B,WAAW,GACfqC,UAAU,KAAK,IAAf,GACI,IADJ,GAEIpC,kCAAA,CAAiBC,SAAjB,CAAwCmC,UAAxC,CAHN;;IAIA,IAAIT,QAAJ,EAAc;MACZ,MAAM,IAAIC,2BAAJ,CACJ,iEADI,CAAN;IAGD;;IACD,MAAM1B,MAAM,GAAG,KAAKR,SAAL,CAAeS,WAAf,CAA2B+B,SAA3B,CACb,IAAAzB,aAAA,EAAQ,KAAKf,SAAL,CAAe2C,SAAvB,EAAkCpB,IAAlC,CADa,EAEbjB,kCAAA,CAAiBC,SAAjB,CAA2BkC,UAA3B,CAFa,EAGbpC,WAHa,CAAf;IAKA,OAAO,IAAIC,kCAAJ,CAAqB,KAAKN,SAA1B,EAAqCQ,MAArC,CAAP;EACD;;EAEDoC,iBAAiB,CACfC,QADe,EAEfC,gBAFe,EAGf3B,MAHe,EAIA;IACf,MAAM,IAAIe,2BAAJ,EAAN;EACD;;AAhMH"}
|
@@ -15,7 +15,7 @@ class JsiSkMaskFilterFactory extends _Host.Host {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
MakeBlur(style, sigma, respectCTM) {
|
18
|
-
return new _JsiSkMaskFilter.JsiSkMaskFilter(this.CanvasKit, this.CanvasKit.MaskFilter.MakeBlur((0, _Host.
|
18
|
+
return new _JsiSkMaskFilter.JsiSkMaskFilter(this.CanvasKit, this.CanvasKit.MaskFilter.MakeBlur((0, _Host.getEnum)(this.CanvasKit.BlurStyle, style), sigma, respectCTM));
|
19
19
|
}
|
20
20
|
|
21
21
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkMaskFilterFactory","Host","constructor","CanvasKit","MakeBlur","style","sigma","respectCTM","JsiSkMaskFilter","MaskFilter","
|
1
|
+
{"version":3,"names":["JsiSkMaskFilterFactory","Host","constructor","CanvasKit","MakeBlur","style","sigma","respectCTM","JsiSkMaskFilter","MaskFilter","getEnum","BlurStyle"],"sources":["JsiSkMaskFilterFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { BlurStyle } from \"../types\";\nimport type { MaskFilterFactory } from \"../types/MaskFilter\";\n\nimport { Host, getEnum } from \"./Host\";\nimport { JsiSkMaskFilter } from \"./JsiSkMaskFilter\";\n\nexport class JsiSkMaskFilterFactory extends Host implements MaskFilterFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeBlur(style: BlurStyle, sigma: number, respectCTM: boolean) {\n return new JsiSkMaskFilter(\n this.CanvasKit,\n this.CanvasKit.MaskFilter.MakeBlur(\n getEnum(this.CanvasKit.BlurStyle, style),\n sigma,\n respectCTM\n )\n );\n }\n}\n"],"mappings":";;;;;;;AAKA;;AACA;;AAEO,MAAMA,sBAAN,SAAqCC,UAArC,CAAuE;EAC5EC,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,QAAQ,CAACC,KAAD,EAAmBC,KAAnB,EAAkCC,UAAlC,EAAuD;IAC7D,OAAO,IAAIC,gCAAJ,CACL,KAAKL,SADA,EAEL,KAAKA,SAAL,CAAeM,UAAf,CAA0BL,QAA1B,CACE,IAAAM,aAAA,EAAQ,KAAKP,SAAL,CAAeQ,SAAvB,EAAkCN,KAAlC,CADF,EAEEC,KAFF,EAGEC,UAHF,CAFK,CAAP;EAQD;;AAd2E"}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import type { CanvasKit, Matrix3x3 } from "canvaskit-wasm";
|
2
|
-
import type { SkMatrix } from "../types";
|
2
|
+
import type { SkMatrix, InputMatrix } from "../types";
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkMatrix extends HostObject<Matrix3x3, "Matrix"> implements SkMatrix {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: Matrix3x3);
|
6
6
|
private preMultiply;
|
7
7
|
private postMultiply;
|
8
8
|
dispose: () => void;
|
9
|
-
concat(matrix:
|
9
|
+
concat(matrix: InputMatrix): this;
|
10
10
|
translate(x: number, y: number): this;
|
11
11
|
postTranslate(x: number, y: number): this;
|
12
12
|
scale(x: number, y?: number): this;
|
@@ -5,10 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.JsiSkMatrix = void 0;
|
7
7
|
|
8
|
+
var _types = require("../types");
|
9
|
+
|
8
10
|
var _Host = require("./Host");
|
9
11
|
|
10
12
|
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; }
|
11
13
|
|
14
|
+
const isMatrixHostObject = obj => !Array.isArray(obj);
|
15
|
+
|
12
16
|
class JsiSkMatrix extends _Host.HostObject {
|
13
17
|
constructor(CanvasKit, ref) {
|
14
18
|
super(CanvasKit, ref, "Matrix");
|
@@ -26,7 +30,8 @@ class JsiSkMatrix extends _Host.HostObject {
|
|
26
30
|
}
|
27
31
|
|
28
32
|
concat(matrix) {
|
29
|
-
this.preMultiply(
|
33
|
+
this.preMultiply( // eslint-disable-next-line no-nested-ternary
|
34
|
+
isMatrixHostObject(matrix) ? JsiSkMatrix.fromValue(matrix) : matrix.length === 16 ? (0, _types.toMatrix3)(matrix) : [...matrix]);
|
30
35
|
return this;
|
31
36
|
}
|
32
37
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkMatrix","HostObject","constructor","CanvasKit","ref","preMultiply","matrix","set","Matrix","multiply","postMultiply","concat","
|
1
|
+
{"version":3,"names":["isMatrixHostObject","obj","Array","isArray","JsiSkMatrix","HostObject","constructor","CanvasKit","ref","preMultiply","matrix","set","Matrix","multiply","postMultiply","concat","fromValue","length","toMatrix3","translate","x","y","translated","postTranslate","scale","scaled","postScale","skew","skewed","postSkew","rotate","value","rotated","postRotate","identity","get","from"],"sources":["JsiSkMatrix.ts"],"sourcesContent":["import type { CanvasKit, Matrix3x3 } from \"canvaskit-wasm\";\n\nimport { toMatrix3 } from \"../types\";\nimport type { SkMatrix, InputMatrix, Matrix4 } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nconst isMatrixHostObject = (obj: InputMatrix): obj is SkMatrix =>\n !Array.isArray(obj);\n\nexport class JsiSkMatrix\n extends HostObject<Matrix3x3, \"Matrix\">\n implements SkMatrix\n{\n constructor(CanvasKit: CanvasKit, ref: Matrix3x3) {\n super(CanvasKit, ref, \"Matrix\");\n }\n\n private preMultiply(matrix: number[]) {\n this.ref.set(this.CanvasKit.Matrix.multiply(this.ref, matrix));\n }\n\n private postMultiply(matrix: number[]) {\n this.ref.set(this.CanvasKit.Matrix.multiply(matrix, this.ref));\n }\n\n dispose = () => {\n // Do nothing - the matrix is represenetd by a Float32Array\n };\n\n concat(matrix: InputMatrix) {\n this.preMultiply(\n // eslint-disable-next-line no-nested-ternary\n isMatrixHostObject(matrix)\n ? JsiSkMatrix.fromValue(matrix)\n : matrix.length === 16\n ? toMatrix3(matrix as Matrix4)\n : [...matrix]\n );\n return this;\n }\n\n translate(x: number, y: number) {\n this.preMultiply(this.CanvasKit.Matrix.translated(x, y));\n return this;\n }\n\n postTranslate(x: number, y: number) {\n this.postMultiply(this.CanvasKit.Matrix.translated(x, y));\n return this;\n }\n\n scale(x: number, y?: number) {\n this.preMultiply(this.CanvasKit.Matrix.scaled(x, y ?? x));\n return this;\n }\n\n postScale(x: number, y?: number) {\n this.postMultiply(this.CanvasKit.Matrix.scaled(x, y ?? x));\n return this;\n }\n\n skew(x: number, y: number) {\n this.preMultiply(this.CanvasKit.Matrix.skewed(x, y));\n return this;\n }\n\n postSkew(x: number, y: number) {\n this.postMultiply(this.CanvasKit.Matrix.skewed(x, y));\n return this;\n }\n\n rotate(value: number) {\n this.preMultiply(this.CanvasKit.Matrix.rotated(value));\n return this;\n }\n\n postRotate(value: number) {\n this.postMultiply(this.CanvasKit.Matrix.rotated(value));\n return this;\n }\n\n identity() {\n this.ref.set(this.CanvasKit.Matrix.identity());\n return this;\n }\n\n get() {\n return Array.from(this.ref);\n }\n}\n"],"mappings":";;;;;;;AAEA;;AAGA;;;;AAEA,MAAMA,kBAAkB,GAAIC,GAAD,IACzB,CAACC,KAAK,CAACC,OAAN,CAAcF,GAAd,CADH;;AAGO,MAAMG,WAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAuC;IAChD,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;;IADgD,iCAYxC,MAAM,CACd;IACD,CAdiD;EAEjD;;EAEOC,WAAW,CAACC,MAAD,EAAmB;IACpC,KAAKF,GAAL,CAASG,GAAT,CAAa,KAAKJ,SAAL,CAAeK,MAAf,CAAsBC,QAAtB,CAA+B,KAAKL,GAApC,EAAyCE,MAAzC,CAAb;EACD;;EAEOI,YAAY,CAACJ,MAAD,EAAmB;IACrC,KAAKF,GAAL,CAASG,GAAT,CAAa,KAAKJ,SAAL,CAAeK,MAAf,CAAsBC,QAAtB,CAA+BH,MAA/B,EAAuC,KAAKF,GAA5C,CAAb;EACD;;EAMDO,MAAM,CAACL,MAAD,EAAsB;IAC1B,KAAKD,WAAL,EACE;IACAT,kBAAkB,CAACU,MAAD,CAAlB,GACIN,WAAW,CAACY,SAAZ,CAAsBN,MAAtB,CADJ,GAEIA,MAAM,CAACO,MAAP,KAAkB,EAAlB,GACA,IAAAC,gBAAA,EAAUR,MAAV,CADA,GAEA,CAAC,GAAGA,MAAJ,CANN;IAQA,OAAO,IAAP;EACD;;EAEDS,SAAS,CAACC,C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AAU,CAACF,KAAD,EAAgB;IACxB,KAAKjB,YAAL,CAAkB,KAAKP,SAAL,CAAeK,MAAf,CAAsBoB,OAAtB,CAA8BD,KAA9B,CAAlB;IACA,OAAO,IAAP;EACD;;EAEDG,QAAQ,GAAG;IACT,KAAK1B,GAAL,CAASG,GAAT,CAAa,KAAKJ,SAAL,CAAeK,MAAf,CAAsBsB,QAAtB,EAAb;IACA,OAAO,IAAP;EACD;;EAEDC,GAAG,GAAG;IACJ,OAAOjC,KAAK,CAACkC,IAAN,CAAW,KAAK5B,GAAhB,CAAP;EACD;;AA5EH"}
|
@@ -73,7 +73,7 @@ class JsiSkPaint extends _Host.HostObject {
|
|
73
73
|
}
|
74
74
|
|
75
75
|
setBlendMode(blendMode) {
|
76
|
-
this.ref.setBlendMode((0, _Host.
|
76
|
+
this.ref.setBlendMode((0, _Host.getEnum)(this.CanvasKit.BlendMode, blendMode));
|
77
77
|
}
|
78
78
|
|
79
79
|
setColor(color) {
|
@@ -101,11 +101,11 @@ class JsiSkPaint extends _Host.HostObject {
|
|
101
101
|
}
|
102
102
|
|
103
103
|
setStrokeCap(cap) {
|
104
|
-
this.ref.setStrokeCap((0, _Host.
|
104
|
+
this.ref.setStrokeCap((0, _Host.getEnum)(this.CanvasKit.StrokeCap, cap));
|
105
105
|
}
|
106
106
|
|
107
107
|
setStrokeJoin(join) {
|
108
|
-
this.ref.setStrokeJoin((0, _Host.
|
108
|
+
this.ref.setStrokeJoin((0, _Host.getEnum)(this.CanvasKit.StrokeJoin, join));
|
109
109
|
}
|
110
110
|
|
111
111
|
setStrokeMiter(limit) {
|