@shopify/react-native-skia 0.1.230 → 0.1.232
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +1 -0
- package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +2 -2
- package/cpp/api/JsiSkAnimatedImage.h +1 -1
- package/cpp/api/JsiSkDataFactory.h +6 -6
- package/cpp/api/JsiSkImage.h +4 -4
- package/cpp/api/JsiSkPath.h +1 -1
- package/cpp/api/JsiSkRRect.h +30 -3
- package/cpp/api/third_party/base64.cpp +153 -0
- package/cpp/api/third_party/base64.h +50 -0
- package/cpp/jsi/JsiPromises.h +1 -1
- package/cpp/rnskia/dom/props/FontProp.h +2 -4
- package/cpp/rnskia/dom/props/RRectProp.h +50 -0
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +2 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +1 -1
- package/lib/commonjs/dom/nodes/drawings/RRectNode.d.ts +3 -3
- package/lib/commonjs/dom/nodes/drawings/RRectNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Text.js +1 -11
- package/lib/commonjs/dom/nodes/drawings/Text.js.map +1 -1
- package/lib/commonjs/dom/types/Common.d.ts +2 -2
- package/lib/commonjs/dom/types/Common.js.map +1 -1
- package/lib/commonjs/dom/types/Drawings.d.ts +1 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +3 -1
- package/lib/commonjs/headless/index.js +12 -6
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/skia/types/Canvas.d.ts +4 -4
- package/lib/commonjs/skia/types/Canvas.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +5 -0
- package/lib/commonjs/skia/types/Matrix4.js +8 -3
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/skia/types/Paragraph/Paragraph.d.ts +2 -2
- package/lib/commonjs/skia/types/Paragraph/Paragraph.js.map +1 -1
- package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.d.ts +6 -6
- package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.js +25 -25
- package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.d.ts +2 -2
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/types/RRect.d.ts +9 -0
- package/lib/commonjs/skia/types/RRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +4 -4
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraphStyle.js +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraphStyle.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRRect.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkRRect.js +4 -0
- package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/commonjs/web/LoadSkiaWeb.js +4 -1
- package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +2 -1
- package/lib/module/dom/nodes/datatypes/Rect.d.ts +1 -1
- package/lib/module/dom/nodes/drawings/RRectNode.d.ts +3 -3
- package/lib/module/dom/nodes/drawings/RRectNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Text.js +1 -11
- package/lib/module/dom/nodes/drawings/Text.js.map +1 -1
- package/lib/module/dom/types/Common.d.ts +2 -2
- package/lib/module/dom/types/Common.js.map +1 -1
- package/lib/module/dom/types/Drawings.d.ts +1 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/headless/index.d.ts +3 -1
- package/lib/module/headless/index.js +5 -3
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/skia/types/Canvas.d.ts +4 -4
- package/lib/module/skia/types/Canvas.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +5 -0
- package/lib/module/skia/types/Matrix4.js +6 -4
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/skia/types/Paragraph/Paragraph.d.ts +2 -2
- package/lib/module/skia/types/Paragraph/Paragraph.js.map +1 -1
- package/lib/module/skia/types/Paragraph/ParagraphStyle.d.ts +6 -6
- package/lib/module/skia/types/Paragraph/ParagraphStyle.js +21 -21
- package/lib/module/skia/types/Paragraph/ParagraphStyle.js.map +1 -1
- package/lib/module/skia/types/Path/Path.d.ts +2 -2
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/types/RRect.d.ts +9 -0
- package/lib/module/skia/types/RRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.d.ts +4 -4
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphStyle.js +2 -2
- package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +2 -2
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.d.ts +2 -2
- package/lib/module/skia/web/JsiSkRRect.js +4 -0
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/web/LoadSkiaWeb.js +5 -1
- package/lib/module/web/LoadSkiaWeb.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -1
- package/lib/typescript/src/dom/nodes/datatypes/Rect.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/drawings/RRectNode.d.ts +3 -3
- package/lib/typescript/src/dom/types/Common.d.ts +2 -2
- package/lib/typescript/src/dom/types/Drawings.d.ts +1 -1
- package/lib/typescript/src/headless/index.d.ts +3 -1
- package/lib/typescript/src/skia/types/Canvas.d.ts +4 -4
- package/lib/typescript/src/skia/types/Matrix4.d.ts +5 -0
- package/lib/typescript/src/skia/types/Paragraph/Paragraph.d.ts +2 -2
- package/lib/typescript/src/skia/types/Paragraph/ParagraphStyle.d.ts +6 -6
- package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -2
- package/lib/typescript/src/skia/types/RRect.d.ts +9 -0
- package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +4 -4
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +2 -2
- package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +2 -2
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +5 -5
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/src/dom/nodes/drawings/RRectNode.ts +2 -2
- package/src/dom/nodes/drawings/Text.ts +1 -14
- package/src/dom/types/Common.ts +2 -1
- package/src/dom/types/Drawings.ts +1 -1
- package/src/headless/index.ts +7 -3
- package/src/skia/types/Canvas.ts +4 -4
- package/src/skia/types/Matrix4.ts +8 -6
- package/src/skia/types/Paragraph/Paragraph.ts +2 -2
- package/src/skia/types/Paragraph/ParagraphStyle.ts +6 -6
- package/src/skia/types/Path/Path.ts +2 -2
- package/src/skia/types/RRect.ts +11 -0
- package/src/skia/web/JsiSkCanvas.ts +4 -4
- package/src/skia/web/JsiSkParagraphStyle.ts +2 -2
- package/src/skia/web/JsiSkPath.ts +2 -2
- package/src/skia/web/JsiSkRRect.ts +23 -2
- package/src/web/LoadSkiaWeb.tsx +4 -1
@@ -1,7 +1,16 @@
|
|
1
|
+
import type { SkPoint } from "./Point";
|
1
2
|
import type { SkRect } from "./Rect";
|
2
3
|
export interface SkRRect {
|
3
4
|
readonly rect: SkRect;
|
4
5
|
readonly rx: number;
|
5
6
|
readonly ry: number;
|
6
7
|
}
|
8
|
+
export interface NonUniformRRect {
|
9
|
+
readonly rect: SkRect;
|
10
|
+
readonly topLeft: SkPoint;
|
11
|
+
readonly topRight: SkPoint;
|
12
|
+
readonly bottomRight: SkPoint;
|
13
|
+
readonly bottomLeft: SkPoint;
|
14
|
+
}
|
15
|
+
export type InputRRect = SkRRect | NonUniformRRect;
|
7
16
|
export declare const isRRect: (def: SkRect | SkRRect) => def is SkRRect;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isRRect","def","rect","undefined"],"sources":["RRect.ts"],"sourcesContent":["import type { SkRect } from \"./Rect\";\n\nexport interface SkRRect {\n readonly rect: SkRect;\n readonly rx: number;\n readonly ry: number;\n}\n\n// We have an issue to check property existence on JSI backed instances\nexport const isRRect = (def: SkRect | SkRRect): def is SkRRect =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (def as any).rect !== undefined;\n"],"mappings":";;;;;;;
|
1
|
+
{"version":3,"names":["isRRect","def","rect","undefined"],"sources":["RRect.ts"],"sourcesContent":["import type { SkPoint } from \"./Point\";\nimport type { SkRect } from \"./Rect\";\n\nexport interface SkRRect {\n readonly rect: SkRect;\n readonly rx: number;\n readonly ry: number;\n}\n\nexport interface NonUniformRRect {\n readonly rect: SkRect;\n readonly topLeft: SkPoint;\n readonly topRight: SkPoint;\n readonly bottomRight: SkPoint;\n readonly bottomLeft: SkPoint;\n}\n\nexport type InputRRect = SkRRect | NonUniformRRect;\n\n// We have an issue to check property existence on JSI backed instances\nexport const isRRect = (def: SkRect | SkRRect): def is SkRRect =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (def as any).rect !== undefined;\n"],"mappings":";;;;;;;AAmBA;AACO,MAAMA,OAAO,GAAIC,GAAD,IACrB;AACCA,GAAD,CAAaC,IAAb,KAAsBC,SAFjB"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Canvas, CanvasKit } from "canvaskit-wasm";
|
2
|
-
import type { BlendMode, ClipOp, FilterMode, MipmapMode, PointMode, SaveLayerFlag, ImageInfo, SkCanvas, SkColor, SkFont, SkImage, SkImageFilter, SkMatrix, SkPaint, SkPath, SkPicture, SkPoint, SkRect,
|
2
|
+
import type { BlendMode, ClipOp, FilterMode, MipmapMode, PointMode, SaveLayerFlag, ImageInfo, SkCanvas, SkColor, SkFont, SkImage, SkImageFilter, SkMatrix, SkPaint, SkPath, SkPicture, SkPoint, SkRect, InputRRect, SkSVG, SkTextBlob, SkVertices } from "../types";
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements SkCanvas {
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: Canvas);
|
@@ -20,8 +20,8 @@ export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements
|
|
20
20
|
restoreToCount(saveCount: number): void;
|
21
21
|
drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint): void;
|
22
22
|
drawArc(oval: SkRect, startAngle: number, sweepAngle: number, useCenter: boolean, paint: SkPaint): void;
|
23
|
-
drawRRect(rrect:
|
24
|
-
drawDRRect(outer:
|
23
|
+
drawRRect(rrect: InputRRect, paint: SkPaint): void;
|
24
|
+
drawDRRect(outer: InputRRect, inner: InputRRect, paint: SkPaint): void;
|
25
25
|
drawOval(oval: SkRect, paint: SkPaint): void;
|
26
26
|
drawPath(path: SkPath, paint: SkPaint): void;
|
27
27
|
drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont): void;
|
@@ -39,7 +39,7 @@ export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements
|
|
39
39
|
clear(color: SkColor): void;
|
40
40
|
clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean): void;
|
41
41
|
clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean): void;
|
42
|
-
clipRRect(rrect:
|
42
|
+
clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean): void;
|
43
43
|
concat(m: SkMatrix | number[]): void;
|
44
44
|
drawPicture(skp: SkPicture): void;
|
45
45
|
readPixels(srcX: number, srcY: number, imageInfo: ImageInfo): Float32Array | Uint8Array | null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkCanvas","HostObject","constructor","CanvasKit","ref","delete","drawRect","rect","paint","JsiSkRect","fromValue","JsiSkPaint","drawImage","image","x","y","JsiSkImage","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","getEnum","FilterMode","MipmapMode","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","JsiSkVertices","BlendMode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","JsiSkPoint","undefined","restoreToCount","saveCount","drawPoints","points","PointMode","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","JsiSkRRect","drawDRRect","outer","inner","drawOval","drawPath","path","JsiSkPath","drawText","str","font","JsiSkFont","drawTextBlob","blob","JsiSkTextBlob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","JsiSkImageFilter","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","PathOp","clipRect","clipRRect","concat","m","isArray","JsiSkMatrix","drawPicture","skp","JsiSkPicture","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","AlphaType","colorType","ColorType"],"sources":["JsiSkCanvas.ts"],"sourcesContent":["import type { Canvas, CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n ImageInfo,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n SkRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n getEnum(this.CanvasKit.BlendMode, mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? getEnum(this.CanvasKit.BlendMode, mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n getEnum(this.CanvasKit.PointMode, mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: SkRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(\n color,\n blendMode ? getEnum(this.CanvasKit.BlendMode, blendMode) : undefined\n );\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix | number[]) {\n this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n\n readPixels(srcX: number, srcY: number, imageInfo: ImageInfo) {\n const pxInfo = {\n width: imageInfo.width,\n height: imageInfo.height,\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n alphaType: getEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),\n colorType: getEnum(this.CanvasKit.ColorType, imageInfo.colorType),\n };\n return this.ref.readPixels(srcX, srcY, pxInfo);\n }\n}\n"],"mappings":";;;;;;;AA2BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEO,MAAMA,WAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAoC;IAC7C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;;IAD6C,iCAIrC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAN8C;EAE9C;;EAMDC,QAAQ,CAACC,IAAD,EAAeC,KAAf,EAA+B;IACrC,KAAKJ,GAAL,CAASE,QAAT,CACEG,oBAAA,CAAUC,SAAV,CAAoB,KAAKP,SAAzB,EAAoCI,IAApC,CADF,EAEEI,sBAAA,CAAWD,SAAX,CAAqBF,KAArB,CAFF;EAID;;EAEDI,SAAS,CAACC,KAAD,EAAiBC,CAAjB,EAA4BC,CAA5B,EAAuCP,KAAvC,EAAwD;IAC/D,KAAKJ,GAAL,CAASQ,SAAT,CACEI,sBAAA,CAAWN,SAAX,CAAqBG,KAArB,CADF,EAEEC,CAFF,EAGEC,CAHF,EAIEP,KAAK,GAAGG,sBAAA,CAAWD,SAAX,CAAqBF,KAArB,CAAH,GAAiCA,KAJxC;EAM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"names":["JsiSkCanvas","HostObject","constructor","CanvasKit","ref","delete","drawRect","rect","paint","JsiSkRect","fromValue","JsiSkPaint","drawImage","image","x","y","JsiSkImage","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","getEnum","FilterMode","MipmapMode","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","JsiSkVertices","BlendMode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","JsiSkPoint","undefined","restoreToCount","saveCount","drawPoints","points","PointMode","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","JsiSkRRect","drawDRRect","outer","inner","drawOval","drawPath","path","JsiSkPath","drawText","str","font","JsiSkFont","drawTextBlob","blob","JsiSkTextBlob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","JsiSkImageFilter","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","PathOp","clipRect","clipRRect","concat","m","isArray","JsiSkMatrix","drawPicture","skp","JsiSkPicture","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","AlphaType","colorType","ColorType"],"sources":["JsiSkCanvas.ts"],"sourcesContent":["import type { Canvas, CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n ImageInfo,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n InputRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n getEnum(this.CanvasKit.BlendMode, mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? getEnum(this.CanvasKit.BlendMode, mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n getEnum(this.CanvasKit.PointMode, mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: InputRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: InputRRect, inner: InputRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(\n color,\n blendMode ? getEnum(this.CanvasKit.BlendMode, blendMode) : undefined\n );\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix | number[]) {\n this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n\n readPixels(srcX: number, srcY: number, imageInfo: ImageInfo) {\n const pxInfo = {\n width: imageInfo.width,\n height: imageInfo.height,\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n alphaType: getEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),\n colorType: getEnum(this.CanvasKit.ColorType, imageInfo.colorType),\n };\n return this.ref.readPixels(srcX, srcY, pxInfo);\n }\n}\n"],"mappings":";;;;;;;AA2BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEO,MAAMA,WAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAoC;IAC7C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;;IAD6C,iCAIrC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAN8C;EAE9C;;EAMDC,QAAQ,CAACC,IAAD,EAAeC,KAAf,EAA+B;IACrC,KAAKJ,GAAL,CAASE,QAAT,CACEG,oBAAA,CAAUC,SAAV,CAAoB,KAAKP,SAAzB,EAAoCI,IAApC,CADF,EAEEI,sBAAA,CAAW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Q,KAAK3B,SAAL,CAAe+I,SAAvB,EAAkCR,SAAS,CAACO,SAA5C,CAJE;MAKbE,SAAS,EAAE,IAAArH,aAAA,EAAQ,KAAK3B,SAAL,CAAeiJ,SAAvB,EAAkCV,SAAS,CAACS,SAA5C;IALE,CAAf;IAOA,OAAO,KAAK/I,GAAL,CAASmI,UAAT,CAAoBC,IAApB,EAA0BC,IAA1B,EAAgCE,MAAhC,CAAP;EACD;;AA9VH"}
|
@@ -27,7 +27,7 @@ class JsiSkParagraphStyle {
|
|
27
27
|
value: value.textAlign
|
28
28
|
} : undefined ?? ps.textAlign;
|
29
29
|
ps.textDirection = value.textDirection !== undefined ? {
|
30
|
-
value: value.textDirection === _types.
|
30
|
+
value: value.textDirection === _types.TextDirection.LTR ? 1 : 0
|
31
31
|
} : ps.textDirection;
|
32
32
|
ps.textHeightBehavior = value.textHeightBehavior !== undefined ? {
|
33
33
|
value: value.textHeightBehavior
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkParagraphStyle","toParagraphStyle","ck","value","ps","ParagraphStyle","textStyle","color","BLACK","disableHinting","ellipsis","heightMultiplier","maxLines","replaceTabCharacters","textAlign","undefined","textDirection","
|
1
|
+
{"version":3,"names":["JsiSkParagraphStyle","toParagraphStyle","ck","value","ps","ParagraphStyle","textStyle","color","BLACK","disableHinting","ellipsis","heightMultiplier","maxLines","replaceTabCharacters","textAlign","undefined","textDirection","TextDirection","LTR","textHeightBehavior","strutStyle","fontFamilies","fontSize","leading","forceStrutHeight","fontStyle","slant","width","weight","halfLeading","strutEnabled"],"sources":["JsiSkParagraphStyle.ts"],"sourcesContent":["import type { CanvasKit, ParagraphStyle } from \"canvaskit-wasm\";\n\nimport { TextDirection, type SkParagraphStyle } from \"../types\";\n\nexport class JsiSkParagraphStyle {\n static toParagraphStyle(\n ck: CanvasKit,\n value: SkParagraphStyle\n ): ParagraphStyle {\n // Seems like we need to provide the textStyle.color value, otherwise\n // the constructor crashes.\n const ps = new ck.ParagraphStyle({ textStyle: { color: ck.BLACK } });\n\n ps.disableHinting = value.disableHinting ?? ps.disableHinting;\n ps.ellipsis = value.ellipsis ?? ps.ellipsis;\n ps.heightMultiplier = value.heightMultiplier ?? ps.heightMultiplier;\n ps.maxLines = value.maxLines ?? ps.maxLines;\n ps.replaceTabCharacters =\n value.replaceTabCharacters ?? ps.replaceTabCharacters;\n ps.textAlign =\n value.textAlign !== undefined\n ? { value: value.textAlign }\n : undefined ?? ps.textAlign;\n ps.textDirection =\n value.textDirection !== undefined\n ? { value: value.textDirection === TextDirection.LTR ? 1 : 0 }\n : ps.textDirection;\n ps.textHeightBehavior =\n value.textHeightBehavior !== undefined\n ? { value: value.textHeightBehavior }\n : ps.textHeightBehavior;\n\n ps.strutStyle = ps.strutStyle ?? {};\n ps.strutStyle.fontFamilies =\n value.strutStyle?.fontFamilies ?? ps.strutStyle.fontFamilies;\n ps.strutStyle.fontSize =\n value.strutStyle?.fontSize ?? ps.strutStyle.fontSize;\n ps.strutStyle.heightMultiplier =\n value.strutStyle?.heightMultiplier ?? ps.strutStyle.heightMultiplier;\n ps.strutStyle.leading = value.strutStyle?.leading ?? ps.strutStyle.leading;\n ps.strutStyle.forceStrutHeight =\n value.strutStyle?.forceStrutHeight ?? ps.strutStyle.forceStrutHeight;\n\n ps.strutStyle.fontStyle = ps.strutStyle.fontStyle ?? {};\n\n ps.strutStyle.fontStyle.slant =\n value.strutStyle?.fontStyle?.slant !== undefined\n ? { value: value.strutStyle.fontStyle.slant }\n : ps.strutStyle.fontStyle.slant;\n ps.strutStyle.fontStyle.width =\n value.strutStyle?.fontStyle?.width !== undefined\n ? { value: value.strutStyle.fontStyle.width }\n : ps.strutStyle.fontStyle.width;\n ps.strutStyle.fontStyle.weight =\n value.strutStyle?.fontStyle?.weight !== undefined\n ? { value: value.strutStyle.fontStyle.weight }\n : ps.strutStyle.fontStyle.weight;\n ps.strutStyle.halfLeading =\n value.strutStyle?.halfLeading ?? ps.strutStyle.halfLeading;\n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AA6BE,KAA7B,MAAuCZ,SAAvC,GACI;MAAEZ,KAAK,EAAEA,KAAK,CAACiB,UAAN,CAAiBK,SAAjB,CAA2BE;IAApC,CADJ,GAEIvB,EAAE,CAACgB,UAAH,CAAcK,SAAd,CAAwBE,KAH9B;IAIAvB,EAAE,CAACgB,UAAH,CAAcK,SAAd,CAAwBG,MAAxB,GACE,uBAAAzB,KAAK,CAACiB,UAAN,mGAAkBK,SAAlB,gFAA6BG,MAA7B,MAAwCb,SAAxC,GACI;MAAEZ,KAAK,EAAEA,KAAK,CAACiB,UAAN,CAAiBK,SAAjB,CAA2BG;IAApC,CADJ,GAEIxB,EAAE,CAACgB,UAAH,CAAcK,SAAd,CAAwBG,MAH9B;IAIAxB,EAAE,CAACgB,UAAH,CAAcS,WAAd,GACE,uBAAA1B,KAAK,CAACiB,UAAN,0EAAkBS,WAAlB,KAAiCzB,EAAE,CAACgB,UAAH,CAAcS,WADjD;IAEAzB,EAAE,CAACgB,UAAH,CAAcU,YAAd,GACE,wBAAA3B,KAAK,CAACiB,UAAN,4EAAkBU,YAAlB,KAAkC1B,EAAE,CAACgB,UAAH,CAAcU,YADlD;IAGA,OAAO1B,EAAP;EACD;;AA3D8B"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { CanvasKit, Path } from "canvaskit-wasm";
|
2
|
-
import type { FillType, PathCommand, PathOp, SkMatrix, SkPath, SkPoint, SkRect,
|
2
|
+
import type { FillType, PathCommand, PathOp, SkMatrix, SkPath, SkPoint, SkRect, InputRRect, StrokeOpts } from "../types";
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
import { JsiSkPoint } from "./JsiSkPoint";
|
5
5
|
import { JsiSkRect } from "./JsiSkRect";
|
@@ -41,7 +41,7 @@ export declare class JsiSkPath extends HostObject<Path, "Path"> implements SkPat
|
|
41
41
|
getFillType(): number;
|
42
42
|
quadTo(x1: number, y1: number, x2: number, y2: number): this;
|
43
43
|
addRect(rect: SkRect, isCCW?: boolean): this;
|
44
|
-
addRRect(rrect:
|
44
|
+
addRRect(rrect: InputRRect, isCCW?: boolean): this;
|
45
45
|
getPoint(index: number): JsiSkPoint;
|
46
46
|
isEmpty(): boolean;
|
47
47
|
isVolatile(): boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["CommandCount","PathVerb","Move","Line","Quad","Conic","Cubic","Close","pinT","t","Math","min","max","JsiSkPath","HostObject","constructor","CanvasKit","ref","delete","addPath","src","matrix","extend","args","fromValue","JsiSkMatrix","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","JsiSkRect","addOval","isCCW","startIndex","countPoints","addPoly","points","close","map","p","Array","from","JsiSkPoint","flat","moveTo","x","y","lineTo","makeAsWinding","result","offset","dx","dy","rArcTo","rx","ry","xAxisRotateInDegrees","useSmallArc","rConicTo","dx1","dy1","dx2","dy2","w","rCubicTo","cpx1","cpy1","cpx2","cpy2","rMoveTo","rLineTo","rQuadTo","x1","y1","x2","y2","setFillType","fill","getEnum","FillType","setIsVolatile","volatile","stroke","opts","undefined","width","miter_limit","precision","join","optEnum","StrokeJoin","cap","StrokeCap","reset","rewind","computeTightBounds","arcToOval","forceMoveTo","arcToRotated","arcToTangent","radius","conicTo","contains","copy","cubicTo","dash","on","off","phase","equals","other","getBounds","getFillType","value","quadTo","addRect","rect","addRRect","rrect","JsiSkRRect","getPoint","index","isEmpty","isVolatile","addCircle","r","getLastPt","op","path","PathOp","simplify","toSVGString","trim","start","stop","isComplement","startT","stopT","transform","m3","isArray","interpolate","end","output","Path","MakeFromPathInterpolation","isInterpolatable","path2","CanInterpolate","toCmds","cmds","reduce","acc","cmd","i","push","current","length"],"sources":["JsiSkPath.ts"],"sourcesContent":["import type { CanvasKit, Path } from \"canvaskit-wasm\";\n\nimport { PathVerb } from \"../types\";\nimport type {\n FillType,\n PathCommand,\n PathOp,\n SkMatrix,\n SkPath,\n SkPoint,\n SkRect,\n SkRRect,\n StrokeOpts,\n} from \"../types\";\n\nimport { getEnum, HostObject, optEnum } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\n\nconst CommandCount = {\n [PathVerb.Move]: 3,\n [PathVerb.Line]: 3,\n [PathVerb.Quad]: 5,\n [PathVerb.Conic]: 6,\n [PathVerb.Cubic]: 7,\n [PathVerb.Close]: 1,\n};\n\nconst pinT = (t: number) => Math.min(Math.max(t, 0), 1);\n\nexport class JsiSkPath extends HostObject<Path, \"Path\"> implements SkPath {\n constructor(CanvasKit: CanvasKit, ref: Path) {\n super(CanvasKit, ref, \"Path\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n addPath(src: SkPath, matrix?: SkMatrix, extend = false) {\n const args = [\n JsiSkPath.fromValue(src),\n ...(matrix ? JsiSkMatrix.fromValue<Float32Array>(matrix) : []),\n extend,\n ];\n this.ref.addPath(...args);\n return this;\n }\n\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ) {\n this.ref.addArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees\n );\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n this.ref.addOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n isCCW,\n startIndex\n );\n return this;\n }\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n addPoly(points: SkPoint[], close: boolean) {\n this.ref.addPoly(\n points.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),\n close\n );\n return this;\n }\n\n moveTo(x: number, y: number) {\n this.ref.moveTo(x, y);\n return this;\n }\n\n lineTo(x: number, y: number) {\n this.ref.lineTo(x, y);\n return this;\n }\n\n makeAsWinding() {\n const result = this.ref.makeAsWinding();\n return result === null ? result : this;\n }\n\n offset(dx: number, dy: number) {\n this.ref.offset(dx, dy);\n return this;\n }\n\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ) {\n this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);\n return this;\n }\n\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number) {\n this.ref.rConicTo(dx1, dy1, dx2, dy2, w);\n return this;\n }\n\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n rMoveTo(x: number, y: number) {\n this.ref.rMoveTo(x, y);\n return this;\n }\n\n rLineTo(x: number, y: number) {\n this.ref.rLineTo(x, y);\n return this;\n }\n\n rQuadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.rQuadTo(x1, y1, x2, y2);\n return this;\n }\n\n setFillType(fill: FillType) {\n this.ref.setFillType(getEnum(this.CanvasKit.FillType, fill));\n return this;\n }\n\n setIsVolatile(volatile: boolean) {\n this.ref.setIsVolatile(volatile);\n return this;\n }\n\n stroke(opts?: StrokeOpts) {\n const result = this.ref.stroke(\n opts === undefined\n ? undefined\n : {\n width: opts.width,\n // eslint-disable-next-line camelcase\n miter_limit: opts.width,\n precision: opts.width,\n join: optEnum(this.CanvasKit.StrokeJoin, opts.join),\n cap: optEnum(this.CanvasKit.StrokeCap, opts.cap),\n }\n );\n return result === null ? result : this;\n }\n\n close() {\n this.ref.close();\n return this;\n }\n\n reset() {\n this.ref.reset();\n return this;\n }\n\n rewind() {\n this.ref.rewind();\n return this;\n }\n\n computeTightBounds(): SkRect {\n return new JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());\n }\n\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ) {\n this.ref.arcToOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees,\n forceMoveTo\n );\n return this;\n }\n\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ) {\n this.ref.arcToRotated(\n rx,\n ry,\n xAxisRotateInDegrees,\n useSmallArc,\n isCCW,\n x,\n y\n );\n return this;\n }\n\n arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this.ref.arcToTangent(x1, y1, x2, y2, radius);\n return this;\n }\n\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n this.ref.conicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n contains(x: number, y: number) {\n return this.ref.contains(x, y);\n }\n\n copy() {\n return new JsiSkPath(this.CanvasKit, this.ref.copy());\n }\n\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n dash(on: number, off: number, phase: number) {\n return this.ref.dash(on, off, phase);\n }\n\n equals(other: SkPath) {\n return this.ref.equals(JsiSkPath.fromValue(other));\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType() {\n return this.ref.getFillType().value;\n }\n\n quadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.quadTo(x1, y1, x2, y2);\n return this;\n }\n\n addRect(rect: SkRect, isCCW?: boolean) {\n this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);\n return this;\n }\n\n addRRect(rrect: SkRRect, isCCW?: boolean) {\n this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);\n return this;\n }\n\n getPoint(index: number) {\n return new JsiSkPoint(this.CanvasKit, this.ref.getPoint(index));\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return this.ref.isVolatile();\n }\n\n addCircle(x: number, y: number, r: number) {\n this.ref.addCircle(x, y, r);\n return this;\n }\n\n getLastPt() {\n return new JsiSkPoint(\n this.CanvasKit,\n this.ref.getPoint(this.ref.countPoints() - 1)\n );\n }\n\n op(path: SkPath, op: PathOp) {\n return this.ref.op(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op)\n );\n }\n\n simplify() {\n return this.ref.simplify();\n }\n\n toSVGString() {\n return this.ref.toSVGString();\n }\n\n trim(start: number, stop: number, isComplement: boolean) {\n const startT = pinT(start);\n const stopT = pinT(stop);\n if (startT === 0 && stopT === 1) {\n return this;\n }\n const result = this.ref.trim(startT, stopT, isComplement);\n return result === null ? result : this;\n }\n\n transform(m3: SkMatrix) {\n this.ref.transform(Array.isArray(m3) ? m3 : JsiSkMatrix.fromValue(m3));\n return this;\n }\n\n interpolate(end: SkPath, t: number, output?: SkPath) {\n const path = this.CanvasKit.Path.MakeFromPathInterpolation(\n this.ref,\n JsiSkPath.fromValue(end),\n t\n );\n if (path === null) {\n return null;\n }\n if (output) {\n (output as JsiSkPath).ref = path;\n return output;\n } else {\n return new JsiSkPath(this.CanvasKit, path);\n }\n }\n\n isInterpolatable(path2: SkPath): boolean {\n return this.CanvasKit.Path.CanInterpolate(\n this.ref,\n JsiSkPath.fromValue(path2)\n );\n }\n\n toCmds() {\n const cmds = this.ref.toCmds();\n const result = cmds.reduce<PathCommand[]>((acc, cmd, i) => {\n if (i === 0) {\n acc.push([]);\n }\n const current = acc[acc.length - 1];\n if (current.length === 0) {\n current.push(cmd);\n const length = CommandCount[current[0] as PathVerb];\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n } else {\n const length = CommandCount[current[0] as PathVerb];\n if (current.length < length) {\n current.push(cmd);\n }\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n }\n return acc;\n }, []);\n return result;\n }\n}\n"],"mappings":";;;;;;;AAEA;;AAaA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,YAAY,GAAG;EACnB,CAACC,eAA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AO,CAACD,IAAR,CAAaF,GAAb;QACA,MAAMI,MAAM,GAAG7J,YAAY,CAAC4J,OAAO,CAAC,CAAD,CAAR,CAA3B;;QACA,IAAIA,OAAO,CAACC,MAAR,KAAmBA,MAAnB,IAA6BH,CAAC,KAAKJ,IAAI,CAACO,MAAL,GAAc,CAArD,EAAwD;UACtDL,GAAG,CAACG,IAAJ,CAAS,EAAT;QACD;MACF,CAND,MAMO;QACL,MAAME,MAAM,GAAG7J,YAAY,CAAC4J,OAAO,CAAC,CAAD,CAAR,CAA3B;;QACA,IAAIA,OAAO,CAACC,MAAR,GAAiBA,MAArB,EAA6B;UAC3BD,OAAO,CAACD,IAAR,CAAaF,GAAb;QACD;;QACD,IAAIG,OAAO,CAACC,MAAR,KAAmBA,MAAnB,IAA6BH,CAAC,KAAKJ,IAAI,CAACO,MAAL,GAAc,CAArD,EAAwD;UACtDL,GAAG,CAACG,IAAJ,CAAS,EAAT;QACD;MACF;;MACD,OAAOH,GAAP;IACD,CArBc,EAqBZ,EArBY,CAAf;IAsBA,OAAOvG,MAAP;EACD;;AA3WuE"}
|
1
|
+
{"version":3,"names":["CommandCount","PathVerb","Move","Line","Quad","Conic","Cubic","Close","pinT","t","Math","min","max","JsiSkPath","HostObject","constructor","CanvasKit","ref","delete","addPath","src","matrix","extend","args","fromValue","JsiSkMatrix","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","JsiSkRect","addOval","isCCW","startIndex","countPoints","addPoly","points","close","map","p","Array","from","JsiSkPoint","flat","moveTo","x","y","lineTo","makeAsWinding","result","offset","dx","dy","rArcTo","rx","ry","xAxisRotateInDegrees","useSmallArc","rConicTo","dx1","dy1","dx2","dy2","w","rCubicTo","cpx1","cpy1","cpx2","cpy2","rMoveTo","rLineTo","rQuadTo","x1","y1","x2","y2","setFillType","fill","getEnum","FillType","setIsVolatile","volatile","stroke","opts","undefined","width","miter_limit","precision","join","optEnum","StrokeJoin","cap","StrokeCap","reset","rewind","computeTightBounds","arcToOval","forceMoveTo","arcToRotated","arcToTangent","radius","conicTo","contains","copy","cubicTo","dash","on","off","phase","equals","other","getBounds","getFillType","value","quadTo","addRect","rect","addRRect","rrect","JsiSkRRect","getPoint","index","isEmpty","isVolatile","addCircle","r","getLastPt","op","path","PathOp","simplify","toSVGString","trim","start","stop","isComplement","startT","stopT","transform","m3","isArray","interpolate","end","output","Path","MakeFromPathInterpolation","isInterpolatable","path2","CanInterpolate","toCmds","cmds","reduce","acc","cmd","i","push","current","length"],"sources":["JsiSkPath.ts"],"sourcesContent":["import type { CanvasKit, Path } from \"canvaskit-wasm\";\n\nimport { PathVerb } from \"../types\";\nimport type {\n FillType,\n PathCommand,\n PathOp,\n SkMatrix,\n SkPath,\n SkPoint,\n SkRect,\n InputRRect,\n StrokeOpts,\n} from \"../types\";\n\nimport { getEnum, HostObject, optEnum } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\n\nconst CommandCount = {\n [PathVerb.Move]: 3,\n [PathVerb.Line]: 3,\n [PathVerb.Quad]: 5,\n [PathVerb.Conic]: 6,\n [PathVerb.Cubic]: 7,\n [PathVerb.Close]: 1,\n};\n\nconst pinT = (t: number) => Math.min(Math.max(t, 0), 1);\n\nexport class JsiSkPath extends HostObject<Path, \"Path\"> implements SkPath {\n constructor(CanvasKit: CanvasKit, ref: Path) {\n super(CanvasKit, ref, \"Path\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n addPath(src: SkPath, matrix?: SkMatrix, extend = false) {\n const args = [\n JsiSkPath.fromValue(src),\n ...(matrix ? JsiSkMatrix.fromValue<Float32Array>(matrix) : []),\n extend,\n ];\n this.ref.addPath(...args);\n return this;\n }\n\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ) {\n this.ref.addArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees\n );\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n this.ref.addOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n isCCW,\n startIndex\n );\n return this;\n }\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n addPoly(points: SkPoint[], close: boolean) {\n this.ref.addPoly(\n points.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),\n close\n );\n return this;\n }\n\n moveTo(x: number, y: number) {\n this.ref.moveTo(x, y);\n return this;\n }\n\n lineTo(x: number, y: number) {\n this.ref.lineTo(x, y);\n return this;\n }\n\n makeAsWinding() {\n const result = this.ref.makeAsWinding();\n return result === null ? result : this;\n }\n\n offset(dx: number, dy: number) {\n this.ref.offset(dx, dy);\n return this;\n }\n\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ) {\n this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);\n return this;\n }\n\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number) {\n this.ref.rConicTo(dx1, dy1, dx2, dy2, w);\n return this;\n }\n\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n rMoveTo(x: number, y: number) {\n this.ref.rMoveTo(x, y);\n return this;\n }\n\n rLineTo(x: number, y: number) {\n this.ref.rLineTo(x, y);\n return this;\n }\n\n rQuadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.rQuadTo(x1, y1, x2, y2);\n return this;\n }\n\n setFillType(fill: FillType) {\n this.ref.setFillType(getEnum(this.CanvasKit.FillType, fill));\n return this;\n }\n\n setIsVolatile(volatile: boolean) {\n this.ref.setIsVolatile(volatile);\n return this;\n }\n\n stroke(opts?: StrokeOpts) {\n const result = this.ref.stroke(\n opts === undefined\n ? undefined\n : {\n width: opts.width,\n // eslint-disable-next-line camelcase\n miter_limit: opts.width,\n precision: opts.width,\n join: optEnum(this.CanvasKit.StrokeJoin, opts.join),\n cap: optEnum(this.CanvasKit.StrokeCap, opts.cap),\n }\n );\n return result === null ? result : this;\n }\n\n close() {\n this.ref.close();\n return this;\n }\n\n reset() {\n this.ref.reset();\n return this;\n }\n\n rewind() {\n this.ref.rewind();\n return this;\n }\n\n computeTightBounds(): SkRect {\n return new JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());\n }\n\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ) {\n this.ref.arcToOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees,\n forceMoveTo\n );\n return this;\n }\n\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ) {\n this.ref.arcToRotated(\n rx,\n ry,\n xAxisRotateInDegrees,\n useSmallArc,\n isCCW,\n x,\n y\n );\n return this;\n }\n\n arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this.ref.arcToTangent(x1, y1, x2, y2, radius);\n return this;\n }\n\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n this.ref.conicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n contains(x: number, y: number) {\n return this.ref.contains(x, y);\n }\n\n copy() {\n return new JsiSkPath(this.CanvasKit, this.ref.copy());\n }\n\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n dash(on: number, off: number, phase: number) {\n return this.ref.dash(on, off, phase);\n }\n\n equals(other: SkPath) {\n return this.ref.equals(JsiSkPath.fromValue(other));\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType() {\n return this.ref.getFillType().value;\n }\n\n quadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.quadTo(x1, y1, x2, y2);\n return this;\n }\n\n addRect(rect: SkRect, isCCW?: boolean) {\n this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);\n return this;\n }\n\n addRRect(rrect: InputRRect, isCCW?: boolean) {\n this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);\n return this;\n }\n\n getPoint(index: number) {\n return new JsiSkPoint(this.CanvasKit, this.ref.getPoint(index));\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return this.ref.isVolatile();\n }\n\n addCircle(x: number, y: number, r: number) {\n this.ref.addCircle(x, y, r);\n return this;\n }\n\n getLastPt() {\n return new JsiSkPoint(\n this.CanvasKit,\n this.ref.getPoint(this.ref.countPoints() - 1)\n );\n }\n\n op(path: SkPath, op: PathOp) {\n return this.ref.op(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op)\n );\n }\n\n simplify() {\n return this.ref.simplify();\n }\n\n toSVGString() {\n return this.ref.toSVGString();\n }\n\n trim(start: number, stop: number, isComplement: boolean) {\n const startT = pinT(start);\n const stopT = pinT(stop);\n if (startT === 0 && stopT === 1) {\n return this;\n }\n const result = this.ref.trim(startT, stopT, isComplement);\n return result === null ? result : this;\n }\n\n transform(m3: SkMatrix) {\n this.ref.transform(Array.isArray(m3) ? m3 : JsiSkMatrix.fromValue(m3));\n return this;\n }\n\n interpolate(end: SkPath, t: number, output?: SkPath) {\n const path = this.CanvasKit.Path.MakeFromPathInterpolation(\n this.ref,\n JsiSkPath.fromValue(end),\n t\n );\n if (path === null) {\n return null;\n }\n if (output) {\n (output as JsiSkPath).ref = path;\n return output;\n } else {\n return new JsiSkPath(this.CanvasKit, path);\n }\n }\n\n isInterpolatable(path2: SkPath): boolean {\n return this.CanvasKit.Path.CanInterpolate(\n this.ref,\n JsiSkPath.fromValue(path2)\n );\n }\n\n toCmds() {\n const cmds = this.ref.toCmds();\n const result = cmds.reduce<PathCommand[]>((acc, cmd, i) => {\n if (i === 0) {\n acc.push([]);\n }\n const current = acc[acc.length - 1];\n if (current.length === 0) {\n current.push(cmd);\n const length = CommandCount[current[0] as PathVerb];\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n } else {\n const length = CommandCount[current[0] as PathVerb];\n if (current.length < length) {\n current.push(cmd);\n }\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n }\n return acc;\n }, []);\n return result;\n }\n}\n"],"mappings":";;;;;;;AAEA;;AAaA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,YAAY,GAAG;EACnB,CAACC,eAAA,CAASC,IAAV,GAAiB,CADE;EAEnB,CAACD,eAAA,CAASE,IAAV,GAAiB,CAFE;EAGnB,CAACF,eAAA,CAASG,IAAV,GAAiB,CAHE;EAInB,CAACH,eAAA,CAASI,KAAV,GAAkB,CAJC;EAKnB,CAACJ,eAAA,CAASK,KAAV,GAAkB,CALC;EAMnB,CAACL,eAAA,CAASM,KAAV,GAAkB;AANC,CAArB;;AASA,MAAMC,IAAI,GAAIC,CAAD,IAAeC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAASH,CAAT,EAAY,CAAZ,CAAT,EAAyB,CAAzB,CAA5B;;AAEO,MAAMI,SAAN,SAAwBC,gBAAxB,CAAmE;EACxEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAkC;IAC3C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,MAAtB;;IAD2C,iCAInC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAN4C;EAE5C;;EAMDC,OAAO,CAACC,GAAD,EAAcC,MAAd,EAAiD;IAAA,IAAhBC,MAAgB,uEAAP,KAAO;IACtD,MAAMC,IAAI,GAAG,CACXV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import type { CanvasKit, RRect } from "canvaskit-wasm";
|
2
|
-
import type { SkRect, SkRRect } from "../types";
|
2
|
+
import type { InputRRect, SkRect, SkRRect } from "../types";
|
3
3
|
import { BaseHostObject } from "./Host";
|
4
4
|
import { JsiSkRect } from "./JsiSkRect";
|
5
5
|
export declare class JsiSkRRect extends BaseHostObject<RRect, "RRect"> implements SkRRect {
|
6
6
|
dispose: () => void;
|
7
|
-
static fromValue(CanvasKit: CanvasKit, rect:
|
7
|
+
static fromValue(CanvasKit: CanvasKit, rect: InputRRect): Float32Array;
|
8
8
|
constructor(CanvasKit: CanvasKit, rect: SkRect, rx: number, ry: number);
|
9
9
|
get rx(): number;
|
10
10
|
get ry(): number;
|
@@ -17,6 +17,10 @@ class JsiSkRRect extends _Host.BaseHostObject {
|
|
17
17
|
return rect.ref;
|
18
18
|
}
|
19
19
|
|
20
|
+
if ("topLeft" in rect && "topRight" in rect && "bottomRight" in rect && "bottomLeft" in rect) {
|
21
|
+
return Float32Array.of(rect.rect.x, rect.rect.y, rect.rect.x + rect.rect.width, rect.rect.y + rect.rect.height, rect.topLeft.x, rect.topLeft.y, rect.topRight.x, rect.topRight.y, rect.bottomRight.x, rect.bottomRight.y, rect.bottomLeft.x, rect.bottomLeft.y);
|
22
|
+
}
|
23
|
+
|
20
24
|
return CanvasKit.RRectXY(_JsiSkRect.JsiSkRect.fromValue(CanvasKit, rect.rect), rect.rx, rect.ry);
|
21
25
|
}
|
22
26
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkRRect","BaseHostObject","fromValue","CanvasKit","rect","JsiSkRect","ref","
|
1
|
+
{"version":3,"names":["JsiSkRRect","BaseHostObject","fromValue","CanvasKit","rect","JsiSkRect","ref","Float32Array","of","x","y","width","height","topLeft","topRight","bottomRight","bottomLeft","RRectXY","rx","ry","constructor","Infinity","scale","Math","min"],"sources":["JsiSkRRect.ts"],"sourcesContent":["import type { CanvasKit, RRect } from \"canvaskit-wasm\";\n\nimport type { InputRRect, SkRect, SkRRect } from \"../types\";\n\nimport { BaseHostObject } from \"./Host\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkRRect\n extends BaseHostObject<RRect, \"RRect\">\n implements SkRRect\n{\n dispose = () => {\n // Float32Array\n };\n\n static fromValue(CanvasKit: CanvasKit, rect: InputRRect) {\n if (rect instanceof JsiSkRect) {\n return rect.ref;\n }\n if (\n \"topLeft\" in rect &&\n \"topRight\" in rect &&\n \"bottomRight\" in rect &&\n \"bottomLeft\" in rect\n ) {\n return Float32Array.of(\n rect.rect.x,\n rect.rect.y,\n rect.rect.x + rect.rect.width,\n rect.rect.y + rect.rect.height,\n rect.topLeft.x,\n rect.topLeft.y,\n rect.topRight.x,\n rect.topRight.y,\n rect.bottomRight.x,\n rect.bottomRight.y,\n rect.bottomLeft.x,\n rect.bottomLeft.y\n );\n }\n return CanvasKit.RRectXY(\n JsiSkRect.fromValue(CanvasKit, rect.rect),\n rect.rx,\n rect.ry\n );\n }\n\n constructor(CanvasKit: CanvasKit, rect: SkRect, rx: number, ry: number) {\n // based on https://github.com/google/skia/blob/main/src/core/SkRRect.cpp#L51\n if (rx === Infinity || ry === Infinity) {\n rx = ry = 0;\n }\n if (rect.width < rx + rx || rect.height < ry + ry) {\n // At most one of these two divides will be by zero, and neither numerator is zero.\n const scale = Math.min(rect.width / (rx + rx), rect.height / (ry + ry));\n rx *= scale;\n ry *= scale;\n }\n const ref = CanvasKit.RRectXY(JsiSkRect.fromValue(CanvasKit, rect), rx, ry);\n super(CanvasKit, ref, \"RRect\");\n }\n\n get rx() {\n return this.ref[4];\n }\n\n get ry() {\n return this.ref[5];\n }\n\n get rect() {\n return new JsiSkRect(\n this.CanvasKit,\n Float32Array.of(this.ref[0], this.ref[1], this.ref[2], this.ref[3])\n );\n }\n}\n"],"mappings":";;;;;;;AAIA;;AACA;;;;AAEO,MAAMA,UAAN,SACGC,oBADH,CAGP;EAKkB,OAATC,SAAS,CAACC,SAAD,EAAuBC,IA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GA,EAA/C,EAAmD;MACjD;MACA,MAAMG,KAAK,GAAGC,IAAI,CAACC,GAAL,CAASpB,IAAI,CAACO,KAAL,IAAcO,EAAE,GAAGA,EAAnB,CAAT,EAAiCd,IAAI,CAACQ,MAAL,IAAeO,EAAE,GAAGA,EAApB,CAAjC,CAAd;MACAD,EAAE,IAAII,KAAN;MACAH,EAAE,IAAIG,KAAN;IACD;;IACD,MAAMhB,GAAG,GAAGH,SAAS,CAACc,OAAV,CAAkBZ,oBAAA,CAAUH,SAAV,CAAoBC,SAApB,EAA+BC,IAA/B,CAAlB,EAAwDc,EAAxD,EAA4DC,EAA5D,CAAZ;IACA,MAAMhB,SAAN,EAAiBG,GAAjB,EAAsB,OAAtB;;IAZsE,iCApC9D,MAAM,CACd;IACD,CAkCuE;EAavE;;EAEK,IAAFY,EAAE,GAAG;IACP,OAAO,KAAKZ,GAAL,CAAS,CAAT,CAAP;EACD;;EAEK,IAAFa,EAAE,GAAG;IACP,OAAO,KAAKb,GAAL,CAAS,CAAT,CAAP;EACD;;EAEO,IAAJF,IAAI,GAAG;IACT,OAAO,IAAIC,oBAAJ,CACL,KAAKF,SADA,EAELI,YAAY,CAACC,EAAb,CAAgB,KAAKF,GAAL,CAAS,CAAT,CAAhB,EAA6B,KAAKA,GAAL,CAAS,CAAT,CAA7B,EAA0C,KAAKA,GAAL,CAAS,CAAT,CAA1C,EAAuD,KAAKA,GAAL,CAAS,CAAT,CAAvD,CAFK,CAAP;EAID;;AAjEH"}
|
@@ -11,12 +11,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
11
11
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
13
13
|
// @ts-ignore
|
14
|
+
let ckSharedPromise;
|
15
|
+
|
14
16
|
const LoadSkiaWeb = async opts => {
|
15
17
|
if (global.CanvasKit !== undefined) {
|
16
18
|
return;
|
17
19
|
}
|
18
20
|
|
19
|
-
|
21
|
+
ckSharedPromise = ckSharedPromise ?? (0, _canvaskit.default)(opts);
|
22
|
+
const CanvasKit = await ckSharedPromise; // The CanvasKit API is stored on the global object and used
|
20
23
|
// to create the JsiSKApi in the Skia.web.ts file.
|
21
24
|
|
22
25
|
global.CanvasKit = CanvasKit;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["LoadSkiaWeb","opts","global","CanvasKit","undefined","CanvasKitInit","LoadSkia"],"sources":["LoadSkiaWeb.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type {\n CanvasKit as CanvasKitType,\n CanvasKitInitOptions,\n} from \"canvaskit-wasm\";\n\ndeclare global {\n var CanvasKit: CanvasKitType;\n}\n\nexport const LoadSkiaWeb = async (opts?: CanvasKitInitOptions) => {\n if (global.CanvasKit !== undefined) {\n return;\n }\n
|
1
|
+
{"version":3,"names":["ckSharedPromise","LoadSkiaWeb","opts","global","CanvasKit","undefined","CanvasKitInit","LoadSkia"],"sources":["LoadSkiaWeb.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type {\n CanvasKit as CanvasKitType,\n CanvasKitInitOptions,\n} from \"canvaskit-wasm\";\n\ndeclare global {\n var CanvasKit: CanvasKitType;\n}\n\nlet ckSharedPromise: Promise<CanvasKitType>;\n\nexport const LoadSkiaWeb = async (opts?: CanvasKitInitOptions) => {\n if (global.CanvasKit !== undefined) {\n return;\n }\n ckSharedPromise = ckSharedPromise ?? CanvasKitInit(opts);\n const CanvasKit = await ckSharedPromise;\n // The CanvasKit API is stored on the global object and used\n // to create the JsiSKApi in the Skia.web.ts file.\n global.CanvasKit = CanvasKit;\n};\n\n// We keep this function for backward compatibility\nexport const LoadSkia = LoadSkiaWeb;\n"],"mappings":";;;;;;;AAEA;;;;AAFA;AACA;AAWA,IAAIA,eAAJ;;AAEO,MAAMC,WAAW,GAAG,MAAOC,IAAP,IAAuC;EAChE,IAAIC,MAAM,CAACC,SAAP,KAAqBC,SAAzB,EAAoC;IAClC;EACD;;EACDL,eAAe,GAAGA,eAAe,IAAI,IAAAM,kBAAA,EAAcJ,IAAd,CAArC;EACA,MAAME,SAAS,GAAG,MAAMJ,eAAxB,CALgE,CAMhE;EACA;;EACAG,MAAM,CAACC,SAAP,GAAmBA,SAAnB;AACD,CATM,C,CAWP;;;;AACO,MAAMG,QAAQ,GAAGN,WAAjB"}
|
@@ -2,6 +2,7 @@ import type { PathProps, SkDOM, GroupProps, ImageProps, BlurImageFilterProps, Ma
|
|
2
2
|
import type { BlendImageFilterProps, BlendProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, RuntimeShaderImageFilterProps } from "../types/ImageFilters";
|
3
3
|
import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps } from "../types/PathEffects";
|
4
4
|
import type { ParagraphProps } from "../types/Paragraph";
|
5
|
+
import { RRectNode } from "./drawings";
|
5
6
|
import type { NodeContext } from "./Node";
|
6
7
|
export declare class JsiSkDOM implements SkDOM {
|
7
8
|
private ctx;
|
@@ -18,7 +19,7 @@ export declare class JsiSkDOM implements SkDOM {
|
|
18
19
|
Patch(props: PatchProps): import("../types").RenderNode<PatchProps>;
|
19
20
|
Points(props: PointsProps): import("../types").RenderNode<PointsProps>;
|
20
21
|
Rect(props: RectProps): import("./DrawingNode").JsiDrawingNode<RectProps, import("../..").SkRect>;
|
21
|
-
RRect(props: RoundedRectProps): import("./DrawingNode").JsiDrawingNode<RoundedRectProps, import("../..").SkRRect
|
22
|
+
RRect(props: RoundedRectProps): import("./DrawingNode").JsiDrawingNode<RoundedRectProps, import("../..").SkRRect> | RRectNode;
|
22
23
|
Vertices(props: VerticesProps): import("../types").RenderNode<VerticesProps>;
|
23
24
|
Text(props: TextProps): import("../types").RenderNode<TextProps>;
|
24
25
|
TextPath(props: TextPathProps): import("../types").RenderNode<TextPathProps>;
|
@@ -2,4 +2,4 @@ import type { Skia, SkRect, Vector } from "../../../skia/types";
|
|
2
2
|
import type { RectDef, RRectDef } from "../../types";
|
3
3
|
export declare const isEdge: (pos: Vector, b: SkRect) => boolean;
|
4
4
|
export declare const processRect: (Skia: Skia, def: RectDef) => SkRect;
|
5
|
-
export declare const processRRect: (Skia: Skia, def: RRectDef) => import("../../../skia/types").
|
5
|
+
export declare const processRRect: (Skia: Skia, def: RRectDef) => import("../../../skia/types").InputRRect;
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import type { SkRRect } from "../../../skia/types";
|
1
|
+
import type { InputRRect, SkRRect } from "../../../skia/types";
|
2
2
|
import type { DrawingContext, RoundedRectProps } from "../../types";
|
3
3
|
import { JsiDrawingNode } from "../DrawingNode";
|
4
4
|
import type { NodeContext } from "../Node";
|
5
|
-
export declare class RRectNode extends JsiDrawingNode<RoundedRectProps,
|
5
|
+
export declare class RRectNode extends JsiDrawingNode<RoundedRectProps, InputRRect> {
|
6
6
|
rect?: SkRRect;
|
7
7
|
constructor(ctx: NodeContext, props: RoundedRectProps);
|
8
|
-
protected deriveProps():
|
8
|
+
protected deriveProps(): InputRRect;
|
9
9
|
draw({ canvas, paint }: DrawingContext): void;
|
10
10
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NodeType","processRRect","JsiDrawingNode","RRectNode","constructor","ctx","props","RRect","deriveProps","Skia","draw","canvas","paint","derived","undefined","Error","drawRRect"],"sources":["RRectNode.ts"],"sourcesContent":["import type { SkRRect } from \"../../../skia/types\";\nimport type { DrawingContext, RoundedRectProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { processRRect } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class RRectNode extends JsiDrawingNode<RoundedRectProps,
|
1
|
+
{"version":3,"names":["NodeType","processRRect","JsiDrawingNode","RRectNode","constructor","ctx","props","RRect","deriveProps","Skia","draw","canvas","paint","derived","undefined","Error","drawRRect"],"sources":["RRectNode.ts"],"sourcesContent":["import type { InputRRect, SkRRect } from \"../../../skia/types\";\nimport type { DrawingContext, RoundedRectProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { processRRect } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class RRectNode extends JsiDrawingNode<RoundedRectProps, InputRRect> {\n rect?: SkRRect;\n\n constructor(ctx: NodeContext, props: RoundedRectProps) {\n super(ctx, NodeType.RRect, props);\n }\n\n protected deriveProps() {\n return processRRect(this.Skia, this.props);\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (this.derived === undefined) {\n throw new Error(\"RRectNode: rect is undefined\");\n }\n canvas.drawRRect(this.derived, paint);\n }\n}\n"],"mappings":";;AAEA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,YAAT,QAA6B,cAA7B;AACA,SAASC,cAAT,QAA+B,gBAA/B;AAGA,OAAO,MAAMC,SAAN,SAAwBD,cAAxB,CAAqE;EAG1EE,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAA4C;IACrD,MAAMD,GAAN,EAAWL,QAAQ,CAACO,KAApB,EAA2BD,KAA3B;;IADqD;EAEtD;;EAESE,WAAW,GAAG;IACtB,OAAOP,YAAY,CAAC,KAAKQ,IAAN,EAAY,KAAKH,KAAjB,CAAnB;EACD;;EAEDI,IAAI,OAAoC;IAAA,IAAnC;MAAEC,MAAF;MAAUC;IAAV,CAAmC;;IACtC,IAAI,KAAKC,OAAL,KAAiBC,SAArB,EAAgC;MAC9B,MAAM,IAAIC,KAAJ,CAAU,8BAAV,CAAN;IACD;;IACDJ,MAAM,CAACK,SAAP,CAAiB,KAAKH,OAAtB,EAA+BD,KAA/B;EACD;;AAhByE"}
|
@@ -11,18 +11,8 @@ export class TextNode extends JsiDrawingNode {
|
|
11
11
|
font
|
12
12
|
} = this.props;
|
13
13
|
|
14
|
-
if (font
|
14
|
+
if (!font) {
|
15
15
|
return null;
|
16
|
-
} else if (font === undefined) {
|
17
|
-
console.warn("<Text />: the font property is mandatory on React Native Web");
|
18
|
-
return null; // return this.Skia.Font(
|
19
|
-
// this.Skia.FontMgr.System().matchFamilyStyle("System", {
|
20
|
-
// width: 5,
|
21
|
-
// weight: 400,
|
22
|
-
// slant: 0,
|
23
|
-
// }),
|
24
|
-
// 14
|
25
|
-
// );
|
26
16
|
}
|
27
17
|
|
28
18
|
return font;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NodeType","processPath","JsiDrawingNode","TextNode","constructor","ctx","props","Text","deriveProps","font","
|
1
|
+
{"version":3,"names":["NodeType","processPath","JsiDrawingNode","TextNode","constructor","ctx","props","Text","deriveProps","font","draw","canvas","paint","text","x","y","derived","undefined","Error","drawText","TextPathNode","TextPath","path","Skia","initialOffset","ids","getGlyphIDs","widths","getGlyphWidths","rsx","meas","ContourMeasureIter","cont","next","dist","i","length","width","substring","p","t","getPosTan","adjustedX","adjustedY","push","RSXform","TextBlob","MakeFromRSXform","drawTextBlob","TextBlobNode","blob","GlyphsNode","Glyphs","glyphs","reduce","acc","glyph","id","pos","positions","drawGlyphs"],"sources":["Text.ts"],"sourcesContent":["import type {\n SkRSXform,\n SkTextBlob,\n SkPoint,\n SkFont,\n} from \"../../../skia/types\";\nimport type {\n DrawingContext,\n TextBlobProps,\n TextPathProps,\n TextProps,\n} from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { processPath } from \"../datatypes\";\nimport type { GlyphsProps } from \"../../types/Drawings\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class TextNode extends JsiDrawingNode<TextProps, SkFont | null> {\n constructor(ctx: NodeContext, props: TextProps) {\n super(ctx, NodeType.Text, props);\n }\n\n protected deriveProps() {\n const { font } = this.props;\n if (!font) {\n return null;\n }\n return font;\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { text, x, y } = this.props;\n const font = this.derived;\n if (font === undefined) {\n throw new Error(\"TextNode: font hasn't been derived\");\n }\n if (font != null) {\n canvas.drawText(text, x, y, paint, font);\n }\n }\n}\n\nexport class TextPathNode extends JsiDrawingNode<\n TextPathProps,\n SkTextBlob | null\n> {\n constructor(ctx: NodeContext, props: TextPathProps) {\n super(ctx, NodeType.TextPath, props);\n }\n\n deriveProps() {\n const path = processPath(this.Skia, this.props.path);\n const { font, initialOffset } = this.props;\n if (!font) {\n return null;\n }\n let { text } = this.props;\n const ids = font.getGlyphIDs(text);\n const widths = font.getGlyphWidths(ids);\n const rsx: SkRSXform[] = [];\n const meas = this.Skia.ContourMeasureIter(path, false, 1);\n let cont = meas.next();\n let dist = initialOffset;\n for (let i = 0; i < text.length && cont; i++) {\n const width = widths[i];\n dist += width / 2;\n if (dist > cont.length()) {\n // jump to next contour\n cont = meas.next();\n if (!cont) {\n // We have come to the end of the path - terminate the string\n // right here.\n text = text.substring(0, i);\n break;\n }\n dist = width / 2;\n }\n // Gives us the (x, y) coordinates as well as the cos/sin of the tangent\n // line at that position.\n const [p, t] = cont.getPosTan(dist);\n const adjustedX = p.x - (width / 2) * t.x;\n const adjustedY = p.y - (width / 2) * t.y;\n rsx.push(this.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));\n dist += width / 2;\n }\n return this.Skia.TextBlob.MakeFromRSXform(text, rsx, font);\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (!this.derived) {\n throw new Error(\"TextPathNode: blob is null\");\n }\n canvas.drawTextBlob(this.derived, 0, 0, paint);\n }\n}\n\nexport class TextBlobNode extends JsiDrawingNode<TextBlobProps, null> {\n constructor(ctx: NodeContext, props: TextBlobProps) {\n super(ctx, NodeType.TextBlob, props);\n }\n\n protected deriveProps() {\n return null;\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { blob, x, y } = this.props;\n canvas.drawTextBlob(blob, x, y, paint);\n }\n}\n\ninterface ProcessedGlyphs {\n glyphs: number[];\n positions: SkPoint[];\n}\n\nexport class GlyphsNode extends JsiDrawingNode<GlyphsProps, ProcessedGlyphs> {\n constructor(ctx: NodeContext, props: GlyphsProps) {\n super(ctx, NodeType.Glyphs, props);\n }\n\n deriveProps() {\n return this.props.glyphs.reduce<ProcessedGlyphs>(\n (acc, glyph) => {\n const { id, pos } = glyph;\n acc.glyphs.push(id);\n acc.positions.push(pos);\n return acc;\n },\n { glyphs: [], positions: [] }\n );\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (!this.derived) {\n throw new Error(\"GlyphsNode: processedGlyphs is null\");\n }\n const { glyphs, positions } = this.derived;\n const { x, y, font } = this.props;\n if (font) {\n canvas.drawGlyphs(glyphs, positions, x, y, font, paint);\n }\n }\n}\n"],"mappings":"AAYA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,WAAT,QAA4B,cAA5B;AAEA,SAASC,cAAT,QAA+B,gBAA/B;AAGA,OAAO,MAAMC,QAAN,SAAuBD,cAAvB,CAAgE;EACrEE,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAqC;IAC9C,MAAMD,GAAN,EAAWL,QAAQ,CAACO,IAApB,EAA0BD,KAA1B;EACD;;EAESE,WAAW,GAAG;IACtB,MAAM;MAAEC;IAAF,IAAW,KAAKH,KAAtB;;IACA,IAAI,CAACG,IAAL,EAAW;MACT,OAAO,IAAP;IACD;;IACD,OAAOA,IAAP;EACD;;EAEDC,IAAI,OAAoC;IAAA,IAAnC;MAAEC,MAAF;MAAUC;IAAV,CAAmC;IACtC,MAAM;MAAEC,IAAF;MAAQC,CAAR;MAAWC;IAAX,IAAiB,KAAKT,KAA5B;IACA,MAAMG,IAAI,GAAG,KAAKO,OAAlB;;IACA,IAAIP,IAAI,KAAKQ,SAAb,EAAwB;MACtB,MAAM,IAAIC,KAAJ,CAAU,oCAAV,CAAN;IACD;;IACD,IAAIT,IAAI,IAAI,IAAZ,EAAkB;MAChB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C,EAA2CN,IAA3C,EAAiDG,KAAjD;IACD;EACF;;AA1B0E"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
|
-
import type { BlendMode, Color, InputMatrix, PaintStyle, SkPaint, SkPath, SkRect, SkRRect, StrokeCap, StrokeJoin, Transforms3d, Vector } from "../../skia/types";
|
2
|
+
import type { BlendMode, Color, InputMatrix, InputRRect, PaintStyle, SkPaint, SkPath, SkRect, SkRRect, StrokeCap, StrokeJoin, Transforms3d, Vector } from "../../skia/types";
|
3
3
|
export type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;
|
4
4
|
export type PathDef = string | SkPath;
|
5
5
|
export type ClipDef = SkRRect | SkRect | PathDef;
|
@@ -21,7 +21,7 @@ export type RectDef = RectCtor | {
|
|
21
21
|
rect: SkRect;
|
22
22
|
};
|
23
23
|
export type RRectDef = RRectCtor | {
|
24
|
-
rect:
|
24
|
+
rect: InputRRect;
|
25
25
|
};
|
26
26
|
export interface PointCircleDef {
|
27
27
|
c?: Vector;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n InputMatrix,\n PaintStyle,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms3d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x?: number;\n y?: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r?: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect:
|
1
|
+
{"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n InputMatrix,\n InputRRect,\n PaintStyle,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms3d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x?: number;\n y?: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r?: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: InputRRect };\n\nexport interface PointCircleDef {\n c?: Vector;\n r: number;\n}\n\nexport interface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nexport interface TransformProps {\n transform?: Transforms3d;\n origin?: Vector;\n matrix?: InputMatrix;\n}\n\nexport interface PaintProps extends ChildrenProps {\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n dither?: boolean;\n}\n\nexport interface GroupProps extends PaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: SkPaint | boolean;\n}\n"],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit?: Fit;\n image: SkImage | null;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport interface ImageSVGProps extends DrawingNodeProps {\n svg: SkSVG | null;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n rect?: SkRect;\n}\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font
|
1
|
+
{"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit?: Fit;\n image: SkImage | null;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport interface ImageSVGProps extends DrawingNodeProps {\n svg: SkSVG | null;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n rect?: SkRect;\n}\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n x: number;\n y: number;\n}\n\nexport interface TextPathProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n path: PathDef;\n initialOffset: number;\n}\n\nexport interface TextBlobProps extends DrawingNodeProps {\n blob: SkTextBlob;\n x: number;\n y: number;\n}\n\nexport interface Glyph {\n id: number;\n pos: SkPoint;\n}\n\nexport interface GlyphsProps extends DrawingNodeProps {\n font: SkFont | null;\n x: number;\n y: number;\n glyphs: Glyph[];\n}\n\nexport interface BoxProps extends DrawingNodeProps {\n box: SkRRect | SkRect;\n}\n\nexport interface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n"],"mappings":""}
|
@@ -1,3 +1,5 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
|
+
import type { SkSurface } from "../skia";
|
2
3
|
export * from "../renderer/components";
|
3
|
-
export declare const
|
4
|
+
export declare const makeOffscreenSurface: (width: number, height: number) => any;
|
5
|
+
export declare const drawOffscreen: (surface: SkSurface, element: ReactNode) => import("../skia").SkImage;
|