@shopify/react-native-skia 0.1.220 → 0.1.221
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkCanvas.h +38 -1
- package/cpp/api/JsiSkImage.h +66 -1
- package/cpp/api/JsiSkImageInfo.h +19 -0
- package/cpp/utils/RNSkTypedArray.h +41 -0
- package/lib/commonjs/skia/types/Canvas.d.ts +9 -1
- package/lib/commonjs/skia/types/Canvas.js.map +1 -1
- package/lib/commonjs/skia/types/Image/Image.d.ts +13 -0
- package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +14 -11
- package/lib/commonjs/skia/types/Image/ImageFactory.js +14 -11
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +2 -1
- package/lib/commonjs/skia/web/Host.js +10 -1
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +11 -0
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFontMgrFactory.js +1 -3
- package/lib/commonjs/skia/web/JsiSkFontMgrFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.d.ts +3 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +28 -0
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js +0 -4
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/module/skia/types/Canvas.d.ts +9 -1
- package/lib/module/skia/types/Canvas.js.map +1 -1
- package/lib/module/skia/types/Image/Image.d.ts +13 -0
- package/lib/module/skia/types/Image/Image.js.map +1 -1
- package/lib/module/skia/types/Image/ImageFactory.d.ts +14 -11
- package/lib/module/skia/types/Image/ImageFactory.js +14 -11
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +2 -1
- package/lib/module/skia/web/Host.js +6 -0
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.d.ts +2 -1
- package/lib/module/skia/web/JsiSkCanvas.js +12 -1
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkFontMgrFactory.js +1 -3
- package/lib/module/skia/web/JsiSkFontMgrFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.d.ts +3 -1
- package/lib/module/skia/web/JsiSkImage.js +31 -1
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +2 -2
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +0 -4
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/typescript/src/skia/types/Canvas.d.ts +9 -1
- package/lib/typescript/src/skia/types/Image/Image.d.ts +13 -0
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +14 -11
- package/lib/typescript/src/skia/web/Host.d.ts +2 -1
- package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +2 -1
- package/lib/typescript/src/skia/web/JsiSkImage.d.ts +3 -1
- package/lib/typescript/src/skia/web/JsiSkTypefaceFontProvider.d.ts +2 -2
- package/package.json +2 -2
- package/src/skia/types/Canvas.ts +14 -1
- package/src/skia/types/Image/Image.ts +20 -0
- package/src/skia/types/Image/ImageFactory.ts +30 -25
- package/src/skia/web/Host.ts +3 -1
- package/src/skia/web/JsiSkCanvas.ts +13 -1
- package/src/skia/web/JsiSkFontMgrFactory.ts +0 -2
- package/src/skia/web/JsiSkImage.ts +42 -3
- package/src/skia/web/JsiSkTypefaceFontProvider.ts +0 -4
@@ -1,6 +1,6 @@
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
2
|
|
3
|
-
import { ckEnum, HostObject } from "./Host";
|
3
|
+
import { ckEnum, getCkEnum, HostObject } from "./Host";
|
4
4
|
import { JsiSkPaint } from "./JsiSkPaint";
|
5
5
|
import { JsiSkRect } from "./JsiSkRect";
|
6
6
|
import { JsiSkRRect } from "./JsiSkRRect";
|
@@ -186,5 +186,16 @@ export class JsiSkCanvas extends HostObject {
|
|
186
186
|
this.ref.drawPicture(JsiSkPicture.fromValue(skp));
|
187
187
|
}
|
188
188
|
|
189
|
+
readPixels(srcX, srcY, imageInfo) {
|
190
|
+
const pxInfo = {
|
191
|
+
width: imageInfo.width,
|
192
|
+
height: imageInfo.height,
|
193
|
+
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
194
|
+
alphaType: getCkEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),
|
195
|
+
colorType: getCkEnum(this.CanvasKit.ColorType, imageInfo.colorType)
|
196
|
+
};
|
197
|
+
return this.ref.readPixels(srcX, srcY, pxInfo);
|
198
|
+
}
|
199
|
+
|
189
200
|
}
|
190
201
|
//# sourceMappingURL=JsiSkCanvas.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ckEnum","HostObject","JsiSkPaint","JsiSkRect","JsiSkRRect","JsiSkImage","JsiSkVertices","JsiSkPath","JsiSkFont","JsiSkTextBlob","JsiSkPicture","JsiSkMatrix","JsiSkImageFilter","JsiSkPoint","JsiSkCanvas","constructor","CanvasKit","ref","delete","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","undefined","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","drawPicture","skp"],"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 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 { ckEnum, 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 ckEnum(fm),\n ckEnum(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 ckEnum(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 ckEnum(fm),\n ckEnum(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 ckEnum(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 ? ckEnum(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 ckEnum(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(color, blendMode ? ckEnum(blendMode) : undefined);\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(JsiSkPath.fromValue(path), ckEnum(op), doAntiAlias);\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n ckEnum(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 ckEnum(op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix) {\n this.ref.concat(JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n}\n"],"mappings":";;AA0BA,SAASA,MAAT,EAAiBC,UAAjB,QAAmC,QAAnC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B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,KAAKzG,GAAL,CAASuG,QAAT,CAAkBjH,SAAS,CAACe,SAAV,CAAoB+D,IAApB,CAAlB,EAA6CrF,MAAM,CAACyH,EAAD,CAAnD,EAAyDC,WAAzD;EACD;;EAEDC,QAAQ,CAACvG,IAAD,EAAeqG,EAAf,EAA2BC,WAA3B,EAAiD;IACvD,KAAKzG,GAAL,CAAS0G,QAAT,CACExH,SAAS,CAACmB,SAAV,CAAoB,KAAKN,SAAzB,EAAoCI,IAApC,CADF,EAEEpB,MAAM,CAACyH,EAAD,CAFR,EAGEC,WAHF;EAKD;;EAEDE,SAAS,CAAC7C,KAAD,EAAiB0C,EAAjB,EAA6BC,WAA7B,EAAmD;IAC1D,KAAKzG,GAAL,CAAS2G,SAAT,CACExH,UAAU,CAACkB,SAAX,CAAqB,KAAKN,SAA1B,EAAqC+D,KAArC,CADF,EAEE/E,MAAM,CAACyH,EAAD,CAFR,EAGEC,WAHF;EAKD;;EAEDG,MAAM,CAACC,CAAD,EAAc;IAClB,KAAK7G,GAAL,CAAS4G,MAAT,CAAgBlH,WAAW,CAACW,SAAZ,CAAsBwG,CAAtB,CAAhB;EACD;;EAEDC,WAAW,CAACC,GAAD,EAAiB;IAC1B,KAAK/G,GAAL,CAAS8G,WAAT,CAAqBrH,YAAY,CAACY,SAAb,CAAuB0G,GAAvB,CAArB;EACD;;AA5UH"}
|
1
|
+
{"version":3,"names":["ckEnum","getCkEnum","HostObject","JsiSkPaint","JsiSkRect","JsiSkRRect","JsiSkImage","JsiSkVertices","JsiSkPath","JsiSkFont","JsiSkTextBlob","JsiSkPicture","JsiSkMatrix","JsiSkImageFilter","JsiSkPoint","JsiSkCanvas","constructor","CanvasKit","ref","delete","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","undefined","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","drawPicture","skp","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 { ckEnum, getCkEnum, 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 ckEnum(fm),\n ckEnum(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 ckEnum(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 ckEnum(fm),\n ckEnum(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 ckEnum(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 ? ckEnum(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 ckEnum(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(color, blendMode ? ckEnum(blendMode) : undefined);\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(JsiSkPath.fromValue(path), ckEnum(op), doAntiAlias);\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n ckEnum(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 ckEnum(op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix) {\n this.ref.concat(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: getCkEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),\n colorType: getCkEnum(this.CanvasKit.ColorType, imageInfo.colorType),\n };\n return this.ref.readPixels(srcX, srcY, pxInfo);\n }\n}\n"],"mappings":";;AA2BA,SAASA,MAAT,EAAiBC,SAAjB,EAA4BC,UAA5B,QAA8C,QAA9C;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,WAAN,SACGb,UADH,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,CACEhB,SAAS,CAACmB,SAAV,CAAoB,KAAKN,SAAzB,EAAoCI,IAApC,CADF,EAEElB,UAAU,CAACoB,SAAX,CAAqBD,KAArB,CAFF;EAID;;EAEDE,SAAS,CAACC,KAAD,EAAiBC,CAAjB,EAA4BC,CAA5B,EAAuCL,KAAvC,EAAwD;IAC/D,KAAKJ,GAAL,CAASM,SAAT,CACElB,UAAU,CAACiB,SAAX,CAAqBE,KAArB,CADF,EAEEC,CAFF,EAGEC,CAHF,EAIEL,KAAK,GAAGnB,UAAU,CAACoB,SAAX,CAAq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AqBrH,YAAY,CAACY,SAAb,CAAuB0G,GAAvB,CAArB;EACD;;EAEDC,UAAU,CAACC,IAAD,EAAeC,IAAf,EAA6BC,SAA7B,EAAmD;IAC3D,MAAMC,MAAM,GAAG;MACbC,KAAK,EAAEF,SAAS,CAACE,KADJ;MAEbC,MAAM,EAAEH,SAAS,CAACG,MAFL;MAGbC,UAAU,EAAE,KAAKxH,SAAL,CAAeyH,UAAf,CAA0BC,IAHzB;MAIbC,SAAS,EAAE3I,SAAS,CAAC,KAAKgB,SAAL,CAAe4H,SAAhB,EAA2BR,SAAS,CAACO,SAArC,CAJP;MAKbE,SAAS,EAAE7I,SAAS,CAAC,KAAKgB,SAAL,CAAe8H,SAAhB,EAA2BV,SAAS,CAACS,SAArC;IALP,CAAf;IAOA,OAAO,KAAK5H,GAAL,CAASgH,UAAT,CAAoBC,IAApB,EAA0BC,IAA1B,EAAgCE,MAAhC,CAAP;EACD;;AAvVH"}
|
@@ -10,9 +10,7 @@ export class JsiSkFontMgrFactory extends Host {
|
|
10
10
|
|
11
11
|
if (!fontMgr) {
|
12
12
|
throw new Error("Couldn't create system font manager");
|
13
|
-
}
|
14
|
-
// @ts-expect-error
|
15
|
-
|
13
|
+
}
|
16
14
|
|
17
15
|
return new JsiSkFontMgr(this.CanvasKit, fontMgr);
|
18
16
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Host","JsiSkFontMgr","JsiSkFontMgrFactory","constructor","CanvasKit","System","fontMgr","TypefaceFontProvider","Make","Error"],"sources":["JsiSkFontMgrFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { FontMgrFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkFontMgr } from \"./JsiSkFontMgr\";\n\nexport class JsiSkFontMgrFactory extends Host implements FontMgrFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n System() {\n const fontMgr = this.CanvasKit.TypefaceFontProvider.Make();\n if (!fontMgr) {\n throw new Error(\"Couldn't create system font manager\");\n }\n
|
1
|
+
{"version":3,"names":["Host","JsiSkFontMgr","JsiSkFontMgrFactory","constructor","CanvasKit","System","fontMgr","TypefaceFontProvider","Make","Error"],"sources":["JsiSkFontMgrFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { FontMgrFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkFontMgr } from \"./JsiSkFontMgr\";\n\nexport class JsiSkFontMgrFactory extends Host implements FontMgrFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n System() {\n const fontMgr = this.CanvasKit.TypefaceFontProvider.Make();\n if (!fontMgr) {\n throw new Error(\"Couldn't create system font manager\");\n }\n return new JsiSkFontMgr(this.CanvasKit, fontMgr);\n }\n}\n"],"mappings":"AAIA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,OAAO,MAAMC,mBAAN,SAAkCF,IAAlC,CAAiE;EACtEG,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,MAAM,GAAG;IACP,MAAMC,OAAO,GAAG,KAAKF,SAAL,CAAeG,oBAAf,CAAoCC,IAApC,EAAhB;;IACA,IAAI,CAACF,OAAL,EAAc;MACZ,MAAM,IAAIG,KAAJ,CAAU,qCAAV,CAAN;IACD;;IACD,OAAO,IAAIR,YAAJ,CAAiB,KAAKG,SAAtB,EAAiCE,OAAjC,CAAP;EACD;;AAXqE"}
|
@@ -1,15 +1,17 @@
|
|
1
1
|
import type { CanvasKit, Image } from "canvaskit-wasm";
|
2
|
-
import type {
|
2
|
+
import type { FilterMode, MipmapMode, SkImage, SkMatrix, SkShader, TileMode, ImageFormat, ImageInfo } from "../types";
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare const toBase64String: (bytes: Uint8Array) => string;
|
5
5
|
export declare class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
6
6
|
constructor(CanvasKit: CanvasKit, ref: Image);
|
7
7
|
height(): number;
|
8
8
|
width(): number;
|
9
|
+
getImageInfo(): ImageInfo;
|
9
10
|
makeShaderOptions(tx: TileMode, ty: TileMode, fm: FilterMode, mm: MipmapMode, localMatrix?: SkMatrix): SkShader;
|
10
11
|
makeShaderCubic(tx: TileMode, ty: TileMode, B: number, C: number, localMatrix?: SkMatrix): SkShader;
|
11
12
|
encodeToBytes(fmt?: ImageFormat, quality?: number): Uint8Array;
|
12
13
|
encodeToBase64(fmt?: ImageFormat, quality?: number): string;
|
14
|
+
readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo): Float32Array | Uint8Array | null;
|
13
15
|
dispose: () => void;
|
14
16
|
makeNonTextureImage(): SkImage;
|
15
17
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
2
|
|
3
|
-
import { ckEnum, HostObject } from "./Host";
|
3
|
+
import { ckEnum, getCkEnum, HostObject } from "./Host";
|
4
4
|
import { JsiSkMatrix } from "./JsiSkMatrix";
|
5
5
|
import { JsiSkShader } from "./JsiSkShader"; // https://github.com/google/skia/blob/1f193df9b393d50da39570dab77a0bb5d28ec8ef/modules/canvaskit/htmlcanvas/util.js
|
6
6
|
|
@@ -49,6 +49,16 @@ export class JsiSkImage extends HostObject {
|
|
49
49
|
return this.ref.width();
|
50
50
|
}
|
51
51
|
|
52
|
+
getImageInfo() {
|
53
|
+
const info = this.ref.getImageInfo();
|
54
|
+
return {
|
55
|
+
width: info.width,
|
56
|
+
height: info.height,
|
57
|
+
colorType: info.colorType.value,
|
58
|
+
alphaType: info.alphaType.value
|
59
|
+
};
|
60
|
+
}
|
61
|
+
|
52
62
|
makeShaderOptions(tx, ty, fm, mm, localMatrix) {
|
53
63
|
return new JsiSkShader(this.CanvasKit, this.ref.makeShaderOptions(ckEnum(tx), ckEnum(ty), ckEnum(fm), ckEnum(mm), localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined));
|
54
64
|
}
|
@@ -80,6 +90,26 @@ export class JsiSkImage extends HostObject {
|
|
80
90
|
return toBase64String(bytes);
|
81
91
|
}
|
82
92
|
|
93
|
+
readPixels(srcX, srcY, imageInfo) {
|
94
|
+
var _imageInfo$width, _imageInfo$height;
|
95
|
+
|
96
|
+
const info = this.getImageInfo();
|
97
|
+
console.log({
|
98
|
+
alphaType: ckEnum(info.alphaType),
|
99
|
+
colorType: ckEnum(info.colorType),
|
100
|
+
realAlphaType: this.CanvasKit.AlphaType.Opaque.value,
|
101
|
+
realColorType: this.CanvasKit.ColorType.RGBA_8888.value
|
102
|
+
});
|
103
|
+
const pxInfo = {
|
104
|
+
colorSpace: this.CanvasKit.ColorSpace.SRGB,
|
105
|
+
width: (_imageInfo$width = imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.width) !== null && _imageInfo$width !== void 0 ? _imageInfo$width : info.width,
|
106
|
+
height: (_imageInfo$height = imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.height) !== null && _imageInfo$height !== void 0 ? _imageInfo$height : info.height,
|
107
|
+
alphaType: getCkEnum(this.CanvasKit.AlphaType, (imageInfo !== null && imageInfo !== void 0 ? imageInfo : info).alphaType),
|
108
|
+
colorType: getCkEnum(this.CanvasKit.ColorType, (imageInfo !== null && imageInfo !== void 0 ? imageInfo : info).colorType)
|
109
|
+
};
|
110
|
+
return this.ref.readPixels(srcX !== null && srcX !== void 0 ? srcX : 0, srcY !== null && srcY !== void 0 ? srcY : 0, pxInfo);
|
111
|
+
}
|
112
|
+
|
83
113
|
makeNonTextureImage() {
|
84
114
|
return new JsiSkImage(this.CanvasKit, this.CanvasKit.MakeImageFromEncoded(this.encodeToBytes()));
|
85
115
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ckEnum","HostObject","JsiSkMatrix","JsiSkShader","toBase64String","bytes","Buffer","from","toString","CHUNK_SIZE","index","length","result","slice","Math","min","String","fromCharCode","apply","btoa","JsiSkImage","constructor","CanvasKit","ref","delete","height","width","makeShaderOptions","tx","ty","fm","mm","localMatrix","fromValue","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","quality","Error","encodeToBase64","makeNonTextureImage","MakeImageFromEncoded"],"sources":["JsiSkImage.ts"],"sourcesContent":["import type {
|
1
|
+
{"version":3,"names":["ckEnum","getCkEnum","HostObject","JsiSkMatrix","JsiSkShader","toBase64String","bytes","Buffer","from","toString","CHUNK_SIZE","index","length","result","slice","Math","min","String","fromCharCode","apply","btoa","JsiSkImage","constructor","CanvasKit","ref","delete","height","width","getImageInfo","info","colorType","value","alphaType","makeShaderOptions","tx","ty","fm","mm","localMatrix","fromValue","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","quality","Error","encodeToBase64","readPixels","srcX","srcY","imageInfo","console","log","realAlphaType","AlphaType","Opaque","realColorType","ColorType","RGBA_8888","pxInfo","colorSpace","ColorSpace","SRGB","makeNonTextureImage","MakeImageFromEncoded"],"sources":["JsiSkImage.ts"],"sourcesContent":["import type {\n CanvasKit,\n ImageInfo as CKImageInfo,\n Image,\n} from \"canvaskit-wasm\";\n\nimport type {\n FilterMode,\n MipmapMode,\n SkImage,\n SkMatrix,\n SkShader,\n TileMode,\n ImageFormat,\n ImageInfo,\n} from \"../types\";\n\nimport { ckEnum, getCkEnum, HostObject } from \"./Host\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\n// https://github.com/google/skia/blob/1f193df9b393d50da39570dab77a0bb5d28ec8ef/modules/canvaskit/htmlcanvas/util.js\nexport const toBase64String = (bytes: Uint8Array) => {\n if (typeof Buffer !== \"undefined\") {\n // Are we on node?\n return Buffer.from(bytes).toString(\"base64\");\n } else {\n // From https://stackoverflow.com/a/25644409\n // because the naive solution of\n // btoa(String.fromCharCode.apply(null, bytes));\n // would occasionally throw \"Maximum call stack size exceeded\"\n var CHUNK_SIZE = 0x8000; //arbitrary number\n var index = 0;\n var { length } = bytes;\n var result = \"\";\n var slice;\n while (index < length) {\n slice = bytes.slice(index, Math.min(index + CHUNK_SIZE, length));\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result += String.fromCharCode.apply(null, slice as any);\n index += CHUNK_SIZE;\n }\n return btoa(result);\n }\n};\n\nexport class JsiSkImage extends HostObject<Image, \"Image\"> implements SkImage {\n constructor(CanvasKit: CanvasKit, ref: Image) {\n super(CanvasKit, ref, \"Image\");\n }\n\n height() {\n return this.ref.height();\n }\n\n width() {\n return this.ref.width();\n }\n\n getImageInfo(): ImageInfo {\n const info = this.ref.getImageInfo();\n return {\n width: info.width,\n height: info.height,\n colorType: info.colorType.value,\n alphaType: info.alphaType.value,\n };\n }\n\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderOptions(\n ckEnum(tx),\n ckEnum(ty),\n ckEnum(fm),\n ckEnum(mm),\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderCubic(\n ckEnum(tx),\n ckEnum(ty),\n B,\n C,\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n encodeToBytes(fmt?: ImageFormat, quality?: number) {\n let result: Uint8Array | null;\n if (fmt && quality) {\n result = this.ref.encodeToBytes(ckEnum(fmt), quality);\n } else if (fmt) {\n result = this.ref.encodeToBytes(ckEnum(fmt));\n } else {\n result = this.ref.encodeToBytes();\n }\n if (!result) {\n throw new Error(\"encodeToBytes failed\");\n }\n return result;\n }\n\n encodeToBase64(fmt?: ImageFormat, quality?: number) {\n const bytes = this.encodeToBytes(fmt, quality);\n return toBase64String(bytes);\n }\n\n readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo) {\n const info = this.getImageInfo();\n console.log({\n alphaType: ckEnum(info.alphaType),\n colorType: ckEnum(info.colorType),\n realAlphaType: this.CanvasKit.AlphaType.Opaque.value,\n realColorType: this.CanvasKit.ColorType.RGBA_8888.value,\n });\n const pxInfo: CKImageInfo = {\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n width: imageInfo?.width ?? info.width,\n height: imageInfo?.height ?? info.height,\n alphaType: getCkEnum(\n this.CanvasKit.AlphaType,\n (imageInfo ?? info).alphaType\n ),\n colorType: getCkEnum(\n this.CanvasKit.ColorType,\n (imageInfo ?? info).colorType\n ),\n };\n return this.ref.readPixels(srcX ?? 0, srcY ?? 0, pxInfo);\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n makeNonTextureImage(): SkImage {\n return new JsiSkImage(\n this.CanvasKit,\n this.CanvasKit.MakeImageFromEncoded(this.encodeToBytes())!\n );\n }\n}\n"],"mappings":";;AAiBA,SAASA,MAAT,EAAiBC,SAAjB,EAA4BC,UAA5B,QAA8C,QAA9C;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,WAAT,QAA4B,eAA5B,C,CAEA;;AACA,OAAO,MAAMC,cAAc,GAAIC,KAAD,IAAuB;EACnD,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;IACjC;IACA,OAAOA,MAAM,CAACC,IAAP,CAAYF,KAAZ,EAAmBG,QAAnB,CAA4B,QAA5B,CAAP;EACD,CAHD,MAGO;IACL;IACA;IACA;IACA;IACA,IAAIC,UAAU,GAAG,MAAjB,CALK,CAKoB;;IACzB,IAAIC,KAAK,GAAG,CAAZ;IACA,IAAI;MAAEC;IAAF,IAAaN,KAAjB;IACA,IAAIO,MAAM,GAAG,EAAb;IACA,IAAIC,KAAJ;;IACA,OAAOH,KAAK,GAAGC,MAAf,EAAuB;MACr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AAKtB,aAAL,EAApC,CAFK,CAAP;EAID;;AAlH2E"}
|
@@ -6,8 +6,8 @@ export declare class JsiSkTypefaceFontProvider extends HostObject<TypefaceFontPr
|
|
6
6
|
private allocatedPointers;
|
7
7
|
constructor(CanvasKit: CanvasKit, ref: TypefaceFontProvider);
|
8
8
|
matchFamilyStyle(_name: string, _style: FontStyle): SkTypeface;
|
9
|
-
countFamilies():
|
10
|
-
getFamilyName(index: number):
|
9
|
+
countFamilies(): number;
|
10
|
+
getFamilyName(index: number): string;
|
11
11
|
registerFont(typeface: SkTypeface, familyName: string): void;
|
12
12
|
dispose(): void;
|
13
13
|
}
|
@@ -13,14 +13,10 @@ export class JsiSkTypefaceFontProvider extends HostObject {
|
|
13
13
|
}
|
14
14
|
|
15
15
|
countFamilies() {
|
16
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
17
|
-
// @ts-expect-error
|
18
16
|
return this.ref.countFamilies();
|
19
17
|
}
|
20
18
|
|
21
19
|
getFamilyName(index) {
|
22
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
23
|
-
// @ts-expect-error
|
24
20
|
return this.ref.getFamilyName(index);
|
25
21
|
}
|
26
22
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["HostObject","NotImplementedOnRNWeb","JsiSkTypefaceFontProvider","constructor","CanvasKit","ref","matchFamilyStyle","_name","_style","countFamilies","getFamilyName","index","registerFont","typeface","familyName","strLen","lengthBytesUTF8","strPtr","_malloc","stringToUTF8","_registerFont","dispose","ptr","allocatedPointers","_free","delete","str","encoder","TextEncoder","utf8","encode","length","outPtr","maxBytesToWrite","heap","HEAPU8","Error","i"],"sources":["JsiSkTypefaceFontProvider.ts"],"sourcesContent":["import type { CanvasKit, TypefaceFontProvider } from \"canvaskit-wasm\";\n\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\nimport type { FontStyle, SkTypeface } from \"../types\";\n\nimport { HostObject, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkTypefaceFontProvider\n extends HostObject<TypefaceFontProvider, \"FontMgr\">\n implements SkTypefaceFontProvider\n{\n private allocatedPointers: number[] = [];\n\n constructor(CanvasKit: CanvasKit, ref: TypefaceFontProvider) {\n super(CanvasKit, ref, \"FontMgr\");\n }\n\n matchFamilyStyle(_name: string, _style: FontStyle): SkTypeface {\n throw new NotImplementedOnRNWeb();\n }\n countFamilies() {\n
|
1
|
+
{"version":3,"names":["HostObject","NotImplementedOnRNWeb","JsiSkTypefaceFontProvider","constructor","CanvasKit","ref","matchFamilyStyle","_name","_style","countFamilies","getFamilyName","index","registerFont","typeface","familyName","strLen","lengthBytesUTF8","strPtr","_malloc","stringToUTF8","_registerFont","dispose","ptr","allocatedPointers","_free","delete","str","encoder","TextEncoder","utf8","encode","length","outPtr","maxBytesToWrite","heap","HEAPU8","Error","i"],"sources":["JsiSkTypefaceFontProvider.ts"],"sourcesContent":["import type { CanvasKit, TypefaceFontProvider } from \"canvaskit-wasm\";\n\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\nimport type { FontStyle, SkTypeface } from \"../types\";\n\nimport { HostObject, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkTypefaceFontProvider\n extends HostObject<TypefaceFontProvider, \"FontMgr\">\n implements SkTypefaceFontProvider\n{\n private allocatedPointers: number[] = [];\n\n constructor(CanvasKit: CanvasKit, ref: TypefaceFontProvider) {\n super(CanvasKit, ref, \"FontMgr\");\n }\n\n matchFamilyStyle(_name: string, _style: FontStyle): SkTypeface {\n throw new NotImplementedOnRNWeb();\n }\n countFamilies() {\n return this.ref.countFamilies();\n }\n getFamilyName(index: number) {\n return this.ref.getFamilyName(index);\n }\n registerFont(typeface: SkTypeface, familyName: string) {\n const strLen = lengthBytesUTF8(familyName) + 1;\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n const strPtr = this.CanvasKit._malloc(strLen);\n stringToUTF8(this.CanvasKit, familyName, strPtr, strLen);\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n this.ref._registerFont(typeface.ref, strPtr);\n }\n\n dispose() {\n for (const ptr of this.allocatedPointers) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n this.CanvasKit._free(ptr);\n }\n\n this.ref.delete();\n }\n}\n\nconst lengthBytesUTF8 = (str: string) => {\n // TextEncoder will give us the byte length in UTF8 form\n const encoder = new TextEncoder();\n const utf8 = encoder.encode(str);\n return utf8.length;\n};\n\nconst stringToUTF8 = (\n CanvasKit: CanvasKit,\n str: string,\n outPtr: number,\n maxBytesToWrite: number\n) => {\n // TextEncoder will give us the byte array in UTF8 form\n const encoder = new TextEncoder();\n const utf8 = encoder.encode(str);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n const heap: Int8Array = CanvasKit.HEAPU8;\n\n // Check if there's enough space\n if (utf8.length > maxBytesToWrite) {\n throw new Error(\"Not enough space to write UTF8 encoded string\");\n }\n\n // Copy the bytes\n for (let i = 0; i < utf8.length; i++) {\n heap[outPtr + i] = utf8[i];\n }\n\n // Null terminate\n if (utf8.length < maxBytesToWrite) {\n heap[outPtr + utf8.length] = 0;\n }\n};\n"],"mappings":";;AAKA,SAASA,UAAT,EAAqBC,qBAArB,QAAkD,QAAlD;AAEA,OAAO,MAAMC,yBAAN,SACGF,UADH,CAGP;EAGEG,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAkD;IAC3D,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;;IAD2D,2CAFvB,EAEuB;EAE5D;;EAEDC,gBAAgB,CAACC,KAAD,EAAgBC,MAAhB,EAA+C;IAC7D,MAAM,IAAIP,qBAAJ,EAAN;EACD;;EACDQ,aAAa,GAAG;IACd,OAAO,KAAKJ,GAAL,CAASI,aAAT,EAAP;EACD;;EACDC,aAAa,CAACC,KAAD,EAAgB;IAC3B,OAAO,KA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K,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGR,IAAI,CAACE,MAAzB,EAAiCM,CAAC,EAAlC,EAAsC;IACpCH,IAAI,CAACF,MAAM,GAAGK,CAAV,CAAJ,GAAmBR,IAAI,CAACQ,CAAD,CAAvB;EACD,CAhBE,CAkBH;;;EACA,IAAIR,IAAI,CAACE,MAAL,GAAcE,eAAlB,EAAmC;IACjCC,IAAI,CAACF,MAAM,GAAGH,IAAI,CAACE,MAAf,CAAJ,GAA6B,CAA7B;EACD;AACF,CA3BD"}
|
@@ -2,7 +2,7 @@ import type { SkPaint } from "./Paint";
|
|
2
2
|
import type { SkRect } from "./Rect";
|
3
3
|
import type { SkFont } from "./Font";
|
4
4
|
import type { SkPath } from "./Path";
|
5
|
-
import type { SkImage, MipmapMode, FilterMode } from "./Image";
|
5
|
+
import type { SkImage, MipmapMode, FilterMode, ImageInfo } from "./Image";
|
6
6
|
import type { SkSVG } from "./SVG";
|
7
7
|
import type { SkColor } from "./Color";
|
8
8
|
import type { SkRRect } from "./RRect";
|
@@ -378,4 +378,12 @@ export interface SkCanvas {
|
|
378
378
|
* @param skp
|
379
379
|
*/
|
380
380
|
drawPicture(skp: SkPicture): void;
|
381
|
+
/** Read Image pixels
|
382
|
+
*
|
383
|
+
* @param srcX - x-axis upper left corner of the rectangle to read from
|
384
|
+
* @param srcY - y-axis upper left corner of the rectangle to read from
|
385
|
+
* @param imageInfo - describes the pixel format and dimensions of the data to read into
|
386
|
+
* @return Float32Array or Uint8Array with data or null if the read failed.
|
387
|
+
*/
|
388
|
+
readPixels(srcX: number, srcY: number, imageInfo: ImageInfo): Float32Array | Uint8Array | null;
|
381
389
|
}
|
@@ -2,6 +2,7 @@ import type { SkMatrix } from "../Matrix";
|
|
2
2
|
import type { SkJSIInstance } from "../JsiInstance";
|
3
3
|
import type { TileMode } from "../ImageFilter";
|
4
4
|
import type { SkShader } from "../Shader";
|
5
|
+
import type { ImageInfo } from "./ImageFactory";
|
5
6
|
export declare enum FilterMode {
|
6
7
|
Nearest = 0,
|
7
8
|
Linear = 1
|
@@ -25,6 +26,10 @@ export interface SkImage extends SkJSIInstance<"Image"> {
|
|
25
26
|
* Returns the possibly scaled width of the image.
|
26
27
|
*/
|
27
28
|
width(): number;
|
29
|
+
/**
|
30
|
+
* Returns the ImageInfo describing the image.
|
31
|
+
*/
|
32
|
+
getImageInfo(): ImageInfo;
|
28
33
|
/**
|
29
34
|
* Returns this image as a shader with the specified tiling. It will use cubic sampling.
|
30
35
|
* @param tx - tile mode in the x direction.
|
@@ -72,6 +77,14 @@ export interface SkImage extends SkJSIInstance<"Image"> {
|
|
72
77
|
@return base64 encoded string of data
|
73
78
|
*/
|
74
79
|
encodeToBase64(fmt?: ImageFormat, quality?: number): string;
|
80
|
+
/** Read Image pixels
|
81
|
+
*
|
82
|
+
* @param srcX - optional x-axis upper left corner of the rectangle to read from
|
83
|
+
* @param srcY - optional y-axis upper left corner of the rectangle to read from
|
84
|
+
* @param imageInfo - optional describes the pixel format and dimensions of the data to read into
|
85
|
+
* @return Float32Array or Uint8Array with data or null if the read failed.
|
86
|
+
*/
|
87
|
+
readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo): Float32Array | Uint8Array | null;
|
75
88
|
/**
|
76
89
|
* Returns raster image or lazy image. Copies SkImage backed by GPU texture
|
77
90
|
* into CPU memory if needed. Returns original SkImage if decoded in raster
|
@@ -19,17 +19,20 @@ export declare enum ColorType {
|
|
19
19
|
RGB_101010x = 9,
|
20
20
|
BGR_101010x = 10,
|
21
21
|
BGR_101010x_XR = 11,
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
RGBA_10x6 = 12,
|
23
|
+
Gray_8 = 13,
|
24
|
+
RGBA_F16Norm = 14,
|
25
|
+
RGBA_F16 = 15,
|
26
|
+
RGBA_F32 = 16,
|
27
|
+
R8G8_unorm = 17,
|
28
|
+
A16_float = 18,
|
29
|
+
R16G16_float = 19,
|
30
|
+
A16_unorm = 20,
|
31
|
+
R16G16_unorm = 21,
|
32
|
+
R16G16B16A16_unorm = 22,
|
33
|
+
SRGBA_8888 = 23,
|
34
|
+
R8_unorm = 24,
|
35
|
+
N32_SkColorType = 25
|
33
36
|
}
|
34
37
|
export interface ImageInfo {
|
35
38
|
alphaType: AlphaType;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { CanvasKit, EmbindEnumEntity } from "canvaskit-wasm";
|
1
|
+
import type { CanvasKit, EmbindEnumEntity, EmbindEnum } from "canvaskit-wasm";
|
2
2
|
import type { SkJSIInstance } from "../types";
|
3
3
|
export declare class NotImplementedOnRNWeb extends Error {
|
4
4
|
constructor(msg?: string);
|
@@ -16,5 +16,6 @@ export declare abstract class BaseHostObject<T, N extends string> extends Host i
|
|
16
16
|
export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
|
17
17
|
static fromValue<T>(value: SkJSIInstance<string>): T;
|
18
18
|
}
|
19
|
+
export declare const getCkEnum: (e: EmbindEnum, v: number) => EmbindEnumEntity;
|
19
20
|
export declare const ckEnum: (value: number) => EmbindEnumEntity;
|
20
21
|
export declare const optEnum: (value: number | undefined) => EmbindEnumEntity | undefined;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Canvas, CanvasKit } from "canvaskit-wasm";
|
2
|
-
import type { BlendMode, ClipOp, FilterMode, MipmapMode, PointMode, SaveLayerFlag, SkCanvas, SkColor, SkFont, SkImage, SkImageFilter, SkMatrix, SkPaint, SkPath, SkPicture, SkPoint, SkRect, SkRRect, SkSVG, SkTextBlob, SkVertices } from "../types";
|
2
|
+
import type { BlendMode, ClipOp, FilterMode, MipmapMode, PointMode, SaveLayerFlag, ImageInfo, SkCanvas, SkColor, SkFont, SkImage, SkImageFilter, SkMatrix, SkPaint, SkPath, SkPicture, SkPoint, SkRect, SkRRect, 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);
|
@@ -42,4 +42,5 @@ export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements
|
|
42
42
|
clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean): void;
|
43
43
|
concat(m: SkMatrix): void;
|
44
44
|
drawPicture(skp: SkPicture): void;
|
45
|
+
readPixels(srcX: number, srcY: number, imageInfo: ImageInfo): Float32Array | Uint8Array | null;
|
45
46
|
}
|
@@ -1,15 +1,17 @@
|
|
1
1
|
import type { CanvasKit, Image } from "canvaskit-wasm";
|
2
|
-
import type {
|
2
|
+
import type { FilterMode, MipmapMode, SkImage, SkMatrix, SkShader, TileMode, ImageFormat, ImageInfo } from "../types";
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
export declare const toBase64String: (bytes: Uint8Array) => string;
|
5
5
|
export declare class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
|
6
6
|
constructor(CanvasKit: CanvasKit, ref: Image);
|
7
7
|
height(): number;
|
8
8
|
width(): number;
|
9
|
+
getImageInfo(): ImageInfo;
|
9
10
|
makeShaderOptions(tx: TileMode, ty: TileMode, fm: FilterMode, mm: MipmapMode, localMatrix?: SkMatrix): SkShader;
|
10
11
|
makeShaderCubic(tx: TileMode, ty: TileMode, B: number, C: number, localMatrix?: SkMatrix): SkShader;
|
11
12
|
encodeToBytes(fmt?: ImageFormat, quality?: number): Uint8Array;
|
12
13
|
encodeToBase64(fmt?: ImageFormat, quality?: number): string;
|
14
|
+
readPixels(srcX?: number, srcY?: number, imageInfo?: ImageInfo): Float32Array | Uint8Array | null;
|
13
15
|
dispose: () => void;
|
14
16
|
makeNonTextureImage(): SkImage;
|
15
17
|
}
|
@@ -6,8 +6,8 @@ export declare class JsiSkTypefaceFontProvider extends HostObject<TypefaceFontPr
|
|
6
6
|
private allocatedPointers;
|
7
7
|
constructor(CanvasKit: CanvasKit, ref: TypefaceFontProvider);
|
8
8
|
matchFamilyStyle(_name: string, _style: FontStyle): SkTypeface;
|
9
|
-
countFamilies():
|
10
|
-
getFamilyName(index: number):
|
9
|
+
countFamilies(): number;
|
10
|
+
getFamilyName(index: number): string;
|
11
11
|
registerFont(typeface: SkTypeface, familyName: string): void;
|
12
12
|
dispose(): void;
|
13
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.
|
10
|
+
"version": "0.1.221",
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
12
12
|
"main": "lib/module/index.js",
|
13
13
|
"files": [
|
@@ -106,7 +106,7 @@
|
|
106
106
|
"ws": "^8.11.0"
|
107
107
|
},
|
108
108
|
"dependencies": {
|
109
|
-
"canvaskit-wasm": "0.
|
109
|
+
"canvaskit-wasm": "0.39.1",
|
110
110
|
"react-reconciler": "^0.27.0"
|
111
111
|
},
|
112
112
|
"eslintIgnore": [
|
package/src/skia/types/Canvas.ts
CHANGED
@@ -2,7 +2,7 @@ import type { SkPaint } from "./Paint";
|
|
2
2
|
import type { SkRect } from "./Rect";
|
3
3
|
import type { SkFont } from "./Font";
|
4
4
|
import type { SkPath } from "./Path";
|
5
|
-
import type { SkImage, MipmapMode, FilterMode } from "./Image";
|
5
|
+
import type { SkImage, MipmapMode, FilterMode, ImageInfo } from "./Image";
|
6
6
|
import type { SkSVG } from "./SVG";
|
7
7
|
import type { SkColor } from "./Color";
|
8
8
|
import type { SkRRect } from "./RRect";
|
@@ -492,4 +492,17 @@ export interface SkCanvas {
|
|
492
492
|
* @param skp
|
493
493
|
*/
|
494
494
|
drawPicture(skp: SkPicture): void;
|
495
|
+
|
496
|
+
/** Read Image pixels
|
497
|
+
*
|
498
|
+
* @param srcX - x-axis upper left corner of the rectangle to read from
|
499
|
+
* @param srcY - y-axis upper left corner of the rectangle to read from
|
500
|
+
* @param imageInfo - describes the pixel format and dimensions of the data to read into
|
501
|
+
* @return Float32Array or Uint8Array with data or null if the read failed.
|
502
|
+
*/
|
503
|
+
readPixels(
|
504
|
+
srcX: number,
|
505
|
+
srcY: number,
|
506
|
+
imageInfo: ImageInfo
|
507
|
+
): Float32Array | Uint8Array | null;
|
495
508
|
}
|
@@ -3,6 +3,8 @@ import type { SkJSIInstance } from "../JsiInstance";
|
|
3
3
|
import type { TileMode } from "../ImageFilter";
|
4
4
|
import type { SkShader } from "../Shader";
|
5
5
|
|
6
|
+
import type { ImageInfo } from "./ImageFactory";
|
7
|
+
|
6
8
|
export enum FilterMode {
|
7
9
|
Nearest,
|
8
10
|
Linear,
|
@@ -31,6 +33,11 @@ export interface SkImage extends SkJSIInstance<"Image"> {
|
|
31
33
|
*/
|
32
34
|
width(): number;
|
33
35
|
|
36
|
+
/**
|
37
|
+
* Returns the ImageInfo describing the image.
|
38
|
+
*/
|
39
|
+
getImageInfo(): ImageInfo;
|
40
|
+
|
34
41
|
/**
|
35
42
|
* Returns this image as a shader with the specified tiling. It will use cubic sampling.
|
36
43
|
* @param tx - tile mode in the x direction.
|
@@ -94,6 +101,19 @@ export interface SkImage extends SkJSIInstance<"Image"> {
|
|
94
101
|
*/
|
95
102
|
encodeToBase64(fmt?: ImageFormat, quality?: number): string;
|
96
103
|
|
104
|
+
/** Read Image pixels
|
105
|
+
*
|
106
|
+
* @param srcX - optional x-axis upper left corner of the rectangle to read from
|
107
|
+
* @param srcY - optional y-axis upper left corner of the rectangle to read from
|
108
|
+
* @param imageInfo - optional describes the pixel format and dimensions of the data to read into
|
109
|
+
* @return Float32Array or Uint8Array with data or null if the read failed.
|
110
|
+
*/
|
111
|
+
readPixels(
|
112
|
+
srcX?: number,
|
113
|
+
srcY?: number,
|
114
|
+
imageInfo?: ImageInfo
|
115
|
+
): Float32Array | Uint8Array | null;
|
116
|
+
|
97
117
|
/**
|
98
118
|
* Returns raster image or lazy image. Copies SkImage backed by GPU texture
|
99
119
|
* into CPU memory if needed. Returns original SkImage if decoded in raster
|
@@ -10,36 +10,41 @@ export enum AlphaType {
|
|
10
10
|
}
|
11
11
|
|
12
12
|
export enum ColorType {
|
13
|
-
Unknown,
|
14
|
-
Alpha_8,
|
15
|
-
RGB_565,
|
16
|
-
ARGB_4444,
|
17
|
-
RGBA_8888,
|
18
|
-
RGB_888x,
|
19
|
-
BGRA_8888,
|
20
|
-
RGBA_1010102,
|
21
|
-
BGRA_1010102,
|
22
|
-
RGB_101010x,
|
23
|
-
BGR_101010x,
|
24
|
-
BGR_101010x_XR,
|
25
|
-
|
26
|
-
|
27
|
-
//
|
28
|
-
RGBA_F16,
|
29
|
-
//
|
30
|
-
RGBA_F32, //!< pixel using C float for red, green, blue, alpha; in 128-bit word
|
13
|
+
Unknown, // uninitialized
|
14
|
+
Alpha_8, // pixel with alpha in 8-bit byte
|
15
|
+
RGB_565, // pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
|
16
|
+
ARGB_4444, // pixel with 4 bits for alpha, red, green, blue; in 16-bit word
|
17
|
+
RGBA_8888, // pixel with 8 bits for red, green, blue, alpha; in 32-bit word
|
18
|
+
RGB_888x, // pixel with 8 bits each for red, green, blue; in 32-bit word
|
19
|
+
BGRA_8888, // pixel with 8 bits for blue, green, red, alpha; in 32-bit word
|
20
|
+
RGBA_1010102, // 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word
|
21
|
+
BGRA_1010102, // 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word
|
22
|
+
RGB_101010x, // pixel with 10 bits each for red, green, blue; in 32-bit word
|
23
|
+
BGR_101010x, // pixel with 10 bits each for blue, green, red; in 32-bit word
|
24
|
+
BGR_101010x_XR, // pixel with 10 bits each for blue, green, red; in 32-bit word, extended range
|
25
|
+
RGBA_10x6, // pixel with 10 used bits (most significant) followed by 6 unused
|
26
|
+
Gray_8, // pixel with grayscale level in 8-bit byte
|
27
|
+
RGBA_F16Norm, // pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word
|
28
|
+
RGBA_F16, // pixel with half floats for red, green, blue, alpha; in 64-bit word
|
29
|
+
RGBA_F32, // pixel using C float for red, green, blue, alpha; in 128-bit word
|
31
30
|
|
32
31
|
// The following 6 colortypes are just for reading from - not for rendering to
|
33
|
-
R8G8_unorm,
|
32
|
+
R8G8_unorm, // pixel with a uint8_t for red and green
|
34
33
|
|
35
|
-
A16_float,
|
36
|
-
R16G16_float,
|
34
|
+
A16_float, // pixel with a half float for alpha
|
35
|
+
R16G16_float, // pixel with a half float for red and green
|
36
|
+
|
37
|
+
A16_unorm, // pixel with a little endian uint16_t for alpha
|
38
|
+
R16G16_unorm, // pixel with a little endian uint16_t for red and green
|
39
|
+
R16G16B16A16_unorm, // pixel with a little endian uint16_t for red, green, blue, and alpha
|
37
40
|
|
38
|
-
A16_unorm, //!< pixel with a little endian uint16_t for alpha
|
39
|
-
R16G16_unorm, //!< pixel with a little endian uint16_t for red and green
|
40
|
-
R16G16B16A16_unorm, //!< pixel with a little endian uint16_t for red, green, blue
|
41
|
-
// and alpha
|
42
41
|
SRGBA_8888,
|
42
|
+
R8_unorm,
|
43
|
+
|
44
|
+
// The `kN32_SkColorType` is platform dependent in the original enum,
|
45
|
+
// and TypeScript doesn't support conditional compilation natively.
|
46
|
+
// You might need to handle it differently based on your use case.
|
47
|
+
N32_SkColorType, // either BGRA_8888 or RGBA_8888 based on the platform
|
43
48
|
}
|
44
49
|
|
45
50
|
export interface ImageInfo {
|