@shopify/react-native-skia 1.3.5 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +14 -7
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +1 -2
- package/lib/commonjs/dom/nodes/Node.d.ts +2 -3
- package/lib/commonjs/dom/nodes/Node.js +1 -2
- package/lib/commonjs/dom/nodes/Node.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintNode.js +1 -1
- package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/BlendNode.js +1 -1
- package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js +1 -1
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js +1 -1
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/PathEffects.js +1 -1
- package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/Shaders.js +1 -1
- package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/commonjs/dom/types/Node.d.ts +1 -2
- package/lib/commonjs/dom/types/Node.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.d.ts +0 -9
- package/lib/commonjs/dom/types/NodeType.js +1 -11
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/external/reanimated/useVideo.js +0 -2
- package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
- package/lib/commonjs/external/reanimated/useVideoLoading.js +7 -4
- package/lib/commonjs/external/reanimated/useVideoLoading.js.map +1 -1
- package/lib/commonjs/skia/core/SVG.web.d.ts +2 -0
- package/lib/commonjs/skia/core/SVG.web.js +22 -0
- package/lib/commonjs/skia/core/SVG.web.js.map +1 -0
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js +1 -1
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +3 -2
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSVG.d.ts +9 -0
- package/lib/commonjs/skia/web/JsiSkSVG.js +28 -0
- package/lib/commonjs/skia/web/JsiSkSVG.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkSVGFactory.d.ts +4 -3
- package/lib/commonjs/skia/web/JsiSkSVGFactory.js +40 -4
- package/lib/commonjs/skia/web/JsiSkSVGFactory.js.map +1 -1
- package/lib/module/dom/nodes/Node.d.ts +2 -3
- package/lib/module/dom/nodes/Node.js +1 -2
- package/lib/module/dom/nodes/Node.js.map +1 -1
- package/lib/module/dom/nodes/PaintNode.js +2 -2
- package/lib/module/dom/nodes/PaintNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Box.js +2 -2
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/module/dom/nodes/paint/BlendNode.js +2 -2
- package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/module/dom/nodes/paint/ColorFilters.js +2 -2
- package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/ImageFilters.js +2 -2
- package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/MaskFilters.js +2 -2
- package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/PathEffects.js +2 -2
- package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/module/dom/nodes/paint/Shaders.js +2 -2
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/module/dom/types/Node.d.ts +1 -2
- package/lib/module/dom/types/Node.js.map +1 -1
- package/lib/module/dom/types/NodeType.d.ts +0 -9
- package/lib/module/dom/types/NodeType.js +0 -10
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/external/reanimated/useVideo.js +0 -2
- package/lib/module/external/reanimated/useVideo.js.map +1 -1
- package/lib/module/external/reanimated/useVideoLoading.js +8 -5
- package/lib/module/external/reanimated/useVideoLoading.js.map +1 -1
- package/lib/module/skia/core/SVG.web.d.ts +2 -0
- package/lib/module/skia/core/SVG.web.js +15 -0
- package/lib/module/skia/core/SVG.web.js.map +1 -0
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js +1 -1
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +3 -2
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkSVG.d.ts +9 -0
- package/lib/module/skia/web/JsiSkSVG.js +21 -0
- package/lib/module/skia/web/JsiSkSVG.js.map +1 -0
- package/lib/module/skia/web/JsiSkSVGFactory.d.ts +4 -3
- package/lib/module/skia/web/JsiSkSVGFactory.js +41 -5
- package/lib/module/skia/web/JsiSkSVGFactory.js.map +1 -1
- package/lib/typescript/src/dom/nodes/Node.d.ts +2 -3
- package/lib/typescript/src/dom/types/Node.d.ts +1 -2
- package/lib/typescript/src/dom/types/NodeType.d.ts +0 -9
- package/lib/typescript/src/skia/core/SVG.web.d.ts +2 -0
- package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkSVG.d.ts +9 -0
- package/lib/typescript/src/skia/web/JsiSkSVGFactory.d.ts +4 -3
- package/package.json +2 -2
- package/src/dom/nodes/Node.ts +2 -12
- package/src/dom/nodes/PaintNode.ts +2 -2
- package/src/dom/nodes/drawings/Box.ts +2 -2
- package/src/dom/nodes/paint/BlendNode.ts +2 -2
- package/src/dom/nodes/paint/ColorFilters.ts +2 -2
- package/src/dom/nodes/paint/ImageFilters.ts +2 -2
- package/src/dom/nodes/paint/MaskFilters.ts +2 -2
- package/src/dom/nodes/paint/PathEffects.ts +2 -2
- package/src/dom/nodes/paint/Shaders.ts +2 -2
- package/src/dom/types/Node.ts +2 -2
- package/src/dom/types/NodeType.ts +0 -10
- package/src/external/reanimated/useVideo.ts +0 -2
- package/src/external/reanimated/useVideoLoading.ts +11 -7
- package/src/skia/core/SVG.web.ts +29 -0
- package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +1 -1
- package/src/skia/web/JsiSkCanvas.ts +6 -2
- package/src/skia/web/JsiSkSVG.ts +27 -0
- package/src/skia/web/JsiSkSVGFactory.ts +47 -6
@@ -13,6 +13,8 @@ public abstract class SkiaBaseView extends ReactViewGroup implements TextureView
|
|
13
13
|
|
14
14
|
private String tag = "SkiaView";
|
15
15
|
|
16
|
+
private boolean isDropped = false;
|
17
|
+
|
16
18
|
public SkiaBaseView(Context context) {
|
17
19
|
super(context);
|
18
20
|
mTexture = new TextureView(context);
|
@@ -21,11 +23,6 @@ public abstract class SkiaBaseView extends ReactViewGroup implements TextureView
|
|
21
23
|
addView(mTexture);
|
22
24
|
}
|
23
25
|
|
24
|
-
public void destroySurface() {
|
25
|
-
Log.i(tag, "destroySurface");
|
26
|
-
surfaceDestroyed();
|
27
|
-
}
|
28
|
-
|
29
26
|
private void createSurfaceTexture() {
|
30
27
|
// This API Level is >= 26, we created our own SurfaceTexture to have a faster time to first frame
|
31
28
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
@@ -36,6 +33,11 @@ public abstract class SkiaBaseView extends ReactViewGroup implements TextureView
|
|
36
33
|
}
|
37
34
|
}
|
38
35
|
|
36
|
+
void dropInstance() {
|
37
|
+
isDropped = true;
|
38
|
+
unregisterView();
|
39
|
+
}
|
40
|
+
|
39
41
|
@Override
|
40
42
|
protected void onAttachedToWindow() {
|
41
43
|
super.onAttachedToWindow();
|
@@ -129,6 +131,9 @@ public abstract class SkiaBaseView extends ReactViewGroup implements TextureView
|
|
129
131
|
|
130
132
|
@Override
|
131
133
|
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
|
134
|
+
if (isDropped) {
|
135
|
+
return;
|
136
|
+
}
|
132
137
|
Log.i(tag, "onSurfaceTextureSizeChanged " + width + "/" + height);
|
133
138
|
surfaceSizeChanged(width, height);
|
134
139
|
}
|
@@ -137,12 +142,14 @@ public abstract class SkiaBaseView extends ReactViewGroup implements TextureView
|
|
137
142
|
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
|
138
143
|
Log.i(tag, "onSurfaceTextureDestroyed");
|
139
144
|
// https://developer.android.com/reference/android/view/TextureView.SurfaceTextureListener#onSurfaceTextureDestroyed(android.graphics.SurfaceTexture)
|
140
|
-
|
145
|
+
surfaceDestroyed();
|
141
146
|
// Because of React Native Screens (which dettach the view), we always keep the surface alive.
|
142
147
|
// If not, Texture view will recreate the texture surface by itself and
|
143
148
|
// we will lose the fast first time to frame.
|
144
149
|
// We only delete the surface when the view is dropped (destroySurface invoked by SkiaBaseViewManager);
|
145
|
-
|
150
|
+
if (!isDropped) {
|
151
|
+
createSurfaceTexture();
|
152
|
+
}
|
146
153
|
return false;
|
147
154
|
}
|
148
155
|
|
@@ -29,7 +29,6 @@ public abstract class SkiaBaseViewManager<T extends SkiaBaseView> extends ReactV
|
|
29
29
|
@Override
|
30
30
|
public void onDropViewInstance(@NonNull ReactViewGroup view) {
|
31
31
|
super.onDropViewInstance(view);
|
32
|
-
((SkiaBaseView)view).
|
33
|
-
((SkiaBaseView)view).unregisterView();
|
32
|
+
((SkiaBaseView)view).dropInstance();
|
34
33
|
}
|
35
34
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Skia } from "../../skia/types";
|
2
|
-
import type { Node, DeclarationNode, NodeType
|
2
|
+
import type { Node, DeclarationNode, NodeType } from "../types";
|
3
3
|
import type { DeclarationContext } from "../types/DeclarationContext";
|
4
4
|
export interface NodeContext {
|
5
5
|
Skia: Skia;
|
@@ -21,9 +21,8 @@ export declare abstract class JsiNode<P> implements Node<P> {
|
|
21
21
|
}
|
22
22
|
export type Invalidate = () => void;
|
23
23
|
export declare abstract class JsiDeclarationNode<P> extends JsiNode<P> implements DeclarationNode<P> {
|
24
|
-
declarationType: DeclarationType;
|
25
24
|
private invalidate;
|
26
|
-
constructor(ctx: NodeContext,
|
25
|
+
constructor(ctx: NodeContext, type: NodeType, props: P);
|
27
26
|
abstract decorate(ctx: DeclarationContext): void;
|
28
27
|
protected decorateChildren(ctx: DeclarationContext): void;
|
29
28
|
addChild(child: Node<unknown>): void;
|
@@ -54,9 +54,8 @@ class JsiNode {
|
|
54
54
|
}
|
55
55
|
exports.JsiNode = JsiNode;
|
56
56
|
class JsiDeclarationNode extends JsiNode {
|
57
|
-
constructor(ctx,
|
57
|
+
constructor(ctx, type, props) {
|
58
58
|
super(ctx, type, props);
|
59
|
-
this.declarationType = declarationType;
|
60
59
|
_defineProperty(this, "invalidate", () => {});
|
61
60
|
}
|
62
61
|
decorateChildren(ctx) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiNode","constructor","ctx","type","props","_defineProperty","Skia","setProps","setProp","name","v","hasChanged","getProps","children","_children","addChild","child","removeChild","push","dispose","forEach","index","indexOf","node","splice","insertChildBefore","before","beforeIndex","exports","JsiDeclarationNode","
|
1
|
+
{"version":3,"names":["JsiNode","constructor","ctx","type","props","_defineProperty","Skia","setProps","setProp","name","v","hasChanged","getProps","children","_children","addChild","child","removeChild","push","dispose","forEach","index","indexOf","node","splice","insertChildBefore","before","beforeIndex","exports","JsiDeclarationNode","decorateChildren","decorate","Error","invalidate","setInvalidate"],"sources":["Node.ts"],"sourcesContent":["import type { Skia } from \"../../skia/types\";\nimport type { Node, DeclarationNode, NodeType } from \"../types\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nexport interface NodeContext {\n Skia: Skia;\n}\n\nexport abstract class JsiNode<P> implements Node<P> {\n protected _children: JsiNode<unknown>[] = [];\n protected Skia: Skia;\n\n constructor(ctx: NodeContext, public type: NodeType, protected props: P) {\n this.Skia = ctx.Skia;\n }\n\n setProps(props: P) {\n this.props = props;\n }\n\n setProp<K extends keyof P>(name: K, v: P[K]) {\n const hasChanged = this.props[name] !== v;\n this.props[name] = v;\n return hasChanged;\n }\n\n getProps() {\n return this.props;\n }\n\n children() {\n return this._children;\n }\n\n addChild(child: Node<unknown>) {\n this.removeChild(child);\n this._children.push(child as JsiNode<unknown>);\n }\n\n dispose() {\n this._children.forEach((child) => child.dispose());\n }\n\n removeChild(child: Node<unknown>) {\n const index = this._children.indexOf(child as JsiNode<unknown>);\n if (index !== -1) {\n const [node] = this._children.splice(index, 1);\n node.dispose();\n }\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n const index = this._children.indexOf(child as JsiNode<unknown>);\n if (index !== -1) {\n this._children.splice(index, 1);\n }\n const beforeIndex = this._children.indexOf(before as JsiNode<unknown>);\n this._children.splice(beforeIndex, 0, child as JsiNode<unknown>);\n }\n}\n\nexport type Invalidate = () => void;\n\nexport abstract class JsiDeclarationNode<P>\n extends JsiNode<P>\n implements DeclarationNode<P>\n{\n private invalidate: Invalidate = () => {};\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n }\n\n abstract decorate(ctx: DeclarationContext): void;\n\n protected decorateChildren(ctx: DeclarationContext) {\n this.children().forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n }\n\n addChild(child: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n this.invalidate();\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n this.invalidate();\n }\n\n dispose() {\n this.invalidate();\n super.dispose();\n }\n\n setInvalidate(invalidate: Invalidate) {\n this.invalidate = invalidate;\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.invalidate();\n }\n\n setProp<K extends keyof P>(name: K, v: P[K]) {\n const hasChanged = super.setProp(name, v);\n if (hasChanged) {\n this.invalidate();\n }\n return hasChanged;\n }\n}\n"],"mappings":";;;;;;;;;AAQO,MAAeA,OAAO,CAAuB;EAIlDC,WAAWA,CAACC,GAAgB,EAASC,IAAc,EAAYC,KAAQ,EAAE;IAAA,KAApCD,IAAc,GAAdA,IAAc;IAAA,KAAYC,KAAQ,GAARA,KAAQ;IAAAC,eAAA,oBAH7B,EAAE;IAAAA,eAAA;IAI1C,IAAI,CAACC,IAAI,GAAGJ,GAAG,CAACI,IAAI;EACtB;EAEAC,QAAQA,CAACH,KAAQ,EAAE;IACjB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB;EAEAI,OAAOA,CAAoBC,IAAO,EAAEC,CAAO,EAAE;IAC3C,MAAMC,UAAU,GAAG,IAAI,CAACP,KAAK,CAACK,IAAI,CAAC,KAAKC,CAAC;IACzC,IAAI,CAACN,KAAK,CAACK,IAAI,CAAC,GAAGC,CAAC;IACpB,OAAOC,UAAU;EACnB;EAEAC,QAAQA,CAAA,EAAG;IACT,OAAO,IAAI,CAACR,KAAK;EACnB;EAEAS,QAAQA,CAAA,EAAG;IACT,OAAO,IAAI,CAACC,SAAS;EACvB;EAEAC,QAAQA,CAACC,KAAoB,EAAE;IAC7B,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;IACvB,IAAI,CAACF,SAAS,CAACI,IAAI,CAACF,KAAyB,CAAC;EAChD;EAEAG,OAAOA,CAAA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,7 @@ var _datatypes = require("./datatypes");
|
|
10
10
|
var _Node = require("./Node");
|
11
11
|
class PaintNode extends _Node.JsiDeclarationNode {
|
12
12
|
constructor(ctx, props = {}) {
|
13
|
-
super(ctx, _types2.
|
13
|
+
super(ctx, _types2.NodeType.Paint, props);
|
14
14
|
}
|
15
15
|
decorate(ctx) {
|
16
16
|
const {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_types2","_datatypes","_Node","PaintNode","JsiDeclarationNode","constructor","ctx","props","
|
1
|
+
{"version":3,"names":["_types","require","_types2","_datatypes","_Node","PaintNode","JsiDeclarationNode","constructor","ctx","props","NodeType","Paint","decorate","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","dither","paint","Skia","undefined","setColor","Color","setStrokeWidth","setBlendMode","BlendMode","enumKey","setStyle","PaintStyle","setStrokeJoin","StrokeJoin","setStrokeCap","StrokeCap","setStrokeMiter","setAlphaf","setAntiAlias","setDither","save","_children","forEach","child","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","pop","maskFilter","maskFilters","pathEffect","pathEffects","restore","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","paints","push","exports"],"sources":["PaintNode.ts"],"sourcesContent":["import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from \"../../skia/types\";\nimport type { DeclarationNode, PaintProps } from \"../types\";\nimport { NodeType } from \"../types\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nimport { enumKey } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nexport class PaintNode\n extends JsiDeclarationNode<PaintProps>\n implements DeclarationNode<PaintProps>\n{\n constructor(ctx: NodeContext, props: PaintProps = {}) {\n super(ctx, NodeType.Paint, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n dither,\n } = this.props;\n const paint = this.Skia.Paint();\n if (color !== undefined) {\n paint.setColor(this.Skia.Color(color));\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (opacity !== undefined) {\n paint.setAlphaf(opacity);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (dither !== undefined) {\n paint.setDither(dither);\n }\n ctx.save();\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n const colorFilter = ctx.colorFilters.popAllAsOne();\n const imageFilter = ctx.imageFilters.popAllAsOne();\n const shader = ctx.shaders.pop();\n const maskFilter = ctx.maskFilters.pop();\n const pathEffect = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n if (imageFilter) {\n paint.setImageFilter(imageFilter);\n }\n if (shader) {\n paint.setShader(shader);\n }\n if (pathEffect) {\n paint.setPathEffect(pathEffect);\n }\n if (colorFilter) {\n paint.setColorFilter(colorFilter);\n }\n if (maskFilter) {\n paint.setMaskFilter(maskFilter);\n }\n ctx.paints.push(paint);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAGA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEO,MAAMI,SAAS,SACZC,wBAAkB,CAE5B;EACEC,WAAWA,CAACC,GAAgB,EAAEC,KAAiB,GAAG,CAAC,CAAC,EAAE;IACp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,IAAI,CAAC1C,KAAK,CAAC;EACxB;AACF;AAAC2C,OAAA,CAAA7D,SAAA,GAAAA,SAAA"}
|
@@ -12,7 +12,7 @@ const inflate = (Skia, box, dx, dy, tx = 0, ty = 0) => Skia.RRectXY(Skia.XYWHRec
|
|
12
12
|
const deflate = (Skia, box, dx, dy, tx = 0, ty = 0) => inflate(Skia, box, -dx, -dy, tx, ty);
|
13
13
|
class BoxShadowNode extends _Node.JsiDeclarationNode {
|
14
14
|
constructor(ctx, props) {
|
15
|
-
super(ctx, _types2.
|
15
|
+
super(ctx, _types2.NodeType.BoxShadow, props);
|
16
16
|
}
|
17
17
|
decorate(_ctx) {
|
18
18
|
// do nothing
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_types2","_Node","_RenderNode","inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","JsiDeclarationNode","constructor","ctx","props","
|
1
|
+
{"version":3,"names":["_types","require","_types2","_Node","_RenderNode","inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","JsiDeclarationNode","constructor","ctx","props","NodeType","BoxShadow","decorate","_ctx","materialize","exports","BoxNode","JsiRenderNode","Box","renderNode","canvas","paint","defaultBox","opacity","getAlphaf","isRRect","shadows","_children","map","node","filter","n","shadow","inner","color","blur","spread","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","ClipOp","Intersect","outer","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import type { SkRRect, Skia } from \"../../../skia/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { DrawingContext } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport type { BoxShadowProps, BoxProps } from \"../../types/Drawings\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { JsiRenderNode } from \"../RenderNode\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nconst inflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) =>\n Skia.RRectXY(\n Skia.XYWHRect(\n box.rect.x - dx + tx,\n box.rect.y - dy + ty,\n box.rect.width + 2 * dx,\n box.rect.height + 2 * dy\n ),\n box.rx + dx,\n box.ry + dy\n );\n\nconst deflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) => inflate(Skia, box, -dx, -dy, tx, ty);\n\nexport class BoxShadowNode extends JsiDeclarationNode<BoxShadowProps> {\n constructor(ctx: NodeContext, props: BoxShadowProps) {\n super(ctx, NodeType.BoxShadow, props);\n }\n\n decorate(_ctx: DeclarationContext) {\n // do nothing\n }\n\n materialize() {\n return this.props;\n }\n}\n\nexport class BoxNode extends JsiRenderNode<BoxProps> {\n constructor(ctx: NodeContext, props: BoxProps) {\n super(ctx, NodeType.Box, props);\n }\n\n renderNode({ canvas, paint }: DrawingContext) {\n const { box: defaultBox } = this.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox)\n ? defaultBox\n : this.Skia.RRectXY(defaultBox, 0, 0);\n const shadows = this._children\n .map((node) => {\n if (node instanceof BoxShadowNode) {\n return node.materialize();\n }\n return null;\n })\n .filter((n): n is BoxShadowProps => n !== null);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(\n inflate(this.Skia, box, spread, spread, dx, dy),\n lPaint\n );\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = this.Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(this.Skia, box, spread, spread, dx, dy);\n const outer = inflate(this.Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAGA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAGA,MAAMI,OAAO,GAAGA,CACdC,IAAU,EACVC,GAAY,EACZC,EAAU,EACVC,EAAU,EACVC,EAAE,GAAG,CAAC,EACNC,EAAE,GAAG,CAAC,KAENL,IAAI,CAACM,OAAO,CACVN,IAAI,CAACO,QAAQ,CACXN,GAAG,CAACO,IAAI,CAACC,CAAC,GAAGP,EAAE,GAAGE,EAAE,EACpBH,GAAG,CAACO,IAAI,CAACE,CAAC,GAAGP,EAAE,GAAGE,EAAE,EACpBJ,GAAG,CAACO,IAAI,CAACG,KAAK,GAAG,CAAC,GAAGT,EAAE,EACvBD,GAAG,CAACO,IAAI,CAACI,MAAM,GAAG,CAAC,GAAGT,EACxB,CAAC,EACDF,GAAG,CAACY,EAAE,GAAGX,EAAE,EACXD,GAAG,CAACa,EAAE,GAAGX,EACX,CAAC;AAEH,MAAMY,OAAO,GAAGA,CACdf,IAAU,EACVC,GAAY,EACZC,EAAU,EACVC,EAAU,EACVC,EAAE,GAAG,CAAC,EACNC,EAAE,GAAG,CAAC,KACHN,OAAO,C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C3D,EAAE,CAAC,CAAC;MACnE4B,MAAM,CAACgC,IAAI,CAAC,CAAC;MACbhC,MAAM,CAACiC,SAAS,CAAC/D,GAAG,EAAEgE,aAAM,CAACC,SAAS,EAAE,KAAK,CAAC;MAC9C,MAAMlB,MAAM,GAAG,IAAI,CAAChD,IAAI,CAACiD,KAAK,CAAC,CAAC;MAChCD,MAAM,CAACE,QAAQ,CAAC,IAAI,CAAClD,IAAI,CAACmD,KAAK,CAACN,KAAK,CAAC,CAAC;MACvCG,MAAM,CAACI,SAAS,CAACpB,KAAK,CAACG,SAAS,CAAC,CAAC,GAAGD,OAAO,CAAC;MAE7Cc,MAAM,CAACK,aAAa,CAClB,IAAI,CAACrD,IAAI,CAACsD,UAAU,CAACC,QAAQ,CAACC,gBAAS,CAACC,MAAM,EAAEX,IAAI,EAAE,IAAI,CAC5D,CAAC;MACD,MAAMF,KAAK,GAAG7B,OAAO,CAAC,IAAI,CAACf,IAAI,EAAEC,GAAG,EAAE8C,MAAM,EAAEA,MAAM,EAAE7C,EAAE,EAAEC,EAAE,CAAC;MAC7D,MAAMgE,KAAK,GAAGpE,OAAO,CAAC,IAAI,CAACC,IAAI,EAAEC,GAAG,EAAE0D,KAAK,CAAClD,CAAC,EAAEkD,KAAK,CAACjD,CAAC,CAAC;MACvDqB,MAAM,CAACqC,UAAU,CAACD,KAAK,EAAEvB,KAAK,EAAEI,MAAM,CAAC;MACvCjB,MAAM,CAACsC,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC;EACN;AACF;AAAC3C,OAAA,CAAAC,OAAA,GAAAA,OAAA"}
|
@@ -11,7 +11,7 @@ var _datatypes = require("../datatypes");
|
|
11
11
|
var _DeclarationContext = require("../../types/DeclarationContext");
|
12
12
|
class BlendNode extends _Node.JsiDeclarationNode {
|
13
13
|
constructor(ctx, props) {
|
14
|
-
super(ctx, _NodeType.
|
14
|
+
super(ctx, _NodeType.NodeType.Blend, props);
|
15
15
|
}
|
16
16
|
decorate(ctx) {
|
17
17
|
this.decorateChildren(ctx);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_NodeType","_Node","_datatypes","_DeclarationContext","BlendNode","JsiDeclarationNode","constructor","ctx","props","
|
1
|
+
{"version":3,"names":["_types","require","_NodeType","_Node","_datatypes","_DeclarationContext","BlendNode","JsiDeclarationNode","constructor","ctx","props","NodeType","Blend","decorate","decorateChildren","Skia","blend","BlendMode","enumKey","mode","imageFilters","popAll","length","composer","ImageFilter","MakeBlend","bind","push","composeDeclarations","shaders","Shader","exports"],"sources":["BlendNode.ts"],"sourcesContent":["import type { BlendProps } from \"../../types/ImageFilters\";\nimport { BlendMode } from \"../../../skia/types\";\nimport { NodeType } from \"../../types/NodeType\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nexport class BlendNode extends JsiDeclarationNode<BlendProps> {\n constructor(ctx: NodeContext, props: BlendProps) {\n super(ctx, NodeType.Blend, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { Skia } = this;\n const blend = BlendMode[enumKey(this.props.mode)];\n // Blend ImageFilters\n const imageFilters = ctx.imageFilters.popAll();\n if (imageFilters.length > 0) {\n const composer = Skia.ImageFilter.MakeBlend.bind(Skia.ImageFilter, blend);\n ctx.imageFilters.push(composeDeclarations(imageFilters, composer));\n }\n // Blend Shaders\n const shaders = ctx.shaders.popAll();\n if (shaders.length > 0) {\n const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);\n ctx.shaders.push(composeDeclarations(shaders, composer));\n }\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAAI,mBAAA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orFilterDeclaration extends _Node.JsiDeclarationNode {
|
12
12
|
constructor(ctx, type, props) {
|
13
|
-
super(ctx,
|
13
|
+
super(ctx, type, props);
|
14
14
|
}
|
15
15
|
composeAndPush(ctx, cf1) {
|
16
16
|
ctx.save();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_Node","_types2","_Enum","ColorFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","
|
1
|
+
{"version":3,"names":["_types","require","_Node","_types2","_Enum","ColorFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","composeAndPush","cf1","save","decorateChildren","cf2","colorFilters","popAllAsOne","restore","cf","Skia","ColorFilter","MakeCompose","push","exports","MatrixColorFilterNode","NodeType","MatrixColorFilter","decorate","matrix","MakeMatrix","BlendColorFilterNode","BlendColorFilter","mode","color","Color","MakeBlend","BlendMode","enumKey","LinearToSRGBGammaColorFilterNode","LinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","SRGBToLinearGammaColorFilterNode","SRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma","LumaColorFilterNode","LumaColorFilter","MakeLumaColorFilter","LerpColorFilterNode","LerpColorFilter","t","second","pop","first","Error","MakeLerp"],"sources":["ColorFilters.ts"],"sourcesContent":["import type { SkColorFilter } from \"../../../skia/types\";\nimport { BlendMode } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n BlendColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport type { LerpColorFilterProps } from \"../../types/ColorFilters\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport abstract class ColorFilterDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, cf1: SkColorFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n const cf2 = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n const cf = cf2 ? this.Skia.ColorFilter.MakeCompose(cf1, cf2) : cf1;\n ctx.colorFilters.push(cf);\n }\n}\n\nexport class MatrixColorFilterNode extends ColorFilterDeclaration<MatrixColorFilterProps> {\n constructor(ctx: NodeContext, props: MatrixColorFilterProps) {\n super(ctx, NodeType.MatrixColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const cf = this.Skia.ColorFilter.MakeMatrix(matrix);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilterProps> {\n constructor(ctx: NodeContext, props: BlendColorFilterProps) {\n super(ctx, NodeType.BlendColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const color = this.Skia.Color(this.props.color);\n const cf = this.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LinearToSRGBGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLinearToSRGBGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SRGBToLinearGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeSRGBToLinearGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LumaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LumaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLumaColorFilter();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LerpColorFilterNode extends ColorFilterDeclaration<LerpColorFilterProps> {\n constructor(ctx: NodeContext, props: LerpColorFilterProps) {\n super(ctx, NodeType.LerpColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n ctx.save();\n this.decorateChildren(ctx);\n const { t } = this.props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n ctx.restore();\n if (!first || !second) {\n throw new Error(\n \"LerpColorFilterNode: missing two color filters as children\"\n );\n }\n ctx.colorFilters.push(this.Skia.ColorFilter.MakeLerp(t, first, second));\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAIO,MAAeI,sBAAsB,SAAYC,wBAAkB,CAAI;EAC5EC,WAAWA,CAACC,GAAgB,EAAEC,IAAc,EAAEC,KAAQ,EAAE;IACtD,KAAK,CAACF,GAAG,EAAEC,IAAI,EAAEC,KAAK,CAAC;EACzB;EAEUC,cAAcA,CAACH,GAAuB,EAAEI,GAAkB,EAAE;IACpEJ,GAAG,CAACK,IAAI,CAAC,CAAC;IACV,IAAI,CAACC,gBAAgB,CAACN,GAAG,CAAC;IAC1B,MAAMO,GAAG,GAAGP,GAAG,CAACQ,YAAY,CAACC,WAAW,CAAC,CAAC;IAC1CT,GAAG,CAACU,OAAO,CAAC,CAAC;IACb,MAAMC,EAAE,GAAGJ,GAAG,GAAG,IAAI,CAACK,IAAI,CAACC,WAAW,CAACC,WAAW,CAACV,GAAG,EAAEG,GAAG,CAAC,GAAGH,GAAG;IAClEJ,GAAG,CAACQ,YAAY,CAACO,IAAI,CAACJ,EAAE,CAAC;EAC3B;AACF;AAACK,OAAA,CAAAnB,sBAAA,GAAAA,sBAAA;AAEM,MAAMoB,qBAAqB,SAASpB,sBAAsB,CAAyB;EACxFE,WAAWA,CAACC,GAAgB,EAAEE,KAA6B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AC;IAC1B,MAAM;MAAE0C;IAAE,CAAC,GAAG,IAAI,CAACxC,KAAK;IACxB,MAAMyC,MAAM,GAAG3C,GAAG,CAACQ,YAAY,CAACoC,GAAG,CAAC,CAAC;IACrC,MAAMC,KAAK,GAAG7C,GAAG,CAACQ,YAAY,CAACoC,GAAG,CAAC,CAAC;IACpC5C,GAAG,CAACU,OAAO,CAAC,CAAC;IACb,IAAI,CAACmC,KAAK,IAAI,CAACF,MAAM,EAAE;MACrB,MAAM,IAAIG,KAAK,CACb,4DACF,CAAC;IACH;IACA9C,GAAG,CAACQ,YAAY,CAACO,IAAI,CAAC,IAAI,CAACH,IAAI,CAACC,WAAW,CAACkC,QAAQ,CAACL,CAAC,EAAEG,KAAK,EAAEF,MAAM,CAAC,CAAC;EACzE;AACF;AAAC3B,OAAA,CAAAwB,mBAAA,GAAAA,mBAAA"}
|
@@ -23,7 +23,7 @@ const MakeInnerShadow = (Skia, shadowOnly, dx, dy, sigmaX, sigmaY, color, input)
|
|
23
23
|
};
|
24
24
|
class ImageFilterDeclaration extends _Node.JsiDeclarationNode {
|
25
25
|
constructor(ctx, type, props) {
|
26
|
-
super(ctx,
|
26
|
+
super(ctx, type, props);
|
27
27
|
}
|
28
28
|
input(ctx) {
|
29
29
|
var _ctx$imageFilters$pop;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_types2","_datatypes","_Node","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","BlendMode","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","TileMode","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","_ctx$imageFilters$pop","imageFilters","pop","composeAndPush","imgf1","save","decorateChildren","imgf2","popAllAsOne","cf","colorFilters","restore","_imgf","imgf","push","exports","OffsetImageFilterNode","NodeType","OffsetImageFilter","decorate","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","Error","map","MakeShader","MakeDisplacementMap","ColorChannel","enumKey","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","processRadius","DropShadowImageFilterNode","DropShadowImageFilter","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","processUniforms","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DeclarationContext,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processRadius, enumKey } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nexport abstract class ImageFilterDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n protected input(ctx: DeclarationContext) {\n return ctx.imageFilters.pop() ?? null;\n }\n\n protected composeAndPush(ctx: DeclarationContext, imgf1: SkImageFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n let imgf2 = ctx.imageFilters.popAllAsOne();\n const cf = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n if (cf) {\n imgf2 = this.Skia.ImageFilter.MakeCompose(\n imgf2 ?? null,\n this.Skia.ImageFilter.MakeColorFilter(cf, null)\n );\n }\n const imgf = imgf2\n ? this.Skia.ImageFilter.MakeCompose(imgf1, imgf2)\n : imgf1;\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { x, y } = this.props;\n const imgf = this.Skia.ImageFilter.MakeOffset(x, y, null);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { channelX, channelY, scale } = this.props;\n const shader = ctx.shaders.pop();\n if (!shader) {\n throw new Error(\"DisplacementMap expects a shader as child\");\n }\n const map = this.Skia.ImageFilter.MakeShader(shader, null);\n const imgf = this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n map,\n this.input(ctx)\n );\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n const imgf = this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.DropShadowImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n const imgf = factory(dx, dy, blur, blur, color, this.input(ctx));\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n let imgf;\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n imgf = this.Skia.ImageFilter.MakeErode(r.x, r.y, this.input(ctx));\n } else {\n imgf = this.Skia.ImageFilter.MakeDilate(r.x, r.y, this.input(ctx));\n }\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const a = ctx.imageFilters.pop();\n const b = ctx.imageFilters.pop();\n if (!a || !b) {\n throw new Error(\"BlendImageFilter requires two image filters\");\n }\n const imgf = this.Skia.ImageFilter.MakeBlend(mode, a, b);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const imgf = this.Skia.ImageFilter.MakeRuntimeShader(\n rtb,\n null,\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAgBA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,MAAMI,KAAK,GAAGC,YAAY,CAACC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEzC,MAAMC,eAAe,GAAGA,CACtBC,IAAU,EACVC,UAA+B,EAC/BC,EAAU,EACVC,EA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C,EAAEC,CAAC,CAAC;IACxD,IAAI,CAAC3D,cAAc,CAACP,GAAG,EAAEiB,IAAI,CAAC;EAChC;AACF;AAACE,OAAA,CAAA4C,oBAAA,GAAAA,oBAAA;AAEM,MAAMI,4BAA4B,SAAStE,sBAAsB,CAAgC;EACtGE,WAAWA,CAACC,GAAgB,EAAEE,KAAoC,EAAE;IAClE,KAAK,CAACF,GAAG,EAAEqB,gBAAQ,CAAC+C,wBAAwB,EAAElE,KAAK,CAAC;EACtD;EAEAqB,QAAQA,CAACvB,GAAuB,EAAE;IAChC,MAAM;MAAEqE,MAAM;MAAEC;IAAS,CAAC,GAAG,IAAI,CAACpE,KAAK;IACvC,MAAMqE,GAAG,GAAG,IAAI,CAACtG,IAAI,CAACuG,oBAAoB,CAACH,MAAM,CAAC;IAClD,IAAIC,QAAQ,EAAE;MACZ,IAAAG,sBAAe,EAACJ,MAAM,EAAEC,QAAQ,EAAEC,GAAG,CAAC;IACxC;IACA,MAAMtD,IAAI,GAAG,IAAI,CAAChD,IAAI,CAACS,WAAW,CAACgG,iBAAiB,CAClDH,GAAG,EACH,IAAI,EACJ,IAAI,CAAC/F,KAAK,CAACwB,GAAG,CAChB,CAAC;IACD,IAAI,CAACO,cAAc,CAACP,GAAG,EAAEiB,IAAI,CAAC;EAChC;AACF;AAACE,OAAA,CAAAgD,4BAAA,GAAAA,4BAAA"}
|
1
|
+
{"version":3,"names":["_types","require","_types2","_datatypes","_Node","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","BlendMode","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","TileMode","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","_ctx$imageFilters$pop","imageFilters","pop","composeAndPush","imgf1","save","decorateChildren","imgf2","popAllAsOne","cf","colorFilters","restore","_imgf","imgf","push","exports","OffsetImageFilterNode","NodeType","OffsetImageFilter","decorate","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","Error","map","MakeShader","MakeDisplacementMap","ColorChannel","enumKey","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","processRadius","DropShadowImageFilterNode","DropShadowImageFilter","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","processUniforms","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DeclarationContext,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { processRadius, enumKey } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nexport abstract class ImageFilterDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n }\n\n protected input(ctx: DeclarationContext) {\n return ctx.imageFilters.pop() ?? null;\n }\n\n protected composeAndPush(ctx: DeclarationContext, imgf1: SkImageFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n let imgf2 = ctx.imageFilters.popAllAsOne();\n const cf = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n if (cf) {\n imgf2 = this.Skia.ImageFilter.MakeCompose(\n imgf2 ?? null,\n this.Skia.ImageFilter.MakeColorFilter(cf, null)\n );\n }\n const imgf = imgf2\n ? this.Skia.ImageFilter.MakeCompose(imgf1, imgf2)\n : imgf1;\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { x, y } = this.props;\n const imgf = this.Skia.ImageFilter.MakeOffset(x, y, null);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { channelX, channelY, scale } = this.props;\n const shader = ctx.shaders.pop();\n if (!shader) {\n throw new Error(\"DisplacementMap expects a shader as child\");\n }\n const map = this.Skia.ImageFilter.MakeShader(shader, null);\n const imgf = this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n map,\n this.input(ctx)\n );\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n const imgf = this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.DropShadowImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n const imgf = factory(dx, dy, blur, blur, color, this.input(ctx));\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n let imgf;\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n imgf = this.Skia.ImageFilter.MakeErode(r.x, r.y, this.input(ctx));\n } else {\n imgf = this.Skia.ImageFilter.MakeDilate(r.x, r.y, this.input(ctx));\n }\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const a = ctx.imageFilters.pop();\n const b = ctx.imageFilters.pop();\n if (!a || !b) {\n throw new Error(\"BlendImageFilter requires two image filters\");\n }\n const imgf = this.Skia.ImageFilter.MakeBlend(mode, a, b);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const imgf = this.Skia.ImageFilter.MakeRuntimeShader(\n rtb,\n null,\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAgBA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,MAAMI,KAAK,GAAGC,YAAY,CAACC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEzC,MAAMC,eAAe,GAAGA,CACtBC,IAAU,EACVC,UAA+B,EAC/BC,EAAU,EACVC,EAAU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CAAC3D,cAAc,CAACN,GAAG,EAAEgB,IAAI,CAAC;EAChC;AACF;AAACE,OAAA,CAAA4C,oBAAA,GAAAA,oBAAA;AAEM,MAAMI,4BAA4B,SAASrE,sBAAsB,CAAgC;EACtGE,WAAWA,CAACC,GAAgB,EAAEE,KAAoC,EAAE;IAClE,KAAK,CAACF,GAAG,EAAEoB,gBAAQ,CAAC+C,wBAAwB,EAAEjE,KAAK,CAAC;EACtD;EAEAoB,QAAQA,CAACtB,GAAuB,EAAE;IAChC,MAAM;MAAEoE,MAAM;MAAEC;IAAS,CAAC,GAAG,IAAI,CAACnE,KAAK;IACvC,MAAMoE,GAAG,GAAG,IAAI,CAACrG,IAAI,CAACsG,oBAAoB,CAACH,MAAM,CAAC;IAClD,IAAIC,QAAQ,EAAE;MACZ,IAAAG,sBAAe,EAACJ,MAAM,EAAEC,QAAQ,EAAEC,GAAG,CAAC;IACxC;IACA,MAAMtD,IAAI,GAAG,IAAI,CAAC/C,IAAI,CAACS,WAAW,CAAC+F,iBAAiB,CAClDH,GAAG,EACH,IAAI,EACJ,IAAI,CAAC9F,KAAK,CAACwB,GAAG,CAChB,CAAC;IACD,IAAI,CAACM,cAAc,CAACN,GAAG,EAAEgB,IAAI,CAAC;EAChC;AACF;AAACE,OAAA,CAAAgD,4BAAA,GAAAA,4BAAA"}
|
@@ -10,7 +10,7 @@ var _types2 = require("../../types");
|
|
10
10
|
var _datatypes = require("../datatypes");
|
11
11
|
class BlurMaskFilterNode extends _Node.JsiDeclarationNode {
|
12
12
|
constructor(ctx, props) {
|
13
|
-
super(ctx, _types2.
|
13
|
+
super(ctx, _types2.NodeType.BlurMaskFilter, props);
|
14
14
|
}
|
15
15
|
decorate(ctx) {
|
16
16
|
const {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_Node","_types2","_datatypes","BlurMaskFilterNode","JsiDeclarationNode","constructor","ctx","props","
|
1
|
+
{"version":3,"names":["_types","require","_Node","_types2","_datatypes","BlurMaskFilterNode","JsiDeclarationNode","constructor","ctx","props","NodeType","BlurMaskFilter","decorate","style","blur","respectCTM","mf","Skia","MaskFilter","MakeBlur","BlurStyle","enumKey","maskFilters","push","exports"],"sources":["MaskFilters.ts"],"sourcesContent":["import { BlurStyle } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type { BlurMaskFilterProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport class BlurMaskFilterNode extends JsiDeclarationNode<BlurMaskFilterProps> {\n constructor(ctx: NodeContext, props: BlurMaskFilterProps) {\n super(ctx, NodeType.BlurMaskFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { style, blur, respectCTM } = this.props;\n const mf = this.Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n ctx.maskFilters.push(mf);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAGO,MAAMI,kBAAkB,SAASC,wBAAkB,CAAsB;EAC9EC,WAAWA,CAACC,GAAgB,EAAEC,KAA0B,EAAE;IACxD,KAAK,CAACD,GAAG,EAAEE,gBAAQ,CAACC,cAAc,EAAEF,KAAK,CAAC;EAC5C;EAEAG,QAAQA,CAACJ,GAAuB,EAAE;IAChC,MAAM;MAAEK,KAAK;MAAEC,IAAI;MAAEC;IAAW,CAAC,GAAG,IAAI,CAACN,KAAK;IAC9C,MAAMO,EAAE,GAAG,IAAI,CAACC,IAAI,CAACC,UAAU,CAACC,QAAQ,CACtCC,gBAAS,CAAC,IAAAC,kBAAO,EAACR,KAAK,CAAC,CAAC,EACzBC,IAAI,EACJC,UACF,CAAC;IACDP,GAAG,CAACc,WAAW,CAACC,IAAI,CAACP,EAAE,CAAC;EAC1B;AACF;AAACQ,OAAA,CAAAnB,kBAAA,GAAAA,kBAAA"}
|
@@ -12,7 +12,7 @@ var _datatypes = require("../datatypes");
|
|
12
12
|
var _DeclarationContext = require("../../types/DeclarationContext");
|
13
13
|
class PathEffectDeclaration extends _Node.JsiDeclarationNode {
|
14
14
|
constructor(ctx, type, props) {
|
15
|
-
super(ctx,
|
15
|
+
super(ctx, type, props);
|
16
16
|
}
|
17
17
|
composeAndPush(ctx, pe1) {
|
18
18
|
ctx.save();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_Node","_types2","_Enum","_datatypes","_DeclarationContext","PathEffectDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","PathEffect","composeAndPush","pe1","save","decorateChildren","pe2","pathEffects","popAllAsOne","restore","pe","Skia","MakeCompose","push","DiscretePathEffectNode","NodeType","DiscretePathEffect","decorate","length","deviation","seed","MakeDiscrete","exports","Path2DPathEffectNode","Path2DPathEffect","matrix","path","processPath","MakePath2D","Error","DashPathEffectNode","DashPathEffect","intervals","phase","MakeDash","CornerPathEffectNode","CornerPathEffect","r","MakeCorner","SumPathEffectNode","SumPathEffect","pes","popAll","composeDeclarations","MakeSum","bind","Line2DPathEffectNode","Line2DPathEffect","width","MakeLine2D","Path1DPathEffectNode","Path1DPathEffect","advance","style","MakePath1D","Path1DEffectStyle","enumKey"],"sources":["PathEffects.ts"],"sourcesContent":["import { Path1DEffectStyle } from \"../../../skia/types\";\nimport type { SkPathEffect } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport { processPath } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nabstract class PathEffectDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.PathEffect, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, pe1: SkPathEffect) {\n ctx.save();\n this.decorateChildren(ctx);\n const pe2 = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n const pe = pe2 ? this.Skia.PathEffect.MakeCompose(pe1, pe2) : pe1;\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class DiscretePathEffectNode extends PathEffectDeclaration<DiscretePathEffectProps> {\n constructor(ctx: NodeContext, props: DiscretePathEffectProps) {\n super(ctx, NodeType.DiscretePathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { length, deviation, seed } = this.props;\n const pe = this.Skia.PathEffect.MakeDiscrete(length, deviation, seed);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path2DPathEffectNode extends PathEffectDeclaration<Path2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path2DPathEffectProps) {\n super(ctx, NodeType.Path2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath2D(matrix, path);\n if (pe === null) {\n throw new Error(\"Path2DPathEffectNode: invalid path\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class DashPathEffectNode extends PathEffectDeclaration<DashPathEffectProps> {\n constructor(ctx: NodeContext, props: DashPathEffectProps) {\n super(ctx, NodeType.DashPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { intervals, phase } = this.props;\n const pe = this.Skia.PathEffect.MakeDash(intervals, phase);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class CornerPathEffectNode extends PathEffectDeclaration<CornerPathEffectProps> {\n constructor(ctx: NodeContext, props: CornerPathEffectProps) {\n super(ctx, NodeType.CornerPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { r } = this.props;\n const pe = this.Skia.PathEffect.MakeCorner(r);\n if (pe === null) {\n throw new Error(\"CornerPathEffectNode: couldn't create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class SumPathEffectNode extends PathEffectDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SumPathEffect, null);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const pes = ctx.pathEffects.popAll();\n const pe = composeDeclarations(\n pes,\n this.Skia.PathEffect.MakeSum.bind(this.Skia.PathEffect)\n );\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class Line2DPathEffectNode extends PathEffectDeclaration<Line2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Line2DPathEffectProps) {\n super(ctx, NodeType.Line2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { width, matrix } = this.props;\n const pe = this.Skia.PathEffect.MakeLine2D(width, matrix);\n if (pe === null) {\n throw new Error(\"Line2DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path1DPathEffectNode extends PathEffectDeclaration<Path1DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path1DPathEffectProps) {\n super(ctx, NodeType.Path1DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { advance, phase, style } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath1D(\n path,\n advance,\n phase,\n Path1DEffectStyle[enumKey(style)]\n );\n if (pe === null) {\n throw new Error(\"Path1DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AASA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IA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3,"names":["_types","require","_Node","_types2","_Enum","_datatypes","_DeclarationContext","PathEffectDeclaration","JsiDeclarationNode","constructor","ctx","type","props","composeAndPush","pe1","save","decorateChildren","pe2","pathEffects","popAllAsOne","restore","pe","Skia","PathEffect","MakeCompose","push","DiscretePathEffectNode","NodeType","DiscretePathEffect","decorate","length","deviation","seed","MakeDiscrete","exports","Path2DPathEffectNode","Path2DPathEffect","matrix","path","processPath","MakePath2D","Error","DashPathEffectNode","DashPathEffect","intervals","phase","MakeDash","CornerPathEffectNode","CornerPathEffect","r","MakeCorner","SumPathEffectNode","SumPathEffect","pes","popAll","composeDeclarations","MakeSum","bind","Line2DPathEffectNode","Line2DPathEffect","width","MakeLine2D","Path1DPathEffectNode","Path1DPathEffect","advance","style","MakePath1D","Path1DEffectStyle","enumKey"],"sources":["PathEffects.ts"],"sourcesContent":["import { Path1DEffectStyle } from \"../../../skia/types\";\nimport type { SkPathEffect } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport { processPath } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nabstract class PathEffectDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, pe1: SkPathEffect) {\n ctx.save();\n this.decorateChildren(ctx);\n const pe2 = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n const pe = pe2 ? this.Skia.PathEffect.MakeCompose(pe1, pe2) : pe1;\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class DiscretePathEffectNode extends PathEffectDeclaration<DiscretePathEffectProps> {\n constructor(ctx: NodeContext, props: DiscretePathEffectProps) {\n super(ctx, NodeType.DiscretePathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { length, deviation, seed } = this.props;\n const pe = this.Skia.PathEffect.MakeDiscrete(length, deviation, seed);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path2DPathEffectNode extends PathEffectDeclaration<Path2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path2DPathEffectProps) {\n super(ctx, NodeType.Path2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath2D(matrix, path);\n if (pe === null) {\n throw new Error(\"Path2DPathEffectNode: invalid path\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class DashPathEffectNode extends PathEffectDeclaration<DashPathEffectProps> {\n constructor(ctx: NodeContext, props: DashPathEffectProps) {\n super(ctx, NodeType.DashPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { intervals, phase } = this.props;\n const pe = this.Skia.PathEffect.MakeDash(intervals, phase);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class CornerPathEffectNode extends PathEffectDeclaration<CornerPathEffectProps> {\n constructor(ctx: NodeContext, props: CornerPathEffectProps) {\n super(ctx, NodeType.CornerPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { r } = this.props;\n const pe = this.Skia.PathEffect.MakeCorner(r);\n if (pe === null) {\n throw new Error(\"CornerPathEffectNode: couldn't create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class SumPathEffectNode extends PathEffectDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SumPathEffect, null);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const pes = ctx.pathEffects.popAll();\n const pe = composeDeclarations(\n pes,\n this.Skia.PathEffect.MakeSum.bind(this.Skia.PathEffect)\n );\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class Line2DPathEffectNode extends PathEffectDeclaration<Line2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Line2DPathEffectProps) {\n super(ctx, NodeType.Line2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { width, matrix } = this.props;\n const pe = this.Skia.PathEffect.MakeLine2D(width, matrix);\n if (pe === null) {\n throw new Error(\"Line2DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path1DPathEffectNode extends PathEffectDeclaration<Path1DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path1DPathEffectProps) {\n super(ctx, NodeType.Path1DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { advance, phase, style } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath1D(\n path,\n advance,\n phase,\n Path1DEffectStyle[enumKey(style)]\n );\n if (pe === null) {\n throw new Error(\"Path1DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AASA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,mBAAA,GAAAL,OAAA;AAEA,MAAeM,qBAAqB,SAAYC,wBAAkB,CAAI;EACpEC,WAAWA,CAACC,GAAgB,EAAEC,IAAc,EAAEC,KAAQ,EAAE;IACtD,KAAK,CAACF,GAAG,EAAEC,IAAI,EAAEC,KAAK,CAAC;EACzB;EAEUC,cAAcA,CAACH,GAAuB,EAAEI,GAAiB,EAAE;IACnEJ,GAAG,CAACK,IAAI,CAAC,CAAC;IACV,IAAI,CAACC,gBAAgB,CAACN,GAAG,CAAC;IAC1B,MAAMO,GAAG,GAAGP,GAAG,CAACQ,WAAW,CAACC,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,MAAMI,oBAAoB,SAASvD,qBAAqB,CAAwB;EACrFE,WAAWA,CAACC,GAAgB,EAAEE,KAA4B,EAAE;IAC1D,KAAK,CAACF,GAAG,EAAEiB,gBAAQ,CAACoC,gBAAgB,EAAEnD,KAAK,CAAC;EAC9C;EAEAiB,QAAQA,CAACnB,GAAuB,EAAE;IAChC,MAAM;MAAEsD,OAAO;MAAEnB,KAAK;MAAEoB;IAAM,CAAC,GAAG,IAAI,CAACrD,KAAK;IAC5C,MAAM0B,IAAI,GAAG,IAAAC,sBAAW,EAAC,IAAI,CAACjB,IAAI,EAAE,IAAI,CAACV,KAAK,CAAC0B,IAAI,CAAC;IACpD,MAAMjB,EAAE,GAAG,IAAI,CAACC,IAAI,CAACC,UAAU,CAAC2C,UAAU,CACxC5B,IAAI,EACJ0B,OAAO,EACPnB,KAAK,EACLsB,wBAAiB,CAAC,IAAAC,aAAO,EAACH,KAAK,CAAC,CAClC,CAAC;IACD,IAAI5C,EAAE,KAAK,IAAI,EAAE;MACf,MAAM,IAAIoB,KAAK,CAAC,oDAAoD,CAAC;IACvE;IACA,IAAI,CAAC5B,cAAc,CAACH,GAAG,EAAEW,EAAE,CAAC;EAC9B;AACF;AAACa,OAAA,CAAA4B,oBAAA,GAAAA,oBAAA"}
|
@@ -10,7 +10,7 @@ var _types2 = require("../../types");
|
|
10
10
|
var _datatypes = require("../datatypes");
|
11
11
|
class ShaderDeclaration extends _Node.JsiDeclarationNode {
|
12
12
|
constructor(ctx, type, props) {
|
13
|
-
super(ctx,
|
13
|
+
super(ctx, type, props);
|
14
14
|
}
|
15
15
|
}
|
16
16
|
exports.ShaderDeclaration = ShaderDeclaration;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_Node","_types2","_datatypes","ShaderDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","Shader","exports","ShaderNode","NodeType","decorate","decorateChildren","source","uniforms","transform","m3","Skia","Matrix","processTransformProps","shader","makeShaderWithChildren","processUniforms","shaders","popAll","push","ImageShaderNode","ImageShader","fit","image","tx","ty","fm","mm","imageShaderProps","rct","getRect","rects","fitRects","x","y","width","height","sx","sy","rect2rect","src","dst","translate","translateX","translateY","scale","scaleX","scaleY","lm","concat","makeShaderOptions","TileMode","enumKey","FilterMode","MipmapMode","ColorNode","ColorShader","color","MakeColor","Color","TurbulenceNode","Turbulence","freqX","freqY","octaves","seed","tileWidth","tileHeight","MakeTurbulence","FractalNoiseNode","FractalNoise","MakeFractalNoise","LinearGradientNode","LinearGradient","start","end","colors","positions","mode","localMatrix","flags","processGradientProps","MakeLinearGradient","RadialGradientNode","RadialGradient","c","r","MakeRadialGradient","SweepGradientNode","SweepGradient","MakeSweepGradient","TwoPointConicalGradientNode","TwoPointConicalGradient","startR","endR","MakeTwoPointConicalGradient"],"sources":["Shaders.ts"],"sourcesContent":["import {\n processUniforms,\n FilterMode,\n MipmapMode,\n TileMode,\n} from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n ColorProps,\n DeclarationContext,\n FractalNoiseProps,\n ImageShaderProps,\n LinearGradientProps,\n RadialGradientProps,\n ShaderProps,\n SweepGradientProps,\n TurbulenceProps,\n TwoPointConicalGradientProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport {\n enumKey,\n fitRects,\n getRect,\n processGradientProps,\n processTransformProps,\n rect2rect,\n} from \"../datatypes\";\n\nexport abstract class ShaderDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.Shader, type, props);\n }\n}\n\nexport class ShaderNode extends ShaderDeclaration<ShaderProps> {\n constructor(ctx: NodeContext, props: ShaderProps) {\n super(ctx, NodeType.Shader, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { source, uniforms, ...transform } = this.props;\n const m3 = this.Skia.Matrix();\n processTransformProps(m3, transform);\n const shader = source.makeShaderWithChildren(\n processUniforms(source, uniforms),\n ctx.shaders.popAll(),\n m3\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class ImageShaderNode extends ShaderDeclaration<ImageShaderProps> {\n constructor(ctx: NodeContext, props: ImageShaderProps) {\n super(ctx, NodeType.ImageShader, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { fit, image, tx, ty, fm, mm, ...imageShaderProps } = this.props;\n if (!image) {\n return;\n }\n\n const rct = getRect(this.Skia, imageShaderProps);\n const m3 = this.Skia.Matrix();\n if (rct) {\n const rects = fitRects(\n fit,\n { x: 0, y: 0, width: image.width(), height: image.height() },\n rct\n );\n const [x, y, sx, sy] = rect2rect(rects.src, rects.dst);\n m3.translate(x.translateX, y.translateY);\n m3.scale(sx.scaleX, sy.scaleY);\n }\n const lm = this.Skia.Matrix();\n lm.concat(m3);\n processTransformProps(lm, imageShaderProps);\n const shader = image.makeShaderOptions(\n TileMode[enumKey(tx)],\n TileMode[enumKey(ty)],\n FilterMode[enumKey(fm)],\n MipmapMode[enumKey(mm)],\n lm\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class ColorNode extends ShaderDeclaration<ColorProps> {\n constructor(ctx: NodeContext, props: ColorProps) {\n super(ctx, NodeType.ColorShader, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { color } = this.props;\n const shader = this.Skia.Shader.MakeColor(this.Skia.Color(color));\n ctx.shaders.push(shader);\n }\n}\n\nexport class TurbulenceNode extends ShaderDeclaration<TurbulenceProps> {\n constructor(ctx: NodeContext, props: TurbulenceProps) {\n super(ctx, NodeType.Turbulence, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n const shader = this.Skia.Shader.MakeTurbulence(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class FractalNoiseNode extends ShaderDeclaration<FractalNoiseProps> {\n constructor(ctx: NodeContext, props: FractalNoiseProps) {\n super(ctx, NodeType.FractalNoise, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n const shader = this.Skia.Shader.MakeFractalNoise(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class LinearGradientNode extends ShaderDeclaration<LinearGradientProps> {\n constructor(ctx: NodeContext, props: LinearGradientProps) {\n super(ctx, NodeType.LinearGradient, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n const shader = this.Skia.Shader.MakeLinearGradient(\n start,\n end,\n colors,\n positions ?? null,\n mode,\n localMatrix,\n flags\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class RadialGradientNode extends ShaderDeclaration<RadialGradientProps> {\n constructor(ctx: NodeContext, props: RadialGradientProps) {\n super(ctx, NodeType.RadialGradient, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { c, r } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n const shader = this.Skia.Shader.MakeRadialGradient(\n c,\n r,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class SweepGradientNode extends ShaderDeclaration<SweepGradientProps> {\n constructor(ctx: NodeContext, props: SweepGradientProps) {\n super(ctx, NodeType.SweepGradient, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { c, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n const shader = this.Skia.Shader.MakeSweepGradient(\n c.x,\n c.y,\n colors,\n positions,\n mode,\n localMatrix,\n flags,\n start,\n end\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class TwoPointConicalGradientNode extends ShaderDeclaration<TwoPointConicalGradientProps> {\n constructor(ctx: NodeContext, props: TwoPointConicalGradientProps) {\n super(ctx, NodeType.TwoPointConicalGradient, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { startR, endR, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n const shader = this.Skia.Shader.MakeTwoPointConicalGradient(\n start,\n startR,\n end,\n endR,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n ctx.shaders.push(shader);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AAaA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AASO,MAAeI,iBAAiB,SAAYC,wBAAkB,CAAI;EACvEC,WAAWA,CAACC,GAAgB,EAAEC,IAAc,EAAEC,KAAQ,EAAE;IACtD,KAAK,CAACF,GAAG,EAAEG,uBAAe,CAACC,MAAM,EAAEH,IAAI,EAAEC,KAAK,CAAC;EACjD;AACF;AAACG,OAAA,CAAAR,iBAAA,GAAAA,iBAAA;AAEM,MAAMS,UAAU,SAAST,iBAAiB,CAAc;EAC7DE,WAAWA,CAACC,GAAgB,EAAEE,KAAkB,EAAE;IAChD,KAAK,CAACF,GAAG,EAAEO,gBAAQ,CAACH,MAAM,EAAEF,KAAK,CAAC;EACpC;EAEAM,QAAQA,CAACR,GAAuB,EAAE;IAChC,IAAI,CAACS,gBAAgB,CAACT,GAAG,CAAC;IAC1B,MAAM;MAAEU,MAAM;MAAEC,QAAQ;MAAE,GAAGC;IAAU,CAAC,GAAG,IAAI,CAACV,KAAK;IACrD,MAAMW,EAAE,GAAG,IAAI,CAACC,IAAI,CAACC,MAAM,CAAC,CAAC;IAC7B,IAAAC,gCAAqB,EAACH,EAAE,EAAED,SAAS,CAAC;IACpC,MAAMK,MAAM,GAAGP,MAAM,CAACQ,sBAAsB,CAC1C,IAAAC,sBAAe,EAACT,MAAM,EAAEC,QAAQ,CAAC,EACjCX,GAAG,CAACoB,OAA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AAEC,SAAS;MAAEC,IAAI;MAAEC,WAAW;MAAEC;IAAM,CAAC,GACnD,IAAAC,+BAAoB,EAAC,IAAI,CAACtE,IAAI,EAAE,IAAI,CAACZ,KAAK,CAAC;IAC7C,MAAMe,MAAM,GAAG,IAAI,CAACH,IAAI,CAACV,MAAM,CAAC8F,2BAA2B,CACzDrB,KAAK,EACLmB,MAAM,EACNlB,GAAG,EACHmB,IAAI,EACJlB,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,WAAW,EACXC,KACF,CAAC;IACDnF,GAAG,CAACoB,OAAO,CAACE,IAAI,CAACL,MAAM,CAAC;EAC1B;AACF;AAACZ,OAAA,CAAAyF,2BAAA,GAAAA,2BAAA"}
|
1
|
+
{"version":3,"names":["_types","require","_Node","_types2","_datatypes","ShaderDeclaration","JsiDeclarationNode","constructor","ctx","type","props","exports","ShaderNode","NodeType","Shader","decorate","decorateChildren","source","uniforms","transform","m3","Skia","Matrix","processTransformProps","shader","makeShaderWithChildren","processUniforms","shaders","popAll","push","ImageShaderNode","ImageShader","fit","image","tx","ty","fm","mm","imageShaderProps","rct","getRect","rects","fitRects","x","y","width","height","sx","sy","rect2rect","src","dst","translate","translateX","translateY","scale","scaleX","scaleY","lm","concat","makeShaderOptions","TileMode","enumKey","FilterMode","MipmapMode","ColorNode","ColorShader","color","MakeColor","Color","TurbulenceNode","Turbulence","freqX","freqY","octaves","seed","tileWidth","tileHeight","MakeTurbulence","FractalNoiseNode","FractalNoise","MakeFractalNoise","LinearGradientNode","LinearGradient","start","end","colors","positions","mode","localMatrix","flags","processGradientProps","MakeLinearGradient","RadialGradientNode","RadialGradient","c","r","MakeRadialGradient","SweepGradientNode","SweepGradient","MakeSweepGradient","TwoPointConicalGradientNode","TwoPointConicalGradient","startR","endR","MakeTwoPointConicalGradient"],"sources":["Shaders.ts"],"sourcesContent":["import {\n processUniforms,\n FilterMode,\n MipmapMode,\n TileMode,\n} from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n ColorProps,\n DeclarationContext,\n FractalNoiseProps,\n ImageShaderProps,\n LinearGradientProps,\n RadialGradientProps,\n ShaderProps,\n SweepGradientProps,\n TurbulenceProps,\n TwoPointConicalGradientProps,\n} from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport {\n enumKey,\n fitRects,\n getRect,\n processGradientProps,\n processTransformProps,\n rect2rect,\n} from \"../datatypes\";\n\nexport abstract class ShaderDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n }\n}\n\nexport class ShaderNode extends ShaderDeclaration<ShaderProps> {\n constructor(ctx: NodeContext, props: ShaderProps) {\n super(ctx, NodeType.Shader, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { source, uniforms, ...transform } = this.props;\n const m3 = this.Skia.Matrix();\n processTransformProps(m3, transform);\n const shader = source.makeShaderWithChildren(\n processUniforms(source, uniforms),\n ctx.shaders.popAll(),\n m3\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class ImageShaderNode extends ShaderDeclaration<ImageShaderProps> {\n constructor(ctx: NodeContext, props: ImageShaderProps) {\n super(ctx, NodeType.ImageShader, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { fit, image, tx, ty, fm, mm, ...imageShaderProps } = this.props;\n if (!image) {\n return;\n }\n\n const rct = getRect(this.Skia, imageShaderProps);\n const m3 = this.Skia.Matrix();\n if (rct) {\n const rects = fitRects(\n fit,\n { x: 0, y: 0, width: image.width(), height: image.height() },\n rct\n );\n const [x, y, sx, sy] = rect2rect(rects.src, rects.dst);\n m3.translate(x.translateX, y.translateY);\n m3.scale(sx.scaleX, sy.scaleY);\n }\n const lm = this.Skia.Matrix();\n lm.concat(m3);\n processTransformProps(lm, imageShaderProps);\n const shader = image.makeShaderOptions(\n TileMode[enumKey(tx)],\n TileMode[enumKey(ty)],\n FilterMode[enumKey(fm)],\n MipmapMode[enumKey(mm)],\n lm\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class ColorNode extends ShaderDeclaration<ColorProps> {\n constructor(ctx: NodeContext, props: ColorProps) {\n super(ctx, NodeType.ColorShader, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { color } = this.props;\n const shader = this.Skia.Shader.MakeColor(this.Skia.Color(color));\n ctx.shaders.push(shader);\n }\n}\n\nexport class TurbulenceNode extends ShaderDeclaration<TurbulenceProps> {\n constructor(ctx: NodeContext, props: TurbulenceProps) {\n super(ctx, NodeType.Turbulence, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n const shader = this.Skia.Shader.MakeTurbulence(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class FractalNoiseNode extends ShaderDeclaration<FractalNoiseProps> {\n constructor(ctx: NodeContext, props: FractalNoiseProps) {\n super(ctx, NodeType.FractalNoise, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n const shader = this.Skia.Shader.MakeFractalNoise(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class LinearGradientNode extends ShaderDeclaration<LinearGradientProps> {\n constructor(ctx: NodeContext, props: LinearGradientProps) {\n super(ctx, NodeType.LinearGradient, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n const shader = this.Skia.Shader.MakeLinearGradient(\n start,\n end,\n colors,\n positions ?? null,\n mode,\n localMatrix,\n flags\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class RadialGradientNode extends ShaderDeclaration<RadialGradientProps> {\n constructor(ctx: NodeContext, props: RadialGradientProps) {\n super(ctx, NodeType.RadialGradient, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { c, r } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n const shader = this.Skia.Shader.MakeRadialGradient(\n c,\n r,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class SweepGradientNode extends ShaderDeclaration<SweepGradientProps> {\n constructor(ctx: NodeContext, props: SweepGradientProps) {\n super(ctx, NodeType.SweepGradient, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { c, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n const shader = this.Skia.Shader.MakeSweepGradient(\n c.x,\n c.y,\n colors,\n positions,\n mode,\n localMatrix,\n flags,\n start,\n end\n );\n ctx.shaders.push(shader);\n }\n}\n\nexport class TwoPointConicalGradientNode extends ShaderDeclaration<TwoPointConicalGradientProps> {\n constructor(ctx: NodeContext, props: TwoPointConicalGradientProps) {\n super(ctx, NodeType.TwoPointConicalGradient, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { startR, endR, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n const shader = this.Skia.Shader.MakeTwoPointConicalGradient(\n start,\n startR,\n end,\n endR,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n ctx.shaders.push(shader);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AAaA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AASO,MAAeI,iBAAiB,SAAYC,wBAAkB,CAAI;EACvEC,WAAWA,CAACC,GAAgB,EAAEC,IAAc,EAAEC,KAAQ,EAAE;IACtD,KAAK,CAACF,GAAG,EAAEC,IAAI,EAAEC,KAAK,CAAC;EACzB;AACF;AAACC,OAAA,CAAAN,iBAAA,GAAAA,iBAAA;AAEM,MAAM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