@shopify/react-native-skia 1.3.6 → 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 +6 -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 +7 -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 -8
- 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
@@ -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","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","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":";;;AAQA,OAAO,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,EAAG;IACR,IAAI,CAACL,SAAS,CAACM,OAAO,CAAEJ,KAAK,IAAKA,KAAK,CAACG,OAAO,CAAC,CAAC,CAAC;EACpD;EAEAF,WAAWA,CAACD,KAAoB,EAAE;IAChC,MAAMK,KAAK,GAAG,IAAI,CAACP,SAAS,CAACQ,OAAO,CAACN,KAAyB,CAAC;IAC/D,IAAIK,KAAK,KAAK,CAAC,CAAC,EA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AC;IACrB,IAAI,CAACgB,UAAU,CAAC,CAAC;EACnB;EAEAP,iBAAiBA,CAACT,KAAoB,EAAEU,MAAqB,EAAQ;IACnE,IAAI,EAAEV,KAAK,YAAYY,kBAAkB,CAAC,EAAE;MAC1C,MAAM,IAAIG,KAAK,CAAE,4BAA2Bf,KAAK,CAACb,IAAK,OAAM,IAAI,CAACA,IAAK,EAAC,CAAC;IAC3E;IACA,KAAK,CAACsB,iBAAiB,CAACT,KAAK,EAAEU,MAAM,CAAC;IACtC,IAAI,CAACM,UAAU,CAAC,CAAC;EACnB;EAEAb,OAAOA,CAAA,EAAG;IACR,IAAI,CAACa,UAAU,CAAC,CAAC;IACjB,KAAK,CAACb,OAAO,CAAC,CAAC;EACjB;EAEAc,aAAaA,CAACD,UAAsB,EAAE;IACpC,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;EAEAzB,QAAQA,CAACH,KAAQ,EAAE;IACjB,KAAK,CAACG,QAAQ,CAACH,KAAK,CAAC;IACrB,IAAI,CAAC4B,UAAU,CAAC,CAAC;EACnB;EAEAxB,OAAOA,CAAoBC,IAAO,EAAEC,CAAO,EAAE;IAC3C,MAAMC,UAAU,GAAG,KAAK,CAACH,OAAO,CAACC,IAAI,EAAEC,CAAC,CAAC;IACzC,IAAIC,UAAU,EAAE;MACd,IAAI,CAACqB,UAAU,CAAC,CAAC;IACnB;IACA,OAAOrB,UAAU;EACnB;AACF"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from "../../skia/types";
|
2
|
-
import {
|
2
|
+
import { NodeType } from "../types";
|
3
3
|
import { enumKey } from "./datatypes";
|
4
4
|
import { JsiDeclarationNode } from "./Node";
|
5
5
|
export class PaintNode extends JsiDeclarationNode {
|
6
6
|
constructor(ctx, props = {}) {
|
7
|
-
super(ctx,
|
7
|
+
super(ctx, NodeType.Paint, props);
|
8
8
|
}
|
9
9
|
decorate(ctx) {
|
10
10
|
const {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["StrokeCap","StrokeJoin","PaintStyle","BlendMode","
|
1
|
+
{"version":3,"names":["StrokeCap","StrokeJoin","PaintStyle","BlendMode","NodeType","enumKey","JsiDeclarationNode","PaintNode","constructor","ctx","props","Paint","decorate","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","dither","paint","Skia","undefined","setColor","Color","setStrokeWidth","setBlendMode","setStyle","setStrokeJoin","setStrokeCap","setStrokeMiter","setAlphaf","setAntiAlias","setDither","save","_children","forEach","child","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","pop","maskFilter","maskFilters","pathEffect","pathEffects","restore","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","paints","push"],"sources":["PaintNode.ts"],"sourcesContent":["import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from \"../../skia/types\";\nimport type { DeclarationNode, PaintProps } from \"../types\";\nimport { 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,SAASA,SAAS,EAAEC,UAAU,EAAEC,UAAU,EAAEC,SAAS,QAAQ,kBAAkB;AAE/E,SAASC,QAAQ,QAAQ,UAAU;AAGnC,SAASC,OAAO,QAAQ,aAAa;AAErC,SAASC,kBAAkB,QAAQ,QAAQ;AAE3C,OAAO,MAAMC,SAAS,SACZD,kBAAkB,CAE5B;EACEE,WAAWA,CAACC,GAAgB,EAAEC,KAAiB,GAAG,CAAC,CAAC,EAAE;IACpD,KAAK,CAACD,GAAG,EAAEL,QAAQ,CAACO,KAAK,EAAED,KAAK,CAAC;EACnC;EAEAE,QAAQA,CAACH,GAAuB,EAAE;IAChC,MAAM;MACJI,KAAK;MACLC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,OAAO;MACPC,SAAS;MACTC;I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ACC,SAAS,CAACC,OAAO,CAAEC,KAAK,IAAK;MAChC,IAAIA,KAAK,YAAYlC,kBAAkB,EAAE;QACvCkC,KAAK,CAAC5B,QAAQ,CAACH,GAAG,CAAC;MACrB;IACF,CAAC,CAAC;IACF,MAAMgC,WAAW,GAAGhC,GAAG,CAACiC,YAAY,CAACC,WAAW,CAAC,CAAC;IAClD,MAAMC,WAAW,GAAGnC,GAAG,CAACoC,YAAY,CAACF,WAAW,CAAC,CAAC;IAClD,MAAMG,MAAM,GAAGrC,GAAG,CAACsC,OAAO,CAACC,GAAG,CAAC,CAAC;IAChC,MAAMC,UAAU,GAAGxC,GAAG,CAACyC,WAAW,CAACF,GAAG,CAAC,CAAC;IACxC,MAAMG,UAAU,GAAG1C,GAAG,CAAC2C,WAAW,CAACT,WAAW,CAAC,CAAC;IAChDlC,GAAG,CAAC4C,OAAO,CAAC,CAAC;IACb,IAAIT,WAAW,EAAE;MACfrB,KAAK,CAAC+B,cAAc,CAACV,WAAW,CAAC;IACnC;IACA,IAAIE,MAAM,EAAE;MACVvB,KAAK,CAACgC,SAAS,CAACT,MAAM,CAAC;IACzB;IACA,IAAIK,UAAU,EAAE;MACd5B,KAAK,CAACiC,aAAa,CAACL,UAAU,CAAC;IACjC;IACA,IAAIV,WAAW,EAAE;MACflB,KAAK,CAACkC,cAAc,CAAChB,WAAW,CAAC;IACnC;IACA,IAAIQ,UAAU,EAAE;MACd1B,KAAK,CAACmC,aAAa,CAACT,UAAU,CAAC;IACjC;IACAxC,GAAG,CAACkD,MAAM,CAACC,IAAI,CAACrC,KAAK,CAAC;EACxB;AACF"}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { BlurStyle, ClipOp, isRRect } from "../../../skia/types";
|
2
|
-
import {
|
2
|
+
import { NodeType } from "../../types";
|
3
3
|
import { JsiDeclarationNode } from "../Node";
|
4
4
|
import { JsiRenderNode } from "../RenderNode";
|
5
5
|
const inflate = (Skia, box, dx, dy, tx = 0, ty = 0) => Skia.RRectXY(Skia.XYWHRect(box.rect.x - dx + tx, box.rect.y - dy + ty, box.rect.width + 2 * dx, box.rect.height + 2 * dy), box.rx + dx, box.ry + dy);
|
6
6
|
const deflate = (Skia, box, dx, dy, tx = 0, ty = 0) => inflate(Skia, box, -dx, -dy, tx, ty);
|
7
7
|
export class BoxShadowNode extends JsiDeclarationNode {
|
8
8
|
constructor(ctx, props) {
|
9
|
-
super(ctx,
|
9
|
+
super(ctx, NodeType.BoxShadow, props);
|
10
10
|
}
|
11
11
|
decorate(_ctx) {
|
12
12
|
// do nothing
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlurStyle","ClipOp","isRRect","
|
1
|
+
{"version":3,"names":["BlurStyle","ClipOp","isRRect","NodeType","JsiDeclarationNode","JsiRenderNode","inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","constructor","ctx","props","BoxShadow","decorate","_ctx","materialize","BoxNode","Box","renderNode","canvas","paint","defaultBox","opacity","getAlphaf","shadows","_children","map","node","filter","n","shadow","inner","color","blur","spread","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","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,SAASA,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,qBAAqB;AAEhE,SAASC,QAAQ,QAAQ,aAAa;AAGtC,SAASC,kBAAkB,QAAQ,SAAS;AAC5C,SAASC,aAAa,QAAQ,eAAe;AAG7C,MAAMC,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,CAACC,IAAI,EAAEC,GAAG,EAAE,CAACC,EAAE,EAAE,CAACC,EAAE,EAAEC,EAAE,EAAEC,EAAE,CAAC;AAEzC,OAAO,MAAMW,aAAa,SAASnB,kBAAkB,CAAiB;EACpEoB,WAAWA,CAACC,GAAgB,EAAEC,KAAqB,E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AC,CAAC;MAChCD,MAAM,CAACE,QAAQ,CAAC,IAAI,CAAC7C,IAAI,CAAC8C,KAAK,CAACN,KAAK,CAAC,CAAC;MACvCG,MAAM,CAACI,SAAS,CAACnB,KAAK,CAACG,SAAS,CAAC,CAAC,GAAGD,OAAO,CAAC;MAE7Ca,MAAM,CAACK,aAAa,CAClB,IAAI,CAAChD,IAAI,CAACiD,UAAU,CAACC,QAAQ,CAACzD,SAAS,CAAC0D,MAAM,EAAEV,IAAI,EAAE,IAAI,CAC5D,CAAC;MACD,MAAMF,KAAK,GAAGxB,OAAO,CAAC,IAAI,CAACf,IAAI,EAAEC,GAAG,EAAEyC,MAAM,EAAEA,MAAM,EAAExC,EAAE,EAAEC,EAAE,CAAC;MAC7D,MAAMyD,KAAK,GAAG7D,OAAO,CAAC,IAAI,CAACC,IAAI,EAAEC,GAAG,EAAEoD,KAAK,CAAC5C,CAAC,EAAE4C,KAAK,CAAC3C,CAAC,CAAC;MACvDiB,MAAM,CAACkC,UAAU,CAACD,KAAK,EAAErB,KAAK,EAAEI,MAAM,CAAC;MACvChB,MAAM,CAACmC,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC;EACN;AACF"}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { BlendMode } from "../../../skia/types";
|
2
|
-
import {
|
2
|
+
import { NodeType } from "../../types/NodeType";
|
3
3
|
import { JsiDeclarationNode } from "../Node";
|
4
4
|
import { enumKey } from "../datatypes";
|
5
5
|
import { composeDeclarations } from "../../types/DeclarationContext";
|
6
6
|
export class BlendNode extends JsiDeclarationNode {
|
7
7
|
constructor(ctx, props) {
|
8
|
-
super(ctx,
|
8
|
+
super(ctx, NodeType.Blend, props);
|
9
9
|
}
|
10
10
|
decorate(ctx) {
|
11
11
|
this.decorateChildren(ctx);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlendMode","
|
1
|
+
{"version":3,"names":["BlendMode","NodeType","JsiDeclarationNode","enumKey","composeDeclarations","BlendNode","constructor","ctx","props","Blend","decorate","decorateChildren","Skia","blend","mode","imageFilters","popAll","length","composer","ImageFilter","MakeBlend","bind","push","shaders","Shader"],"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,SAASA,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,QAAQ,QAAQ,sBAAsB;AAE/C,SAASC,kBAAkB,QAAQ,SAAS;AAC5C,SAASC,OAAO,QAAQ,cAAc;AAEtC,SAASC,mBAAmB,QAAQ,gCAAgC;AAEpE,OAAO,MAAMC,SAAS,SAASH,kBAAkB,CAAa;EAC5DI,WAAWA,CAACC,GAAgB,EAAEC,KAAiB,EAAE;IAC/C,KAAK,CAACD,GAAG,EAAEN,QAAQ,CAACQ,KAAK,EAAED,KAAK,CAAC;EACnC;EAEAE,QAAQA,CAACH,GAAuB,EAAE;IAChC,IAAI,CAACI,gBAAgB,CAACJ,GAAG,CAAC;IAC1B,MAAM;MAAEK;IAAK,CAAC,GAAG,IAAI;IACrB,MAAMC,KAAK,GAAGb,SAAS,CAACG,OAAO,CAAC,IAAI,CAACK,KAAK,CAACM,IAAI,CAAC,CAAC;IACjD;IACA,MAAMC,YAAY,GAAGR,GAAG,CAACQ,YAAY,CAACC,MAAM,CAAC,CAAC;IAC9C,IAAID,YAAY,CAACE,MAAM,GAAG,CAAC,EAAE;MAC3B,MAAMC,QAAQ,GAAGN,IAAI,CAACO,WAAW,CAACC,SAAS,CAACC,IAAI,CAACT,IAAI,CAACO,WAAW,EAAEN,KAAK,CAAC;MACzEN,GAAG,CAACQ,YAAY,CAACO,IAAI,CAAClB,mBAAmB,CAACW,YAAY,EAAEG,QAAQ,CAAC,CAAC;IACpE;IACA;IACA,MAAMK,OAAO,GAAGhB,GAAG,CAACgB,OAAO,CAACP,MAAM,CAAC,CAAC;IACpC,IAAIO,OAAO,CAACN,MAAM,GAAG,CAAC,EAAE;MACtB,MAAMC,QAAQ,GAAGN,IAAI,CAACY,MAAM,CAACJ,SAAS,CAACC,IAAI,CAACT,IAAI,CAACY,MAAM,EAAEX,KAAK,CAAC;MAC/DN,GAAG,CAACgB,OAAO,CAACD,IAAI,CAAClB,mBAAmB,CAACmB,OAAO,EAAEL,QAAQ,CAAC,CAAC;IAC1D;EACF;AACF"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { BlendMode } from "../../../skia/types";
|
2
2
|
import { JsiDeclarationNode } from "../Node";
|
3
|
-
import {
|
3
|
+
import { NodeType } from "../../types";
|
4
4
|
import { enumKey } from "../datatypes/Enum";
|
5
5
|
export class ColorFilterDeclaration extends JsiDeclarationNode {
|
6
6
|
constructor(ctx, type, props) {
|
7
|
-
super(ctx,
|
7
|
+
super(ctx, type, props);
|
8
8
|
}
|
9
9
|
composeAndPush(ctx, cf1) {
|
10
10
|
ctx.save();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlendMode","JsiDeclarationNode","
|
1
|
+
{"version":3,"names":["BlendMode","JsiDeclarationNode","NodeType","enumKey","ColorFilterDeclaration","constructor","ctx","type","props","composeAndPush","cf1","save","decorateChildren","cf2","colorFilters","popAllAsOne","restore","cf","Skia","ColorFilter","MakeCompose","push","MatrixColorFilterNode","MatrixColorFilter","decorate","matrix","MakeMatrix","BlendColorFilterNode","BlendColorFilter","mode","color","Color","MakeBlend","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,SAASA,SAAS,QAAQ,qBAAqB;AAE/C,SAASC,kBAAkB,QAAQ,SAAS;AAK5C,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,OAAO,QAAQ,mBAAmB;AAI3C,OAAO,MAAeC,sBAAsB,SAAYH,kBAAkB,CAAI;EAC5EI,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;AAEA,OAAO,MAAMK,qBAAqB,SAASlB,sBAAsB,CAAyB;EACxFC,WAAWA,CAACC,GAAgB,EAAEE,KAA6B,EAAE;IAC3D,KAAK,CAACF,GAAG,EAAEJ,QAAQ,CAACqB,iBAAiB,EAAEf,KAAK,CAAC;EAC/C;EAEAgB,QAAQA,CAAClB,GAAuB,EAAE;IAChC,MAAM;MAAEmB;IAAO,CAAC,GAAG,IAAI,CAACjB,KAAK;IAC7B,MAAMS,EAAE,GAAG,IAAI,CAACC,IAAI,CAACC,WAAW,CAACO,UAAU,CAACD,MAAM,CAAC;IACnD,IAAI,CAAChB,cAAc,CAACH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EACzE;AACF"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { BlendMode, ColorChannel, processUniforms, TileMode } from "../../../skia/types";
|
2
|
-
import {
|
2
|
+
import { NodeType } from "../../types";
|
3
3
|
import { processRadius, enumKey } from "../datatypes";
|
4
4
|
import { JsiDeclarationNode } from "../Node";
|
5
5
|
const Black = Float32Array.of(0, 0, 0, 1);
|
@@ -17,7 +17,7 @@ const MakeInnerShadow = (Skia, shadowOnly, dx, dy, sigmaX, sigmaY, color, input)
|
|
17
17
|
};
|
18
18
|
export class ImageFilterDeclaration extends JsiDeclarationNode {
|
19
19
|
constructor(ctx, type, props) {
|
20
|
-
super(ctx,
|
20
|
+
super(ctx, type, props);
|
21
21
|
}
|
22
22
|
input(ctx) {
|
23
23
|
var _ctx$imageFilters$pop;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlendMode","ColorChannel","processUniforms","TileMode","DeclarationType","NodeType","processRadius","enumKey","JsiDeclarationNode","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","constructor","ctx","type","props","_ctx$imageFilters$pop","imageFilters","pop","composeAndPush","imgf1","save","decorateChildren","imgf2","popAllAsOne","cf","colorFilters","restore","_imgf","imgf","push","OffsetImageFilterNode","OffsetImageFilter","decorate","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","Error","map","MakeShader","MakeDisplacementMap","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","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","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,SACEA,SAAS,EACTC,YAAY,EACZC,eAAe,EACfC,QAAQ,QACH,qBAAqB;AAW5B,SAASC,eAAe,EAAEC,QAAQ,QAAQ,aAAa;AACvD,SAASC,aAAa,EAAEC,OAAO,QAAQ,cAAc;AAErD,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,MAAMC,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,EACVC,MAAc,EACdC,MAAc,EACdC,KAAc,EACdC,KAA2B,KACxB;EACH,MAAMC,aAAa,GAAGR,IAAI,CAACS,WAAW,CAACC,eAAe,CACpDV,IAAI,CAACW,WAAW,CAACC,SAAS,CAAChB,KAAK,EAAET,SAAS,CAAC0B,GAAG,CAAC,EAChD,IACF,CAAC;EACD,MAAMC,WAAW,GAAGd,IAAI,CAACS,WAAW,CAACC,eAAe,CA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ACxC;IACA,MAAMjD,IAAI,GAAG,IAAI,CAAC5C,IAAI,CAACS,WAAW,CAACsF,iBAAiB,CAClDF,GAAG,EACH,IAAI,EACJ,IAAI,CAACtF,KAAK,CAACqB,GAAG,CAChB,CAAC;IACD,IAAI,CAACM,cAAc,CAACN,GAAG,EAAEgB,IAAI,CAAC;EAChC;AACF"}
|
1
|
+
{"version":3,"names":["BlendMode","ColorChannel","processUniforms","TileMode","NodeType","processRadius","enumKey","JsiDeclarationNode","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","constructor","ctx","type","props","_ctx$imageFilters$pop","imageFilters","pop","composeAndPush","imgf1","save","decorateChildren","imgf2","popAllAsOne","cf","colorFilters","restore","_imgf","imgf","push","OffsetImageFilterNode","OffsetImageFilter","decorate","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","Error","map","MakeShader","MakeDisplacementMap","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","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","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,SACEA,SAAS,EACTC,YAAY,EACZC,eAAe,EACfC,QAAQ,QACH,qBAAqB;AAW5B,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,aAAa,EAAEC,OAAO,QAAQ,cAAc;AAErD,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,MAAMC,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,EACVC,MAAc,EACdC,MAAc,EACdC,KAAc,EACdC,KAA2B,KACxB;EACH,MAAMC,aAAa,GAAGR,IAAI,CAACS,WAAW,CAACC,eAAe,CACpDV,IAAI,CAACW,WAAW,CAACC,SAAS,CAAChB,KAAK,EAAER,SAAS,CAACyB,GAAG,CAAC,EAChD,IACF,CAAC;EACD,MAAMC,WAAW,GAAGd,IAAI,CAACS,WAAW,CAACC,eAAe,CAClDV,IAAI,CAACW,WAAW,CAACC,SAAS,CAAChB,KAAK,EAAER,SAAS,CAAC2B,KAAK,CAAC,EAClD,IACF,CAAC;EACD,MAAMC,EAAE,GAAGhB,IAAI,CAACS,WAAW,CAACC,eAAe,CACzCV,IAAI,CAACW,WAAW,CAACC,SAAS,CAACN,KAAK,EAAElB,SAAS,CAAC6B,MAAM,CAAC,EACnD,IACF,CAAC;EACD,MAAMC,EAAE,GAAGlB,IAAI,CAACS,WAAW,CAACU,UAAU,CAACjB,EAAE,EAAEC,EAAE,EAAEa,E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AAG,CAACI,YAAY,CAACC,GAAG,CAAC,CAAC;IAChC,MAAMuD,CAAC,GAAG5D,GAAG,CAACI,YAAY,CAACC,GAAG,CAAC,CAAC;IAChC,IAAI,CAACsD,CAAC,IAAI,CAACC,CAAC,EAAE;MACZ,MAAM,IAAI9B,KAAK,CAAC,6CAA6C,CAAC;IAChE;IACA,MAAMd,IAAI,GAAG,IAAI,CAAC5C,IAAI,CAACS,WAAW,CAACG,SAAS,CAACoD,IAAI,EAAEuB,CAAC,EAAEC,CAAC,CAAC;IACxD,IAAI,CAACtD,cAAc,CAACN,GAAG,EAAEgB,IAAI,CAAC;EAChC;AACF;AAEA,OAAO,MAAM6C,4BAA4B,SAAS/D,sBAAsB,CAAgC;EACtGC,WAAWA,CAACC,GAAgB,EAAEE,KAAoC,EAAE;IAClE,KAAK,CAACF,GAAG,EAAEpC,QAAQ,CAACkG,wBAAwB,EAAE5D,KAAK,CAAC;EACtD;EAEAkB,QAAQA,CAACpB,GAAuB,EAAE;IAChC,MAAM;MAAE+D,MAAM;MAAEC;IAAS,CAAC,GAAG,IAAI,CAAC9D,KAAK;IACvC,MAAM+D,GAAG,GAAG,IAAI,CAAC7F,IAAI,CAAC8F,oBAAoB,CAACH,MAAM,CAAC;IAClD,IAAIC,QAAQ,EAAE;MACZtG,eAAe,CAACqG,MAAM,EAAEC,QAAQ,EAAEC,GAAG,CAAC;IACxC;IACA,MAAMjD,IAAI,GAAG,IAAI,CAAC5C,IAAI,CAACS,WAAW,CAACsF,iBAAiB,CAClDF,GAAG,EACH,IAAI,EACJ,IAAI,CAACtF,KAAK,CAACqB,GAAG,CAChB,CAAC;IACD,IAAI,CAACM,cAAc,CAACN,GAAG,EAAEgB,IAAI,CAAC;EAChC;AACF"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { BlurStyle } from "../../../skia/types";
|
2
2
|
import { JsiDeclarationNode } from "../Node";
|
3
|
-
import {
|
3
|
+
import { NodeType } from "../../types";
|
4
4
|
import { enumKey } from "../datatypes";
|
5
5
|
export class BlurMaskFilterNode extends JsiDeclarationNode {
|
6
6
|
constructor(ctx, props) {
|
7
|
-
super(ctx,
|
7
|
+
super(ctx, NodeType.BlurMaskFilter, props);
|
8
8
|
}
|
9
9
|
decorate(ctx) {
|
10
10
|
const {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlurStyle","JsiDeclarationNode","
|
1
|
+
{"version":3,"names":["BlurStyle","JsiDeclarationNode","NodeType","enumKey","BlurMaskFilterNode","constructor","ctx","props","BlurMaskFilter","decorate","style","blur","respectCTM","mf","Skia","MaskFilter","MakeBlur","maskFilters","push"],"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,SAASA,SAAS,QAAQ,qBAAqB;AAE/C,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,OAAO,QAAQ,cAAc;AAGtC,OAAO,MAAMC,kBAAkB,SAASH,kBAAkB,CAAsB;EAC9EI,WAAWA,CAACC,GAAgB,EAAEC,KAA0B,EAAE;IACxD,KAAK,CAACD,GAAG,EAAEJ,QAAQ,CAACM,cAAc,EAAED,KAAK,CAAC;EAC5C;EAEAE,QAAQA,CAACH,GAAuB,EAAE;IAChC,MAAM;MAAEI,KAAK;MAAEC,IAAI;MAAEC;IAAW,CAAC,GAAG,IAAI,CAACL,KAAK;IAC9C,MAAMM,EAAE,GAAG,IAAI,CAACC,IAAI,CAACC,UAAU,CAACC,QAAQ,CACtChB,SAAS,CAACG,OAAO,CAACO,KAAK,CAAC,CAAC,EACzBC,IAAI,EACJC,UACF,CAAC;IACDN,GAAG,CAACW,WAAW,CAACC,IAAI,CAACL,EAAE,CAAC;EAC1B;AACF"}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { Path1DEffectStyle } from "../../../skia/types";
|
2
2
|
import { JsiDeclarationNode } from "../Node";
|
3
|
-
import {
|
3
|
+
import { NodeType } from "../../types";
|
4
4
|
import { enumKey } from "../datatypes/Enum";
|
5
5
|
import { processPath } from "../datatypes";
|
6
6
|
import { composeDeclarations } from "../../types/DeclarationContext";
|
7
7
|
class PathEffectDeclaration extends JsiDeclarationNode {
|
8
8
|
constructor(ctx, type, props) {
|
9
|
-
super(ctx,
|
9
|
+
super(ctx, type, props);
|
10
10
|
}
|
11
11
|
composeAndPush(ctx, pe1) {
|
12
12
|
ctx.save();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Path1DEffectStyle","JsiDeclarationNode","
|
1
|
+
{"version":3,"names":["Path1DEffectStyle","JsiDeclarationNode","NodeType","enumKey","processPath","composeDeclarations","PathEffectDeclaration","constructor","ctx","type","props","composeAndPush","pe1","save","decorateChildren","pe2","pathEffects","popAllAsOne","restore","pe","Skia","PathEffect","MakeCompose","push","DiscretePathEffectNode","DiscretePathEffect","decorate","length","deviation","seed","MakeDiscrete","Path2DPathEffectNode","Path2DPathEffect","matrix","path","MakePath2D","Error","DashPathEffectNode","DashPathEffect","intervals","phase","MakeDash","CornerPathEffectNode","CornerPathEffect","r","MakeCorner","SumPathEffectNode","SumPathEffect","pes","popAll","MakeSum","bind","Line2DPathEffectNode","Line2DPathEffect","width","MakeLine2D","Path1DPathEffectNode","Path1DPathEffect","advance","style","MakePath1D"],"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,SAASA,iBAAiB,QAAQ,qBAAqB;AAGvD,SAASC,kBAAkB,QAAQ,SAAS;AAS5C,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,OAAO,QAAQ,mBAAmB;AAC3C,SAASC,WAAW,QAAQ,cAAc;AAE1C,SAASC,mBAAmB,QAAQ,gCAAgC;AAEpE,MAAeC,qBAAqB,SAAYL,kBAAkB,CAAI;EACpEM,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,WAAW,CAAC,CAAC;IACzCT,GAAG,CAACU,OAAO,CAAC,CAAC;IACb,MAAMC,EAAE,GAAGJ,GAAG,GAAG,IAAI,CAACK,IAAI,CAACC,UAAU,CAACC,WAAW,CAACV,GAAG,EAAEG,GAAG,CAAC,GAAGH,GAAG;IACjEJ,GAAG,CAACQ,WAAW,CAACO,IAAI,CAACJ,EAAE,CAAC;EAC1B;AACF;AAEA,OAAO,MAAMK,sBAAsB,SAASlB,qBAAqB,CAA0B;EACzFC,WAAWA,CAACC,GAAgB,EAAEE,KAA8B,EAAE;IAC5D,KAAK,CAACF,GAAG,EAAEN,QAAQ,CAACuB,kBAAkB,EAAEf,KAAK,CAAC;EAChD;EAEAgB,QAAQA,CAAClB,GAAuB,EAAE;IAChC,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AC;EAC9B;AACF"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { processUniforms, FilterMode, MipmapMode, TileMode } from "../../../skia/types";
|
2
2
|
import { JsiDeclarationNode } from "../Node";
|
3
|
-
import {
|
3
|
+
import { NodeType } from "../../types";
|
4
4
|
import { enumKey, fitRects, getRect, processGradientProps, processTransformProps, rect2rect } from "../datatypes";
|
5
5
|
export class ShaderDeclaration extends JsiDeclarationNode {
|
6
6
|
constructor(ctx, type, props) {
|
7
|
-
super(ctx,
|
7
|
+
super(ctx, type, props);
|
8
8
|
}
|
9
9
|
}
|
10
10
|
export class ShaderNode extends ShaderDeclaration {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["processUniforms","FilterMode","MipmapMode","TileMode","JsiDeclarationNode","DeclarationType","NodeType","enumKey","fitRects","getRect","processGradientProps","processTransformProps","rect2rect","ShaderDeclaration","constructor","ctx","type","props","Shader","ShaderNode","decorate","decorateChildren","source","uniforms","transform","m3","Skia","Matrix","shader","makeShaderWithChildren","shaders","popAll","push","ImageShaderNode","ImageShader","fit","image","tx","ty","fm","mm","imageShaderProps","rct","rects","x","y","width","height","sx","sy","src","dst","translate","translateX","translateY","scale","scaleX","scaleY","lm","concat","makeShaderOptions","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","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,SACEA,eAAe,EACfC,UAAU,EACVC,UAAU,EACVC,QAAQ,QACH,qBAAqB;AAE5B,SAASC,kBAAkB,QAAQ,SAAS;AAa5C,SAASC,eAAe,EAAEC,QAAQ,QAAQ,aAAa;AACvD,SACEC,OAAO,EACPC,QAAQ,EACRC,OAAO,EACPC,oBAAoB,EACpBC,qBAAqB,EACrBC,SAAS,QACJ,cAAc;AAErB,OAAO,MAAeC,iBAAiB,SAAYT,kBAAkB,CAAI;EACvEU,WAAWA,CAACC,GAAgB,EAAEC,IAAc,EAAEC,KAAQ,EAAE;IACtD,KAAK,CAACF,G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A,CAACC,GAAgB,EAAEE,KAAmC,EAAE;IACjE,KAAK,CAACF,GAAG,EAAET,QAAQ,CAAC2F,uBAAuB,EAAEhF,KAAK,CAAC;EACrD;EAEAG,QAAQA,CAACL,GAAuB,EAAE;IAChC,MAAM;MAAEmF,MAAM;MAAEC,IAAI;MAAEnB,KAAK;MAAEC;IAAI,CAAC,GAAG,IAAI,CAAChE,KAAK;IAC/C,MAAM;MAAEiE,MAAM;MAAEC,SAAS;MAAEC,IAAI;MAAEC,WAAW;MAAEC;IAAM,CAAC,GACnD5E,oBAAoB,CAAC,IAAI,CAACgB,IAAI,EAAE,IAAI,CAACT,KAAK,CAAC;IAC7C,MAAMW,MAAM,GAAG,IAAI,CAACF,IAAI,CAACR,MAAM,CAACkF,2BAA2B,CACzDpB,KAAK,EACLkB,MAAM,EACNjB,GAAG,EACHkB,IAAI,EACJjB,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,WAAW,EACXC,KACF,CAAC;IACDvE,GAAG,CAACe,OAAO,CAACE,IAAI,CAACJ,MAAM,CAAC;EAC1B;AACF"}
|
1
|
+
{"version":3,"names":["processUniforms","FilterMode","MipmapMode","TileMode","JsiDeclarationNode","NodeType","enumKey","fitRects","getRect","processGradientProps","processTransformProps","rect2rect","ShaderDeclaration","constructor","ctx","type","props","ShaderNode","Shader","decorate","decorateChildren","source","uniforms","transform","m3","Skia","Matrix","shader","makeShaderWithChildren","shaders","popAll","push","ImageShaderNode","ImageShader","fit","image","tx","ty","fm","mm","imageShaderProps","rct","rects","x","y","width","height","sx","sy","src","dst","translate","translateX","translateY","scale","scaleX","scaleY","lm","concat","makeShaderOptions","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","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,SACEA,eAAe,EACfC,UAAU,EACVC,UAAU,EACVC,QAAQ,QACH,qBAAqB;AAE5B,SAASC,kBAAkB,QAAQ,SAAS;AAa5C,SAASC,QAAQ,QAAQ,aAAa;AACtC,SACEC,OAAO,E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JC,WAAW,EACXC,KAAK,EACLN,KAAK,EACLC,GACF,CAAC;IACDlE,GAAG,CAACe,OAAO,CAACE,IAAI,CAACJ,MAAM,CAAC;EAC1B;AACF;AAEA,OAAO,MAAMoE,2BAA2B,SAASnF,iBAAiB,CAA+B;EAC/FC,WAAWA,CAACC,GAAgB,EAAEE,KAAmC,EAAE;IACjE,KAAK,CAACF,GAAG,EAAET,QAAQ,CAAC2F,uBAAuB,EAAEhF,KAAK,CAAC;EACrD;EAEAG,QAAQA,CAACL,GAAuB,EAAE;IAChC,MAAM;MAAEmF,MAAM;MAAEC,IAAI;MAAEnB,KAAK;MAAEC;IAAI,CAAC,GAAG,IAAI,CAAChE,KAAK;IAC/C,MAAM;MAAEiE,MAAM;MAAEC,SAAS;MAAEC,IAAI;MAAEC,WAAW;MAAEC;IAAM,CAAC,GACnD5E,oBAAoB,CAAC,IAAI,CAACgB,IAAI,EAAE,IAAI,CAACT,KAAK,CAAC;IAC7C,MAAMW,MAAM,GAAG,IAAI,CAACF,IAAI,CAACP,MAAM,CAACiF,2BAA2B,CACzDpB,KAAK,EACLkB,MAAM,EACNjB,GAAG,EACHkB,IAAI,EACJjB,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,WAAW,EACXC,KACF,CAAC;IACDvE,GAAG,CAACe,OAAO,CAACE,IAAI,CAACJ,MAAM,CAAC;EAC1B;AACF"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { GroupProps } from "./Common";
|
2
|
-
import type {
|
2
|
+
import type { NodeType } from "./NodeType";
|
3
3
|
import type { DeclarationContext } from "./DeclarationContext";
|
4
4
|
import type { DrawingContext } from "./DrawingContext";
|
5
5
|
export interface Node<P> {
|
@@ -14,7 +14,6 @@ export interface Node<P> {
|
|
14
14
|
}
|
15
15
|
export type Invalidate = () => void;
|
16
16
|
export interface DeclarationNode<P> extends Node<P> {
|
17
|
-
declarationType: DeclarationType;
|
18
17
|
decorate(ctx: DeclarationContext): void;
|
19
18
|
setInvalidate(invalidate: Invalidate): void;
|
20
19
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["Node.ts"],"sourcesContent":["import type { GroupProps } from \"./Common\";\nimport type {
|
1
|
+
{"version":3,"names":[],"sources":["Node.ts"],"sourcesContent":["import type { GroupProps } from \"./Common\";\nimport type { NodeType } from \"./NodeType\";\nimport type { DeclarationContext } from \"./DeclarationContext\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nexport interface Node<P> {\n type: NodeType;\n\n setProps(props: P): void;\n setProp<K extends keyof P>(name: K, v: P[K]): boolean;\n getProps(): P;\n\n children(): Node<unknown>[];\n addChild(child: Node<unknown>): void;\n removeChild(child: Node<unknown>): void;\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;\n}\n\nexport type Invalidate = () => void;\n\nexport interface DeclarationNode<P> extends Node<P> {\n //declarationType: DeclarationType;\n decorate(ctx: DeclarationContext): void;\n\n setInvalidate(invalidate: Invalidate): void;\n}\n\nexport interface RenderNode<P extends GroupProps> extends Node<P> {\n render(ctx: DrawingContext): void;\n}\n"],"mappings":""}
|
@@ -57,12 +57,3 @@ export declare const enum NodeType {
|
|
57
57
|
Atlas = "skAtlas",
|
58
58
|
Paragraph = "skParagraph"
|
59
59
|
}
|
60
|
-
export declare const enum DeclarationType {
|
61
|
-
Paint = 0,
|
62
|
-
Shader = 1,
|
63
|
-
ImageFilter = 2,
|
64
|
-
ColorFilter = 3,
|
65
|
-
PathEffect = 4,
|
66
|
-
MaskFilter = 5,
|
67
|
-
Unknown = 6
|
68
|
-
}
|
@@ -58,14 +58,4 @@ export let NodeType = /*#__PURE__*/function (NodeType) {
|
|
58
58
|
NodeType["Paragraph"] = "skParagraph";
|
59
59
|
return NodeType;
|
60
60
|
}({});
|
61
|
-
export let DeclarationType = /*#__PURE__*/function (DeclarationType) {
|
62
|
-
DeclarationType[DeclarationType["Paint"] = 0] = "Paint";
|
63
|
-
DeclarationType[DeclarationType["Shader"] = 1] = "Shader";
|
64
|
-
DeclarationType[DeclarationType["ImageFilter"] = 2] = "ImageFilter";
|
65
|
-
DeclarationType[DeclarationType["ColorFilter"] = 3] = "ColorFilter";
|
66
|
-
DeclarationType[DeclarationType["PathEffect"] = 4] = "PathEffect";
|
67
|
-
DeclarationType[DeclarationType["MaskFilter"] = 5] = "MaskFilter";
|
68
|
-
DeclarationType[DeclarationType["Unknown"] = 6] = "Unknown";
|
69
|
-
return DeclarationType;
|
70
|
-
}({});
|
71
61
|
//# sourceMappingURL=NodeType.js.map
|