@shopify/react-native-skia 0.1.146 → 0.1.147

Sign up to get free protection for your applications and to get access to all the features.
@@ -88,6 +88,14 @@ public:
88
88
  return jsi::Value::undefined();
89
89
  }
90
90
 
91
+ JSI_HOST_FUNCTION(get) {
92
+ auto values = jsi::Array(runtime, 9);
93
+ for (auto i = 0; i < 9; i++) {
94
+ values.setValueAtIndex(runtime, i, getObject()->get(i));
95
+ }
96
+ return values;
97
+ }
98
+
91
99
  JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkMatrix, __typename__))
92
100
 
93
101
  JSI_EXPORT_FUNCTIONS(
@@ -97,6 +105,7 @@ public:
97
105
  JSI_EXPORT_FUNC(JsiSkMatrix, skew),
98
106
  JSI_EXPORT_FUNC(JsiSkMatrix, rotate),
99
107
  JSI_EXPORT_FUNC(JsiSkMatrix, identity),
108
+ JSI_EXPORT_FUNC(JsiSkMatrix, get),
100
109
  )
101
110
 
102
111
  /**
@@ -348,7 +348,7 @@ public:
348
348
  return thisValue.getObject(runtime);
349
349
  }
350
350
 
351
- JSI_HOST_FUNCTION(rlineTo) {
351
+ JSI_HOST_FUNCTION(rLineTo) {
352
352
  SkScalar x = arguments[0].asNumber();
353
353
  SkScalar y = arguments[1].asNumber();
354
354
  getObject()->rLineTo(x, y);
@@ -536,7 +536,7 @@ public:
536
536
  JSI_EXPORT_FUNC(JsiSkPath, moveTo),
537
537
  JSI_EXPORT_FUNC(JsiSkPath, rMoveTo),
538
538
  JSI_EXPORT_FUNC(JsiSkPath, lineTo),
539
- JSI_EXPORT_FUNC(JsiSkPath, rlineTo),
539
+ JSI_EXPORT_FUNC(JsiSkPath, rLineTo),
540
540
  JSI_EXPORT_FUNC(JsiSkPath, cubicTo),
541
541
  JSI_EXPORT_FUNC(JsiSkPath, rCubicTo),
542
542
  JSI_EXPORT_FUNC(JsiSkPath, reset),
@@ -1 +1 @@
1
- {"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex","isMatrix","obj","__typename__","processTransform","m","transforms","transform","key","Object","keys","value","translate","scale","skew","rotate","toDegrees","exhaustiveCheck","a","Error","rad","Math","PI"],"mappings":";;;;;;IAEYA,W;;;WAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W;;AAYL,MAAMC,QAAQ,GAAIC,GAAD,IACtBA,GAAG,KAAK,IAAR,IAAiBA,GAAD,CAA+BC,YAA/B,KAAgD,QAD3D;;;;AA0CA,MAAMC,gBAAgB,GAAG,CAC9BC,CAD8B,EAE9BC,UAF8B,KAG3B;AACH,OAAK,MAAMC,SAAX,IAAwBD,UAAxB,EAAoC;AAClC,UAAME,GAAG,GAAGC,MAAM,CAACC,IAAP,CAAYH,SAAZ,EAAuB,CAAvB,CAAZ;AACA,UAAMI,KAAK,GAAIJ,SAAD,CAAiDC,GAAjD,CAAd;;AACA,QAAIA,GAAG,KAAK,YAAZ,EAA0B;AACxBH,MAAAA,CAAC,CAACO,SAAF,CAAYD,KAAZ,EAAmB,CAAnB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,YAAZ,EAA0B;AACxBH,MAAAA,CAAC,CAACO,SAAF,CAAY,CAAZ,EAAeD,KAAf;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBH,MAAAA,CAAC,CAACQ,KAAF,CAAQF,KAAR,EAAeA,KAAf;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAZ,EAAsB;AACpBH,MAAAA,CAAC,CAACQ,KAAF,CAAQF,KAAR,EAAe,CAAf;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAZ,EAAsB;AACpBH,MAAAA,CAAC,CAACQ,KAAF,CAAQ,CAAR,EAAWF,KAAX;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBH,MAAAA,CAAC,CAACS,IAAF,CAAOH,KAAP,EAAc,CAAd;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBH,MAAAA,CAAC,CAACS,IAAF,CAAO,CAAP,EAAUH,KAAV;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,SAAhC,EAA2C;AACzC,UAAIP,QAAQ,CAACI,CAAD,CAAZ,EAAiB;AACfA,QAAAA,CAAC,CAACU,MAAF,CAASJ,KAAT;AACD,OAFD,MAEO;AACLN,QAAAA,CAAC,CAACU,MAAF,CAASC,SAAS,CAACL,KAAD,CAAlB,EAA2B,CAA3B,EAA8B,CAA9B;AACD;;AACD;AACD;;AACDM,IAAAA,eAAe,CAACT,GAAD,CAAf;AACD;;AACD,SAAOH,CAAP;AACD,CA9CM;;;;AAgDP,MAAMY,eAAe,GAAIC,CAAD,IAAqB;AAC3C,QAAM,IAAIC,KAAJ,CAAW,2BAA0BD,CAAE,EAAvC,CAAN;AACD,CAFD;;AAIO,MAAMF,SAAS,GAAII,GAAD,IAAiB;AACxC,SAAQA,GAAG,GAAG,GAAP,GAAcC,IAAI,CAACC,EAA1B;AACD,CAFM","sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\nimport type { SkCanvas } from \"./Canvas\";\nexport enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n Persp2 = 8,\n}\n\nexport const isMatrix = (obj: unknown): obj is SkMatrix =>\n obj !== null && (obj as SkJSIInstance<string>).__typename__ === \"Matrix\";\n\nexport interface SkMatrix extends SkJSIInstance<\"Matrix\"> {\n concat: (matrix: SkMatrix) => void;\n translate: (x: number, y: number) => void;\n scale: (x: number, y?: number) => void;\n skew: (x: number, y: number) => void;\n rotate: (theta: number) => void;\n identity: () => void;\n}\n\ntype Transform2dName =\n | \"translateX\"\n | \"translateY\"\n | \"scale\"\n | \"skewX\"\n | \"skewY\"\n | \"scaleX\"\n | \"scaleY\"\n | \"rotateZ\"\n | \"rotate\";\n\ntype Transformations = {\n readonly [Name in Transform2dName]: number;\n};\n\nexport type Transforms2d = readonly (\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"rotate\">\n)[];\n\nexport interface TransformProp {\n transform?: Transforms2d;\n}\n\nexport const processTransform = <T extends SkMatrix | SkCanvas>(\n m: T,\n transforms: Transforms2d\n) => {\n for (const transform of transforms) {\n const key = Object.keys(transform)[0] as Transform2dName;\n const value = (transform as Pick<Transformations, typeof key>)[key];\n if (key === \"translateX\") {\n m.translate(value, 0);\n continue;\n }\n if (key === \"translateY\") {\n m.translate(0, value);\n continue;\n }\n if (key === \"scale\") {\n m.scale(value, value);\n continue;\n }\n if (key === \"scaleX\") {\n m.scale(value, 1);\n continue;\n }\n if (key === \"scaleY\") {\n m.scale(1, value);\n continue;\n }\n if (key === \"skewX\") {\n m.skew(value, 0);\n continue;\n }\n if (key === \"skewY\") {\n m.skew(0, value);\n continue;\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n if (isMatrix(m)) {\n m.rotate(value);\n } else {\n m.rotate(toDegrees(value), 0, 0);\n }\n continue;\n }\n exhaustiveCheck(key);\n }\n return m;\n};\n\nconst exhaustiveCheck = (a: never): never => {\n throw new Error(`Unknown transformation: ${a}`);\n};\n\nexport const toDegrees = (rad: number) => {\n return (rad * 180) / Math.PI;\n};\n"]}
1
+ {"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex","isMatrix","obj","__typename__","processTransform","m","transforms","transform","key","Object","keys","value","transl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KAAX;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBH,MAAAA,CAAC,CAACS,IAAF,CAAOH,KAAP,EAAc,CAAd;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBH,MAAAA,CAAC,CAACS,IAAF,CAAO,CAAP,EAAUH,KAAV;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,SAAhC,EAA2C;AACzC,UAAIP,QAAQ,CAACI,CAAD,CAAZ,EAAiB;AACfA,QAAAA,CAAC,CAACU,MAAF,CAASJ,KAAT;AACD,OAFD,MAEO;AACLN,QAAAA,CAAC,CAACU,MAAF,CAASC,SAAS,CAACL,KAAD,CAAlB,EAA2B,CAA3B,EAA8B,CAA9B;AACD;;AACD;AACD;;AACDM,IAAAA,eAAe,CAACT,GAAD,CAAf;AACD;;AACD,SAAOH,CAAP;AACD,CA9CM;;;;AAgDP,MAAMY,eAAe,GAAIC,CAAD,IAAqB;AAC3C,QAAM,IAAIC,KAAJ,CAAW,2BAA0BD,CAAE,EAAvC,CAAN;AACD,CAFD;;AAIO,MAAMF,SAAS,GAAII,GAAD,IAAiB;AACxC,SAAQA,GAAG,GAAG,GAAP,GAAcC,IAAI,CAACC,EAA1B;AACD,CAFM","sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\nimport type { SkCanvas } from \"./Canvas\";\nexport enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n Persp2 = 8,\n}\n\nexport const isMatrix = (obj: unknown): obj is SkMatrix =>\n obj !== null && (obj as SkJSIInstance<string>).__typename__ === \"Matrix\";\n\nexport interface SkMatrix extends SkJSIInstance<\"Matrix\"> {\n concat: (matrix: SkMatrix) => void;\n translate: (x: number, y: number) => void;\n scale: (x: number, y?: number) => void;\n skew: (x: number, y: number) => void;\n rotate: (theta: number) => void;\n identity: () => void;\n get: () => number[];\n}\n\ntype Transform2dName =\n | \"translateX\"\n | \"translateY\"\n | \"scale\"\n | \"skewX\"\n | \"skewY\"\n | \"scaleX\"\n | \"scaleY\"\n | \"rotateZ\"\n | \"rotate\";\n\ntype Transformations = {\n readonly [Name in Transform2dName]: number;\n};\n\nexport type Transforms2d = readonly (\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"rotate\">\n)[];\n\nexport interface TransformProp {\n transform?: Transforms2d;\n}\n\nexport const processTransform = <T extends SkMatrix | SkCanvas>(\n m: T,\n transforms: Transforms2d\n) => {\n for (const transform of transforms) {\n const key = Object.keys(transform)[0] as Transform2dName;\n const value = (transform as Pick<Transformations, typeof key>)[key];\n if (key === \"translateX\") {\n m.translate(value, 0);\n continue;\n }\n if (key === \"translateY\") {\n m.translate(0, value);\n continue;\n }\n if (key === \"scale\") {\n m.scale(value, value);\n continue;\n }\n if (key === \"scaleX\") {\n m.scale(value, 1);\n continue;\n }\n if (key === \"scaleY\") {\n m.scale(1, value);\n continue;\n }\n if (key === \"skewX\") {\n m.skew(value, 0);\n continue;\n }\n if (key === \"skewY\") {\n m.skew(0, value);\n continue;\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n if (isMatrix(m)) {\n m.rotate(value);\n } else {\n m.rotate(toDegrees(value), 0, 0);\n }\n continue;\n }\n exhaustiveCheck(key);\n }\n return m;\n};\n\nconst exhaustiveCheck = (a: never): never => {\n throw new Error(`Unknown transformation: ${a}`);\n};\n\nexport const toDegrees = (rad: number) => {\n return (rad * 180) / Math.PI;\n};\n"]}
@@ -36,6 +36,10 @@ class JsiSkMatrix extends _Host.HostObject {
36
36
  this.ref.set(this.CanvasKit.Matrix.identity());
37
37
  }
38
38
 
39
+ get() {
40
+ return Array.from(this.ref);
41
+ }
42
+
39
43
  }
40
44
 
41
45
  exports.JsiSkMatrix = JsiSkMatrix;
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkMatrix.ts"],"names":["JsiSkMatrix","HostObject","constructor","CanvasKit","ref","concat","matrix","set","Matrix","multiply","fromValue","translate","x","y","Float32Array","of","translated","scale","scaled","skew","skewed","rotate","value","rotated","identity"],"mappings":";;;;;;;AAIA;;AAEO,MAAMA,WAAN,SACGC,gBADH,CAGP;AACEC,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAuC;AAChD,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;AACD;;AAEDC,EAAAA,MAAM,CAACC,MAAD,EAAmB;AACvB,SAAKF,GAAL,CAASG,GAAT,CACE,KAAKJ,SAAL,CAAeK,MAAf,CAAsBC,QAAtB,CAA+B,KAAKL,GAApC,EAAyCJ,WAAW,CAACU,SAAZ,CAAsBJ,MAAtB,CAAzC,CADF;AAGD;;AAEDK,EAAAA,SAAS,CAACC,CAAD,EAAYC,CAAZ,EAAuB;AAC9B,SAAKR,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBQ,UAAtB,CAAiCJ,CAAjC,EAAoCC,CAApC,CAAnB,CAFF,CADF;AAMD;;AAEDI,EAAAA,KAAK,CAACL,CAAD,EAAYC,CAAZ,EAAwB;AAC3B,SAAKR,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBU,MAAtB,CAA6BN,CAA7B,EAAgCC,CAAhC,aAAgCA,CAAhC,cAAgCA,CAAhC,GAAqCD,CAArC,CAAnB,CAFF,CADF;AAMD;;AAEDO,EAAAA,IAAI,CAACP,CAAD,EAAYC,CAAZ,EAAuB;AACzB,SAAKR,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBY,MAAtB,CAA6BR,CAA7B,EAAgCC,CAAhC,CAAnB,CAFF,CADF;AAMD;;AAEDQ,EAAAA,MAAM,CAACC,KAAD,EAAgB;AACpB,SAAKjB,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBe,OAAtB,CAA8BD,KAA9B,CAAnB,CAFF,CADF;AAMD;;AAEDE,EAAAA,QAAQ,GAAG;AACT,SAAKpB,GAAL,CAASG,GAAT,CAAa,KAAKJ,SAAL,CAAeK,MAAf,CAAsBgB,QAAtB,EAAb;AACD;;AAjDH","sourcesContent":["import type { CanvasKit, Matrix3x3 } from \"canvaskit-wasm\";\n\nimport type { SkMatrix } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkMatrix\n extends HostObject<Matrix3x3, \"Matrix\">\n implements SkMatrix\n{\n constructor(CanvasKit: CanvasKit, ref: Matrix3x3) {\n super(CanvasKit, ref, \"Matrix\");\n }\n\n concat(matrix: SkMatrix) {\n this.ref.set(\n this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))\n );\n }\n\n translate(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.translated(x, y))\n )\n );\n }\n\n scale(x: number, y?: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.scaled(x, y ?? x))\n )\n );\n }\n\n skew(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.skewed(x, y))\n )\n );\n }\n\n rotate(value: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.rotated(value))\n )\n );\n }\n\n identity() {\n this.ref.set(this.CanvasKit.Matrix.identity());\n }\n}\n"]}
1
+ {"version":3,"sources":["JsiSkMatrix.ts"],"names":["JsiSkMatrix","HostObject","constructor","CanvasKit","ref","concat","matrix","set","Matrix","multiply","fromValue","translate","x","y","Float32Array","of","translated","scale","scaled","skew","skewed","rotate","value","rotated","identity","get","Array","from"],"mappings":";;;;;;;AAIA;;AAEO,MAAMA,WAAN,SACGC,gBADH,CAGP;AACEC,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAuC;AAChD,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;AACD;;AAEDC,EAAAA,MAAM,CAACC,MAAD,EAAmB;AACvB,SAAKF,GAAL,CAASG,GAAT,CACE,KAAKJ,SAAL,CAAeK,MAAf,CAAsBC,QAAtB,CAA+B,KAAKL,GAApC,EAAyCJ,WAAW,CAACU,SAAZ,CAAsBJ,MAAtB,CAAzC,CADF;AAGD;;AAEDK,EAAAA,SAAS,CAACC,CAAD,EAAYC,CAAZ,EAAuB;AAC9B,SAAKR,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBQ,UAAtB,CAAiCJ,CAAjC,EAAoCC,CAApC,CAAnB,CAFF,CADF;AAMD;;AAEDI,EAAAA,KAAK,CAACL,CAAD,EAAYC,CAAZ,EAAwB;AAC3B,SAAKR,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBU,MAAtB,CAA6BN,CAA7B,EAAgCC,CAAhC,aAAgCA,CAAhC,cAAgCA,CAAhC,GAAqCD,CAArC,CAAnB,CAFF,CADF;AAMD;;AAEDO,EAAAA,IAAI,CAACP,CAAD,EAAYC,CAAZ,EAAuB;AACzB,SAAKR,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBY,MAAtB,CAA6BR,CAA7B,EAAgCC,CAAhC,CAAnB,CAFF,CADF;AAMD;;AAEDQ,EAAAA,MAAM,CAACC,KAAD,EAAgB;AACpB,SAAKjB,MAAL,CACE,IAAIL,WAAJ,CACE,KAAKG,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBe,OAAtB,CAA8BD,KAA9B,CAAnB,CAFF,CADF;AAMD;;AAEDE,EAAAA,QAAQ,GAAG;AACT,SAAKpB,GAAL,CAASG,GAAT,CAAa,KAAKJ,SAAL,CAAeK,MAAf,CAAsBgB,QAAtB,EAAb;AACD;;AAEDC,EAAAA,GAAG,GAAG;AACJ,WAAOC,KAAK,CAACC,IAAN,CAAW,KAAKvB,GAAhB,CAAP;AACD;;AArDH","sourcesContent":["import type { CanvasKit, Matrix3x3 } from \"canvaskit-wasm\";\n\nimport type { SkMatrix } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkMatrix\n extends HostObject<Matrix3x3, \"Matrix\">\n implements SkMatrix\n{\n constructor(CanvasKit: CanvasKit, ref: Matrix3x3) {\n super(CanvasKit, ref, \"Matrix\");\n }\n\n concat(matrix: SkMatrix) {\n this.ref.set(\n this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))\n );\n }\n\n translate(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.translated(x, y))\n )\n );\n }\n\n scale(x: number, y?: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.scaled(x, y ?? x))\n )\n );\n }\n\n skew(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.skewed(x, y))\n )\n );\n }\n\n rotate(value: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.rotated(value))\n )\n );\n }\n\n identity() {\n this.ref.set(this.CanvasKit.Matrix.identity());\n }\n\n get() {\n return Array.from(this.ref);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex","isMatrix","obj","__typename__","processTransform","m","transforms","transform","key","Object","keys","value","translate","scale","skew","rotate","toDegrees","exhaustiveCheck","a","Error","rad","Math","PI"],"mappings":"AAEA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W;;AAYZ,OAAO,MAAMC,QAAQ,GAAIC,GAAD,IACtBA,GAAG,KAAK,IAAR,IAAiBA,GAAD,CAA+BC,YAA/B,KAAgD,QAD3D;AA0CP,OAAO,MAAMC,gBAAgB,GAAG,CAC9BC,CAD8B,EAE9BC,UAF8B,KAG3B;AACH,OAAK,MAAMC,SAAX,IAAwBD,UAAxB,EAAoC;AAClC,UAAME,GAAG,GAAGC,MAAM,CAACC,IAAP,CAAYH,SAAZ,EAAuB,CAAvB,CAAZ;AACA,UAAMI,KAAK,GAAIJ,SAAD,CAAiDC,GAAjD,CAAd;;AACA,QAAIA,GAAG,KAAK,YAAZ,EAA0B;AACxBH,MAAAA,CAAC,CAACO,SAAF,CAAYD,KAAZ,EAAmB,CAAnB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,YAAZ,EAA0B;AAC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\nimport type { SkCanvas } from \"./Canvas\";\nexport enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n Persp2 = 8,\n}\n\nexport const isMatrix = (obj: unknown): obj is SkMatrix =>\n obj !== null && (obj as SkJSIInstance<string>).__typename__ === \"Matrix\";\n\nexport interface SkMatrix extends SkJSIInstance<\"Matrix\"> {\n concat: (matrix: SkMatrix) => void;\n translate: (x: number, y: number) => void;\n scale: (x: number, y?: number) => void;\n skew: (x: number, y: number) => void;\n rotate: (theta: number) => void;\n identity: () => void;\n}\n\ntype Transform2dName =\n | \"translateX\"\n | \"translateY\"\n | \"scale\"\n | \"skewX\"\n | \"skewY\"\n | \"scaleX\"\n | \"scaleY\"\n | \"rotateZ\"\n | \"rotate\";\n\ntype Transformations = {\n readonly [Name in Transform2dName]: number;\n};\n\nexport type Transforms2d = readonly (\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"rotate\">\n)[];\n\nexport interface TransformProp {\n transform?: Transforms2d;\n}\n\nexport const processTransform = <T extends SkMatrix | SkCanvas>(\n m: T,\n transforms: Transforms2d\n) => {\n for (const transform of transforms) {\n const key = Object.keys(transform)[0] as Transform2dName;\n const value = (transform as Pick<Transformations, typeof key>)[key];\n if (key === \"translateX\") {\n m.translate(value, 0);\n continue;\n }\n if (key === \"translateY\") {\n m.translate(0, value);\n continue;\n }\n if (key === \"scale\") {\n m.scale(value, value);\n continue;\n }\n if (key === \"scaleX\") {\n m.scale(value, 1);\n continue;\n }\n if (key === \"scaleY\") {\n m.scale(1, value);\n continue;\n }\n if (key === \"skewX\") {\n m.skew(value, 0);\n continue;\n }\n if (key === \"skewY\") {\n m.skew(0, value);\n continue;\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n if (isMatrix(m)) {\n m.rotate(value);\n } else {\n m.rotate(toDegrees(value), 0, 0);\n }\n continue;\n }\n exhaustiveCheck(key);\n }\n return m;\n};\n\nconst exhaustiveCheck = (a: never): never => {\n throw new Error(`Unknown transformation: ${a}`);\n};\n\nexport const toDegrees = (rad: number) => {\n return (rad * 180) / Math.PI;\n};\n"]}
1
+ {"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex","isMatrix","obj","__typename__","processTransform","m","transforms","transform","key","Object","keys","value","translate","scale","skew","rotate","toDegrees","exhaustiveCheck","a","Error","rad","Math","PI"],"mappings":"AAEA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W;;AAYZ,OAAO,MAAMC,QAAQ,GAAIC,GAAD,IACtBA,GAAG,KAAK,IAAR,IAAiBA,GAAD,CAA+BC,YAA/B,KAAgD,QAD3D;AA2CP,OAAO,MAAMC,gBAAgB,GAAG,CAC9BC,CAD8B,EAE9BC,UAF8B,KAG3B;AACH,OAAK,MAAMC,SAAX,IAAwBD,UAAxB,EAAoC;AAClC,UAAME,GAAG,GAAGC,MAAM,CAACC,IAAP,CAAYH,SAAZ,EAAuB,CAAvB,CAAZ;AACA,UAAMI,KAAK,GAAIJ,SAAD,CAAiDC,GAAjD,CAAd;;AACA,QAAIA,GAAG,KAAK,YAAZ,EAA0B;AACxBH,MAAAA,CAAC,CAACO,SAAF,CAAYD,KAAZ,EAAmB,CAAnB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,YAAZ,EAA0B;AACxBH,MA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SkCanvas } from \"./Canvas\";\nexport enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n Persp2 = 8,\n}\n\nexport const isMatrix = (obj: unknown): obj is SkMatrix =>\n obj !== null && (obj as SkJSIInstance<string>).__typename__ === \"Matrix\";\n\nexport interface SkMatrix extends SkJSIInstance<\"Matrix\"> {\n concat: (matrix: SkMatrix) => void;\n translate: (x: number, y: number) => void;\n scale: (x: number, y?: number) => void;\n skew: (x: number, y: number) => void;\n rotate: (theta: number) => void;\n identity: () => void;\n get: () => number[];\n}\n\ntype Transform2dName =\n | \"translateX\"\n | \"translateY\"\n | \"scale\"\n | \"skewX\"\n | \"skewY\"\n | \"scaleX\"\n | \"scaleY\"\n | \"rotateZ\"\n | \"rotate\";\n\ntype Transformations = {\n readonly [Name in Transform2dName]: number;\n};\n\nexport type Transforms2d = readonly (\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"rotate\">\n)[];\n\nexport interface TransformProp {\n transform?: Transforms2d;\n}\n\nexport const processTransform = <T extends SkMatrix | SkCanvas>(\n m: T,\n transforms: Transforms2d\n) => {\n for (const transform of transforms) {\n const key = Object.keys(transform)[0] as Transform2dName;\n const value = (transform as Pick<Transformations, typeof key>)[key];\n if (key === \"translateX\") {\n m.translate(value, 0);\n continue;\n }\n if (key === \"translateY\") {\n m.translate(0, value);\n continue;\n }\n if (key === \"scale\") {\n m.scale(value, value);\n continue;\n }\n if (key === \"scaleX\") {\n m.scale(value, 1);\n continue;\n }\n if (key === \"scaleY\") {\n m.scale(1, value);\n continue;\n }\n if (key === \"skewX\") {\n m.skew(value, 0);\n continue;\n }\n if (key === \"skewY\") {\n m.skew(0, value);\n continue;\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n if (isMatrix(m)) {\n m.rotate(value);\n } else {\n m.rotate(toDegrees(value), 0, 0);\n }\n continue;\n }\n exhaustiveCheck(key);\n }\n return m;\n};\n\nconst exhaustiveCheck = (a: never): never => {\n throw new Error(`Unknown transformation: ${a}`);\n};\n\nexport const toDegrees = (rad: number) => {\n return (rad * 180) / Math.PI;\n};\n"]}
@@ -28,5 +28,9 @@ export class JsiSkMatrix extends HostObject {
28
28
  this.ref.set(this.CanvasKit.Matrix.identity());
29
29
  }
30
30
 
31
+ get() {
32
+ return Array.from(this.ref);
33
+ }
34
+
31
35
  }
32
36
  //# sourceMappingURL=JsiSkMatrix.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkMatrix.ts"],"names":["HostObject","JsiSkMatrix","constructor","CanvasKit","ref","concat","matrix","set","Matrix","multiply","fromValue","translate","x","y","Float32Array","of","translated","scale","scaled","skew","skewed","rotate","value","rotated","identity"],"mappings":"AAIA,SAASA,UAAT,QAA2B,QAA3B;AAEA,OAAO,MAAMC,WAAN,SACGD,UADH,CAGP;AACEE,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAuC;AAChD,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;AACD;;AAEDC,EAAAA,MAAM,CAACC,MAAD,EAAmB;AACvB,SAAKF,GAAL,CAASG,GAAT,CACE,KAAKJ,SAAL,CAAeK,MAAf,CAAsBC,QAAtB,CAA+B,KAAKL,GAApC,EAAyCH,WAAW,CAACS,SAAZ,CAAsBJ,MAAtB,CAAzC,CADF;AAGD;;AAEDK,EAAAA,SAAS,CAACC,CAAD,EAAYC,CAAZ,EAAuB;AAC9B,SAAKR,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBQ,UAAtB,CAAiCJ,CAAjC,EAAoCC,CAApC,CAAnB,CAFF,CADF;AAMD;;AAEDI,EAAAA,KAAK,CAACL,CAAD,EAAYC,CAAZ,EAAwB;AAC3B,SAAKR,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBU,MAAtB,CAA6BN,CAA7B,EAAgCC,CAAhC,aAAgCA,CAAhC,cAAgCA,CAAhC,GAAqCD,CAArC,CAAnB,CAFF,CADF;AAMD;;AAEDO,EAAAA,IAAI,CAACP,CAAD,EAAYC,CAAZ,EAAuB;AACzB,SAAKR,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBY,MAAtB,CAA6BR,CAA7B,EAAgCC,CAAhC,CAAnB,CAFF,CADF;AAMD;;AAEDQ,EAAAA,MAAM,CAACC,KAAD,EAAgB;AACpB,SAAKjB,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBe,OAAtB,CAA8BD,KAA9B,CAAnB,CAFF,CADF;AAMD;;AAEDE,EAAAA,QAAQ,GAAG;AACT,SAAKpB,GAAL,CAASG,GAAT,CAAa,KAAKJ,SAAL,CAAeK,MAAf,CAAsBgB,QAAtB,EAAb;AACD;;AAjDH","sourcesContent":["import type { CanvasKit, Matrix3x3 } from \"canvaskit-wasm\";\n\nimport type { SkMatrix } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkMatrix\n extends HostObject<Matrix3x3, \"Matrix\">\n implements SkMatrix\n{\n constructor(CanvasKit: CanvasKit, ref: Matrix3x3) {\n super(CanvasKit, ref, \"Matrix\");\n }\n\n concat(matrix: SkMatrix) {\n this.ref.set(\n this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))\n );\n }\n\n translate(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.translated(x, y))\n )\n );\n }\n\n scale(x: number, y?: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.scaled(x, y ?? x))\n )\n );\n }\n\n skew(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.skewed(x, y))\n )\n );\n }\n\n rotate(value: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.rotated(value))\n )\n );\n }\n\n identity() {\n this.ref.set(this.CanvasKit.Matrix.identity());\n }\n}\n"]}
1
+ {"version":3,"sources":["JsiSkMatrix.ts"],"names":["HostObject","JsiSkMatrix","constructor","CanvasKit","ref","concat","matrix","set","Matrix","multiply","fromValue","translate","x","y","Float32Array","of","translated","scale","scaled","skew","skewed","rotate","value","rotated","identity","get","Array","from"],"mappings":"AAIA,SAASA,UAAT,QAA2B,QAA3B;AAEA,OAAO,MAAMC,WAAN,SACGD,UADH,CAGP;AACEE,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAuC;AAChD,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;AACD;;AAEDC,EAAAA,MAAM,CAACC,MAAD,EAAmB;AACvB,SAAKF,GAAL,CAASG,GAAT,CACE,KAAKJ,SAAL,CAAeK,MAAf,CAAsBC,QAAtB,CAA+B,KAAKL,GAApC,EAAyCH,WAAW,CAACS,SAAZ,CAAsBJ,MAAtB,CAAzC,CADF;AAGD;;AAEDK,EAAAA,SAAS,CAACC,CAAD,EAAYC,CAAZ,EAAuB;AAC9B,SAAKR,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBQ,UAAtB,CAAiCJ,CAAjC,EAAoCC,CAApC,CAAnB,CAFF,CADF;AAMD;;AAEDI,EAAAA,KAAK,CAACL,CAAD,EAAYC,CAAZ,EAAwB;AAC3B,SAAKR,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBU,MAAtB,CAA6BN,CAA7B,EAAgCC,CAAhC,aAAgCA,CAAhC,cAAgCA,CAAhC,GAAqCD,CAArC,CAAnB,CAFF,CADF;AAMD;;AAEDO,EAAAA,IAAI,CAACP,CAAD,EAAYC,CAAZ,EAAuB;AACzB,SAAKR,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBY,MAAtB,CAA6BR,CAA7B,EAAgCC,CAAhC,CAAnB,CAFF,CADF;AAMD;;AAEDQ,EAAAA,MAAM,CAACC,KAAD,EAAgB;AACpB,SAAKjB,MAAL,CACE,IAAIJ,WAAJ,CACE,KAAKE,SADP,EAEEW,YAAY,CAACC,EAAb,CAAgB,GAAG,KAAKZ,SAAL,CAAeK,MAAf,CAAsBe,OAAtB,CAA8BD,KAA9B,CAAnB,CAFF,CADF;AAMD;;AAEDE,EAAAA,QAAQ,GAAG;AACT,SAAKpB,GAAL,CAASG,GAAT,CAAa,KAAKJ,SAAL,CAAeK,MAAf,CAAsBgB,QAAtB,EAAb;AACD;;AAEDC,EAAAA,GAAG,GAAG;AACJ,WAAOC,KAAK,CAACC,IAAN,CAAW,KAAKvB,GAAhB,CAAP;AACD;;AArDH","sourcesContent":["import type { CanvasKit, Matrix3x3 } from \"canvaskit-wasm\";\n\nimport type { SkMatrix } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkMatrix\n extends HostObject<Matrix3x3, \"Matrix\">\n implements SkMatrix\n{\n constructor(CanvasKit: CanvasKit, ref: Matrix3x3) {\n super(CanvasKit, ref, \"Matrix\");\n }\n\n concat(matrix: SkMatrix) {\n this.ref.set(\n this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))\n );\n }\n\n translate(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.translated(x, y))\n )\n );\n }\n\n scale(x: number, y?: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.scaled(x, y ?? x))\n )\n );\n }\n\n skew(x: number, y: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.skewed(x, y))\n )\n );\n }\n\n rotate(value: number) {\n this.concat(\n new JsiSkMatrix(\n this.CanvasKit,\n Float32Array.of(...this.CanvasKit.Matrix.rotated(value))\n )\n );\n }\n\n identity() {\n this.ref.set(this.CanvasKit.Matrix.identity());\n }\n\n get() {\n return Array.from(this.ref);\n }\n}\n"]}
@@ -19,6 +19,7 @@ export interface SkMatrix extends SkJSIInstance<"Matrix"> {
19
19
  skew: (x: number, y: number) => void;
20
20
  rotate: (theta: number) => void;
21
21
  identity: () => void;
22
+ get: () => number[];
22
23
  }
23
24
  declare type Transform2dName = "translateX" | "translateY" | "scale" | "skewX" | "skewY" | "scaleX" | "scaleY" | "rotateZ" | "rotate";
24
25
  declare type Transformations = {
@@ -9,4 +9,5 @@ export declare class JsiSkMatrix extends HostObject<Matrix3x3, "Matrix"> impleme
9
9
  skew(x: number, y: number): void;
10
10
  rotate(value: number): void;
11
11
  identity(): void;
12
+ get(): number[];
12
13
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "0.1.146",
10
+ "version": "0.1.147",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [
@@ -22,6 +22,7 @@ export interface SkMatrix extends SkJSIInstance<"Matrix"> {
22
22
  skew: (x: number, y: number) => void;
23
23
  rotate: (theta: number) => void;
24
24
  identity: () => void;
25
+ get: () => number[];
25
26
  }
26
27
 
27
28
  type Transform2dName =
@@ -57,4 +57,8 @@ export class JsiSkMatrix
57
57
  identity() {
58
58
  this.ref.set(this.CanvasKit.Matrix.identity());
59
59
  }
60
+
61
+ get() {
62
+ return Array.from(this.ref);
63
+ }
60
64
  }