@shopify/react-native-skia 0.1.132 → 0.1.133
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +5 -0
- package/cpp/api/JsiSkImage.h +2 -19
- package/cpp/api/JsiSkPaint.h +5 -32
- package/cpp/api/JsiSkPath.h +4 -4
- package/lib/commonjs/skia/types/Image/Image.js +5 -5
- package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
- package/lib/commonjs/skia/types/Paint/Paint.js +3 -3
- package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.js +0 -1
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/types/Shader/Shader.js +1 -7
- package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFontMgr.js +0 -2
- package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +10 -6
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/{JsiImageFilterFactory.js → JsiSkImageFilterFactory.js} +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +65 -52
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +23 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +2 -2
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/views/SkiaView.web.js +4 -4
- package/lib/commonjs/views/SkiaView.web.js.map +1 -1
- package/lib/commonjs/web/index.js +4 -2
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/module/skia/types/Image/Image.js +5 -5
- package/lib/module/skia/types/Image/Image.js.map +1 -1
- package/lib/module/skia/types/Paint/Paint.js +3 -3
- package/lib/module/skia/types/Paint/Paint.js.map +1 -1
- package/lib/module/skia/types/Path/Path.js +0 -1
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/types/Shader/Shader.js +1 -7
- package/lib/module/skia/types/Shader/Shader.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkFontMgr.js +0 -2
- package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +10 -7
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/{JsiImageFilterFactory.js → JsiSkImageFilterFactory.js} +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -0
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +65 -52
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js +24 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +1 -1
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/views/SkiaView.web.js +4 -4
- package/lib/module/views/SkiaView.web.js.map +1 -1
- package/lib/module/web/index.js +3 -1
- package/lib/module/web/index.js.map +1 -1
- package/lib/typescript/src/skia/types/Image/Image.d.ts +5 -5
- package/lib/typescript/src/skia/types/Paint/Paint.d.ts +3 -3
- package/lib/typescript/src/skia/types/Path/Path.d.ts +1 -2
- package/lib/typescript/src/skia/types/RuntimeEffect/RuntimeEffect.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkImage.d.ts +3 -3
- package/lib/typescript/src/skia/web/{JsiImageFilterFactory.d.ts → JsiSkImageFilterFactory.d.ts} +0 -0
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -1
- package/package.json +1 -1
- package/src/skia/types/Image/Image.ts +4 -4
- package/src/skia/types/Paint/Paint.ts +1 -1
- package/src/skia/types/Path/Path.ts +0 -1
- package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +1 -0
- package/src/skia/types/Shader/Shader.ts +3 -5
- package/src/skia/web/JsiSkCanvas.ts +2 -2
- package/src/skia/web/JsiSkFontMgr.ts +0 -4
- package/src/skia/web/JsiSkImage.ts +37 -16
- package/src/skia/web/{JsiImageFilterFactory.ts → JsiSkImageFilterFactory.ts} +0 -0
- package/src/skia/web/JsiSkPaint.ts +1 -1
- package/src/skia/web/JsiSkPath.ts +64 -47
- package/src/skia/web/JsiSkShaderFactory.ts +4 -1
- package/src/skia/web/JsiSkVerticesFactory.ts +15 -1
- package/src/skia/web/JsiSkia.ts +1 -1
- package/src/views/SkiaView.web.tsx +9 -11
- package/src/web/index.ts +3 -1
- package/lib/commonjs/skia/web/JsiImageFilterFactory.js.map +0 -1
- package/lib/module/skia/web/JsiImageFilterFactory.js.map +0 -1
@@ -17,6 +17,29 @@ import { ckEnum, HostObject, optEnum, toValue } from "./Host";
|
|
17
17
|
import { JsiSkPoint } from "./JsiSkPoint";
|
18
18
|
import { JsiSkRect } from "./JsiSkRect";
|
19
19
|
|
20
|
+
const CommandCount = {
|
21
|
+
[PathVerb.Move]: 3,
|
22
|
+
[PathVerb.Line]: 3,
|
23
|
+
[PathVerb.Quad]: 5,
|
24
|
+
[PathVerb.Conic]: 6,
|
25
|
+
[PathVerb.Cubic]: 7,
|
26
|
+
[PathVerb.Close]: 1,
|
27
|
+
};
|
28
|
+
|
29
|
+
const areCmdsInterpolatable = (cmd1: PathCommand[], cmd2: PathCommand[]) => {
|
30
|
+
if (cmd1.length !== cmd2.length) {
|
31
|
+
return false;
|
32
|
+
}
|
33
|
+
for (let i = 0; i < cmd1.length; i++) {
|
34
|
+
if (cmd1[i][0] !== cmd2[i][0]) {
|
35
|
+
return false;
|
36
|
+
} else if (cmd1[i][0] === PathVerb.Conic && cmd1[i][5] !== cmd2[i][5]) {
|
37
|
+
return false;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
return true;
|
41
|
+
};
|
42
|
+
|
20
43
|
export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
21
44
|
constructor(CanvasKit: CanvasKit, ref: Path) {
|
22
45
|
super(CanvasKit, ref, "Path");
|
@@ -300,20 +323,25 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
300
323
|
// throw new NotImplementedOnRNWeb();
|
301
324
|
const cmd1 = this.toCmds();
|
302
325
|
const cmd2 = end.toCmds();
|
303
|
-
if (cmd1
|
326
|
+
if (!areCmdsInterpolatable(cmd1, cmd2)) {
|
304
327
|
return null;
|
305
328
|
}
|
306
329
|
const interpolated: PathCommand[] = [];
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
330
|
+
cmd1.forEach((cmd, i) => {
|
331
|
+
const interpolatedCmd = [cmd[0]];
|
332
|
+
interpolated.push(interpolatedCmd);
|
333
|
+
cmd.forEach((c, j) => {
|
334
|
+
if (j === 0) {
|
335
|
+
return;
|
336
|
+
}
|
337
|
+
if (interpolatedCmd[0] === PathVerb.Conic && j === 5) {
|
338
|
+
interpolatedCmd.push(c);
|
339
|
+
} else {
|
340
|
+
const c2 = cmd2[i][j];
|
341
|
+
interpolatedCmd.push(c2 + (c - c2) * t);
|
342
|
+
}
|
343
|
+
});
|
344
|
+
});
|
317
345
|
const path = this.CanvasKit.Path.MakeFromCmds(interpolated.flat());
|
318
346
|
if (path === null) {
|
319
347
|
return null;
|
@@ -326,44 +354,33 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
326
354
|
// throw new NotImplementedOnRNWeb();
|
327
355
|
const cmd1 = this.toCmds();
|
328
356
|
const cmd2 = path2.toCmds();
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
return true;
|
338
|
-
}
|
339
|
-
|
340
|
-
toCmds(): PathCommand[] {
|
341
|
-
const cmds: PathCommand[] = [];
|
342
|
-
let cmd = [];
|
343
|
-
const flatCmds = this.ref.toCmds();
|
344
|
-
const CmdCount = {
|
345
|
-
[PathVerb.Move]: 3,
|
346
|
-
[PathVerb.Line]: 3,
|
347
|
-
[PathVerb.Quad]: 5,
|
348
|
-
[PathVerb.Conic]: 6,
|
349
|
-
[PathVerb.Cubic]: 7,
|
350
|
-
[PathVerb.Close]: 0,
|
351
|
-
[PathVerb.Done]: 0,
|
352
|
-
};
|
353
|
-
for (let i = 0; i < flatCmds.length; i++) {
|
354
|
-
if (cmd.length === 0 && flatCmds[i] === PathVerb.Done) {
|
355
|
-
break;
|
357
|
+
return areCmdsInterpolatable(cmd1, cmd2);
|
358
|
+
}
|
359
|
+
|
360
|
+
toCmds() {
|
361
|
+
const cmds = this.ref.toCmds();
|
362
|
+
const result = cmds.reduce<PathCommand[]>((acc, cmd, i) => {
|
363
|
+
if (i === 0) {
|
364
|
+
acc.push([]);
|
356
365
|
}
|
357
|
-
const
|
358
|
-
|
359
|
-
|
360
|
-
const length =
|
361
|
-
if (
|
362
|
-
|
363
|
-
|
366
|
+
const current = acc[acc.length - 1];
|
367
|
+
if (current.length === 0) {
|
368
|
+
current.push(cmd);
|
369
|
+
const length = CommandCount[current[0] as PathVerb];
|
370
|
+
if (current.length === length && i !== cmds.length - 1) {
|
371
|
+
acc.push([]);
|
372
|
+
}
|
373
|
+
} else {
|
374
|
+
const length = CommandCount[current[0] as PathVerb];
|
375
|
+
if (current.length < length) {
|
376
|
+
current.push(cmd);
|
377
|
+
}
|
378
|
+
if (current.length === length && i !== cmds.length - 1) {
|
379
|
+
acc.push([]);
|
364
380
|
}
|
365
381
|
}
|
366
|
-
|
367
|
-
|
382
|
+
return acc;
|
383
|
+
}, []);
|
384
|
+
return result;
|
368
385
|
}
|
369
386
|
}
|
@@ -172,7 +172,10 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
|
|
172
172
|
MakeColor(color: SkColor) {
|
173
173
|
return new JsiSkShader(
|
174
174
|
this.CanvasKit,
|
175
|
-
this.CanvasKit.Shader.MakeColor(
|
175
|
+
this.CanvasKit.Shader.MakeColor(
|
176
|
+
toValue(color),
|
177
|
+
this.CanvasKit.ColorSpace.SRGB
|
178
|
+
)
|
176
179
|
);
|
177
180
|
}
|
178
181
|
}
|
@@ -5,6 +5,20 @@ import type { SkColor, SkPoint, VertexMode } from "../types";
|
|
5
5
|
import { ckEnum } from "./Host";
|
6
6
|
import { JsiSkVertices } from "./JsiSkVertices";
|
7
7
|
|
8
|
+
const concat = (...arrays: Float32Array[]) => {
|
9
|
+
let totalLength = 0;
|
10
|
+
for (const arr of arrays) {
|
11
|
+
totalLength += arr.length;
|
12
|
+
}
|
13
|
+
const result = new Float32Array(totalLength);
|
14
|
+
let offset = 0;
|
15
|
+
for (const arr of arrays) {
|
16
|
+
result.set(arr, offset);
|
17
|
+
offset += arr.length;
|
18
|
+
}
|
19
|
+
return result;
|
20
|
+
};
|
21
|
+
|
8
22
|
export const MakeVertices = (
|
9
23
|
CanvasKit: CanvasKit,
|
10
24
|
mode: VertexMode,
|
@@ -20,7 +34,7 @@ export const MakeVertices = (
|
|
20
34
|
ckEnum(mode),
|
21
35
|
positions.map(({ x, y }) => [x, y]).flat(),
|
22
36
|
(textureCoordinates || []).map(({ x, y }) => [x, y]).flat(),
|
23
|
-
colors,
|
37
|
+
!colors ? null : colors.reduce((a, c) => concat(a, c)),
|
24
38
|
indices,
|
25
39
|
isVolatile
|
26
40
|
)
|
package/src/skia/web/JsiSkia.ts
CHANGED
@@ -27,7 +27,7 @@ import { JsiSkColorFilterFactory } from "./JsiSkColorFilterFactory";
|
|
27
27
|
import { JsiSkTypefaceFactory } from "./JsiSkTypefaceFactory";
|
28
28
|
import { JsiSkMaskFilterFactory } from "./JsiSkMaskFilterFactory";
|
29
29
|
import { JsiSkRuntimeEffectFactory } from "./JsiSkRuntimeEffectFactory";
|
30
|
-
import { JsiSkImageFilterFactory } from "./
|
30
|
+
import { JsiSkImageFilterFactory } from "./JsiSkImageFilterFactory";
|
31
31
|
import { JsiSkShaderFactory } from "./JsiSkShaderFactory";
|
32
32
|
import { JsiSkPathEffectFactory } from "./JsiSkPathEffectFactory";
|
33
33
|
import { JsiSkDataFactory } from "./JsiSkDataFactory";
|
@@ -175,17 +175,15 @@ export class SkiaView extends React.Component<
|
|
175
175
|
const { mode, debug = false, ...viewProps } = this.props;
|
176
176
|
return (
|
177
177
|
<View {...viewProps} onLayout={this.onLayout.bind(this)}>
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
/>
|
188
|
-
) : null}
|
178
|
+
<canvas
|
179
|
+
ref={this._canvasRef}
|
180
|
+
width={this.state.width}
|
181
|
+
height={this.state.height}
|
182
|
+
onPointerDown={this.handleTouchStart.bind(this)}
|
183
|
+
onPointerMove={this.handleTouchMove.bind(this)}
|
184
|
+
onPointerUp={this.handleTouchEnd.bind(this)}
|
185
|
+
onPointerCancel={this.handleTouchCancel.bind(this)}
|
186
|
+
/>
|
189
187
|
</View>
|
190
188
|
);
|
191
189
|
}
|
package/src/web/index.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
2
|
+
// @ts-expect-error
|
3
|
+
import CanvasKitInit from "canvaskit-wasm/bin/full/canvaskit";
|
2
4
|
import type { CanvasKit as CanvasKitType } from "canvaskit-wasm";
|
3
5
|
|
4
6
|
declare global {
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["JsiImageFilterFactory.ts"],"names":["JsiSkImageFilterFactory","Host","constructor","CanvasKit","MakeOffset","_dx","_dy","_input","NotImplementedOnRNWeb","MakeDisplacementMap","_channelX","_channelY","_scale","_in1","MakeShader","_shader","MakeBlur","sigmaX","sigmaY","mode","input","JsiSkImageFilter","ImageFilter","MakeColorFilter","cf","MakeCompose","outer","inner","MakeDropShadow","_sigmaX","_sigmaY","_color","_cropRect","MakeDropShadowOnly","MakeErode","_rx","_ry","MakeDilate","MakeBlend","_mode","_background","_foreground","MakeRuntimeShader","_builder","_childShaderName"],"mappings":";;;;;;;AAeA;;AACA;;AAEO,MAAMA,uBAAN,SACGC,UADH,CAGP;AACEC,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,UAAU,CACRC,GADQ,EAERC,GAFQ,EAGRC,MAHQ,EAIO;AACf,UAAM,IAAIC,2BAAJ,EAAN;AACD;;AAEDC,EAAAA,mBAAmB,CACjBC,SADiB,EAEjBC,SAFiB,EAGjBC,MAHiB,EAIjBC,IAJiB,EAKjBN,MALiB,EAMF;AACf,UAAM,IAAIC,2BAAJ,EAAN;AACD;;AAEDM,EAAAA,UAAU,CAACC,OAAD,EAAoBR,MAApB,EAAiE;AACzE,UAAM,IAAIC,2BAAJ,EAAN;AACD;;AAEDQ,EAAAA,QAAQ,CACNC,MADM,EAENC,MAFM,EAGNC,IAHM,EAINC,KAJM,EAKN;AACA,WAAO,IAAIC,kCAAJ,CACL,KAAKlB,SADA,EAEL,KAAKA,SAAL,CAAemB,WAAf,CAA2BN,QAA3B,CACEC,MADF,EAEEC,MAFF,EAGE,kBAAOC,IAAP,CAHF,EAIEC,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwB,mBAAQA,KAAR,CAJ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T,SAJO,EAKQ;AACf,UAAM,IAAIxB,2BAAJ,EAAN;AACD;;AAEDkC,EAAAA,iBAAiB,CACfC,QADe,EAEfC,gBAFe,EAGfrC,MAHe,EAIA;AACf,UAAM,IAAIC,2BAAJ,EAAN;AACD;;AAzHH","sourcesContent":["import type { CanvasKit } 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, toValue } from \"./Host\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\n\nexport class JsiSkImageFilterFactory\n extends Host\n implements ImageFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeOffset(\n _dx: number,\n _dy: number,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeDisplacementMap(\n _channelX: ColorChannel,\n _channelY: ColorChannel,\n _scale: number,\n _in1: SkImageFilter,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeShader(_shader: SkShader, _input: SkImageFilter | null): SkImageFilter {\n throw new NotImplementedOnRNWeb();\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 : toValue(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 toValue(cf),\n input === null ? null : toValue(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 : toValue(outer),\n inner === null ? null : toValue(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 throw new NotImplementedOnRNWeb();\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 throw new NotImplementedOnRNWeb();\n }\n\n MakeErode(\n _rx: number,\n _ry: number,\n _input: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeDilate(\n _rx: number,\n _ry: number,\n _input: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeBlend(\n _mode: BlendMode,\n _background: SkImageFilter,\n _foreground: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeRuntimeShader(\n _builder: SkRuntimeShaderBuilder,\n _childShaderName: string | null,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["JsiImageFilterFactory.ts"],"names":["Host","NotImplementedOnRNWeb","ckEnum","toValue","JsiSkImageFilter","JsiSkImageFilterFactory","constructor","CanvasKit","MakeOffset","_dx","_dy","_input","MakeDisplacementMap","_channelX","_channelY","_scale","_in1","MakeShader","_shader","MakeBlur","sigmaX","sigmaY","mode","input","ImageFilter","MakeColorFilter","cf","MakeCompose","outer","inner","MakeDropShadow","_sigmaX","_sigmaY","_color","_cropRect","MakeDropShadowOnly","MakeErode","_rx","_ry","MakeDilate","MakeBlend","_mode","_background","_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A8BC,KAA9B,EAA2D;AACpE,WAAO,IAAIzB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeiB,WAAf,CAA2BG,WAA3B,CACEC,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwBzB,OAAO,CAACyB,KAAD,CADjC,EAEEC,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwB1B,OAAO,CAAC0B,KAAD,CAFjC,CAFK,CAAP;AAOD;;AAEDC,EAAAA,cAAc,CACZrB,GADY,EAEZC,GAFY,EAGZqB,OAHY,EAIZC,OAJY,EAKZC,MALY,EAMZtB,MANY,EAOZuB,SAPY,EAQG;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAEDkC,EAAAA,kBAAkB,CAChB1B,GADgB,EAEhBC,GAFgB,EAGhBqB,OAHgB,EAIhBC,OAJgB,EAKhBC,MALgB,EAMhBtB,MANgB,EAOhBuB,SAPgB,EAQD;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAEDmC,EAAAA,SAAS,CACPC,GADO,EAEPC,GAFO,EAGP3B,MAHO,EAIPuB,SAJO,EAKQ;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAEDsC,EAAAA,UAAU,CACRF,GADQ,EAERC,GAFQ,EAGR3B,MAHQ,EAIRuB,SAJQ,EAKO;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAEDuC,EAAAA,SAAS,CACPC,KADO,EAEPC,WAFO,EAGPC,WAHO,EAIPT,SAJO,EAKQ;AACf,UAAM,IAAIjC,qBAAJ,EAAN;AACD;;AAED2C,EAAAA,iBAAiB,CACfC,QADe,EAEfC,gBAFe,EAGfnC,MAHe,EAIA;AACf,UAAM,IAAIV,qBAAJ,EAAN;AACD;;AAzHH","sourcesContent":["import type { CanvasKit } 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, toValue } from \"./Host\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\n\nexport class JsiSkImageFilterFactory\n extends Host\n implements ImageFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeOffset(\n _dx: number,\n _dy: number,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeDisplacementMap(\n _channelX: ColorChannel,\n _channelY: ColorChannel,\n _scale: number,\n _in1: SkImageFilter,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeShader(_shader: SkShader, _input: SkImageFilter | null): SkImageFilter {\n throw new NotImplementedOnRNWeb();\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 : toValue(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 toValue(cf),\n input === null ? null : toValue(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 : toValue(outer),\n inner === null ? null : toValue(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 throw new NotImplementedOnRNWeb();\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 throw new NotImplementedOnRNWeb();\n }\n\n MakeErode(\n _rx: number,\n _ry: number,\n _input: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeDilate(\n _rx: number,\n _ry: number,\n _input: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeBlend(\n _mode: BlendMode,\n _background: SkImageFilter,\n _foreground: SkImageFilter | null,\n _cropRect?: SkRect\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeRuntimeShader(\n _builder: SkRuntimeShaderBuilder,\n _childShaderName: string | null,\n _input: SkImageFilter | null\n ): SkImageFilter {\n throw new NotImplementedOnRNWeb();\n }\n}\n"]}
|