@shopify/react-native-skia 2.5.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cpp/api/recorder/Drawings.h +1 -1
- package/lib/commonjs/dom/types/Drawings.d.ts +1 -0
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js +2 -2
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/dom/types/Drawings.d.ts +1 -0
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.js +2 -2
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/typescript/src/dom/types/Drawings.d.ts +1 -0
- package/package.json +1 -1
- package/react-native-skia.podspec +77 -94
- package/src/dom/types/Drawings.ts +1 -0
- package/src/sksg/Recorder/commands/Drawing.ts +3 -2
|
@@ -935,7 +935,7 @@ public:
|
|
|
935
935
|
convertProperty(runtime, object, "sprites", props.sprites, variables);
|
|
936
936
|
convertProperty(runtime, object, "transforms", props.transforms, variables);
|
|
937
937
|
convertProperty(runtime, object, "colors", props.colors, variables);
|
|
938
|
-
convertProperty(runtime, object, "
|
|
938
|
+
convertProperty(runtime, object, "colorBlendMode", props.blendMode, variables);
|
|
939
939
|
convertProperty(runtime, object, "sampling", props.sampling, variables);
|
|
940
940
|
}
|
|
941
941
|
|
|
@@ -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 SkRSXform,\n SkColor,\n SamplingOptions,\n SkSkottieAnimation,\n SkImageFilter,\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 sampling?: SamplingOptions;\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 AtlasProps extends DrawingNodeProps {\n image: SkImage | null;\n sprites: SkRect[];\n transforms: SkRSXform[];\n colors?: SkColor[];\n sampling?: SamplingOptions;\n}\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 SkottieProps extends DrawingNodeProps {\n animation: SkSkottieAnimation;\n frame: number;\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\nexport interface ImageFilterProps extends GroupProps {\n filter: SkImageFilter;\n}\n"],"mappings":"","ignoreList":[]}
|
|
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 SkRSXform,\n SkColor,\n SamplingOptions,\n SkSkottieAnimation,\n SkImageFilter,\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 sampling?: SamplingOptions;\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 AtlasProps extends DrawingNodeProps {\n image: SkImage | null;\n sprites: SkRect[];\n transforms: SkRSXform[];\n colors?: SkColor[];\n colorBlendMode?: SkEnum<typeof BlendMode>;\n sampling?: SamplingOptions;\n}\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 SkottieProps extends DrawingNodeProps {\n animation: SkSkottieAnimation;\n frame: number;\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\nexport interface ImageFilterProps extends GroupProps {\n filter: SkImageFilter;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -318,10 +318,10 @@ const drawAtlas = (ctx, props) => {
|
|
|
318
318
|
sprites,
|
|
319
319
|
transforms,
|
|
320
320
|
colors,
|
|
321
|
-
|
|
321
|
+
colorBlendMode,
|
|
322
322
|
sampling
|
|
323
323
|
} = props;
|
|
324
|
-
const blend =
|
|
324
|
+
const blend = colorBlendMode ? _types.BlendMode[(0, _nodes.enumKey)(colorBlendMode)] : undefined;
|
|
325
325
|
if (image) {
|
|
326
326
|
ctx.canvas.drawAtlas(image, sprites, transforms, ctx.paint, blend, colors, sampling);
|
|
327
327
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nodes","require","_processors","_types","drawLine","ctx","props","p1","p2","canvas","x","y","paint","exports","drawOval","rect","processRect","Skia","drawImage","image","sampling","_props$fit","fit","src","dst","fitRects","width","height","isCubicSampling","drawImageRectCubic","B","C","_sampling$filter","_sampling$mipmap","drawImageRectOptions","filter","FilterMode","Linear","mipmap","MipmapMode","None","drawPoints","points","mode","PointMode","enumKey","drawVertices","textures","colors","indices","blendMode","vertexMode","VertexMode","Triangles","vertices","MakeVertices","map","c","processColor","undefined","defaultBlendMode","BlendMode","DstOver","SrcOver","blend","drawDiffRect","outer","inner","drawDRRect","drawTextPath","path","processPath","font","initialOffset","text","ids","getGlyphIDs","widths","getGlyphWidths","rsx","meas","ContourMeasureIter","cont","next","dist","i","length","substring","p","t","getPosTan","adjustedX","adjustedY","push","RSXform","derived","TextBlob","MakeFromRSXform","drawTextBlob","drawText","drawPatch","texture","patch","pos","c2","c1","drawPath","start","trimStart","end","trimEnd","fillType","stroke","pathProps","Math","fround","saturate","hasStartOffset","hasEndOffset","hasStrokeOptions","hasFillType","willMutatePath","pristinePath","copy","setFillType","FillType","trim","drawRect","drawRRect","processRRect","blob","drawGlyphs","glyphs","reduce","acc","glyph","id","positions","drawImageSVG","svg","save","translate","drawSvg","restore","drawParagraph","paragraph","layout","drawPicture","picture","drawAtlas","sprites","transforms","drawCircle","processCircle","r","drawSkottie","animation","frame","seekFrame","render"],"sources":["Drawing.ts"],"sourcesContent":["import {\n enumKey,\n fitRects,\n processCircle,\n processColor,\n processPath,\n processRect,\n processRRect,\n} from \"../../../dom/nodes\";\nimport type {\n AtlasProps,\n CircleProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n OvalProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n SkottieProps,\n TextBlobProps,\n TextPathProps,\n TextProps,\n VerticesProps,\n} from \"../../../dom/types\";\nimport { saturate } from \"../../../renderer/processors\";\nimport type { SkPoint, SkRSXform } from \"../../../skia/types\";\nimport {\n BlendMode,\n FillType,\n FilterMode,\n isCubicSampling,\n MipmapMode,\n PointMode,\n VertexMode,\n} from \"../../../skia/types\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nexport const drawLine = (ctx: DrawingContext, props: LineProps) => {\n \"worklet\";\n const { p1, p2 } = props;\n ctx.canvas.drawLine(p1.x, p1.y, p2.x, p2.y, ctx.paint);\n};\n\nexport const drawOval = (ctx: DrawingContext, props: OvalProps) => {\n \"worklet\";\n const rect = processRect(ctx.Skia, props);\n ctx.canvas.drawOval(rect, ctx.paint);\n};\n\nexport const drawImage = (ctx: DrawingContext, props: ImageProps) => {\n \"worklet\";\n const { image, sampling } = props;\n if (image) {\n const fit = props.fit ?? \"contain\";\n const rect = processRect(ctx.Skia, props);\n const { src, dst } = fitRects(\n fit,\n {\n x: 0,\n y: 0,\n width: image.width(),\n height: image.height(),\n },\n rect\n );\n if (sampling && isCubicSampling(sampling)) {\n ctx.canvas.drawImageRectCubic(\n image,\n src,\n dst,\n sampling.B,\n sampling.C,\n ctx.paint\n );\n } else {\n ctx.canvas.drawImageRectOptions(\n image,\n src,\n dst,\n sampling?.filter ?? FilterMode.Linear,\n sampling?.mipmap ?? MipmapMode.None,\n ctx.paint\n );\n }\n }\n};\n\nexport const drawPoints = (ctx: DrawingContext, props: PointsProps) => {\n \"worklet\";\n const { points, mode } = props;\n ctx.canvas.drawPoints(PointMode[enumKey(mode)], points, ctx.paint);\n};\n\nexport const drawVertices = (ctx: DrawingContext, props: VerticesProps) => {\n \"worklet\";\n const { mode, textures, colors, indices, blendMode } = props;\n const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;\n const vertices = ctx.Skia.MakeVertices(\n vertexMode,\n props.vertices,\n textures,\n colors ? colors.map((c) => processColor(ctx.Skia, c)) : undefined,\n indices\n );\n const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n\n ctx.canvas.drawVertices(vertices, blend, ctx.paint);\n};\n\nexport const drawDiffRect = (ctx: DrawingContext, props: DiffRectProps) => {\n \"worklet\";\n const { outer, inner } = props;\n ctx.canvas.drawDRRect(outer, inner, ctx.paint);\n};\n\nexport const drawTextPath = (ctx: DrawingContext, props: TextPathProps) => {\n \"worklet\";\n const path = processPath(ctx.Skia, props.path);\n const { font, initialOffset } = props;\n if (font) {\n let { text } = props;\n const ids = font.getGlyphIDs(text);\n const widths = font.getGlyphWidths(ids);\n const rsx: SkRSXform[] = [];\n const meas = ctx.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(ctx.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));\n dist += width / 2;\n }\n const derived = ctx.Skia.TextBlob.MakeFromRSXform(text, rsx, font);\n ctx.canvas.drawTextBlob(derived, 0, 0, ctx.paint);\n }\n};\n\nexport const drawText = (ctx: DrawingContext, props: TextProps) => {\n \"worklet\";\n const { text, x, y, font } = props;\n if (font != null) {\n ctx.canvas.drawText(text, x, y, ctx.paint, font);\n }\n};\n\nexport const drawPatch = (ctx: DrawingContext, props: PatchProps) => {\n \"worklet\";\n const { texture, blendMode, patch } = props;\n const defaultBlendMode = props.colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const mode = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n // Patch requires a path with the following constraints:\n // M tl\n // C c1 c2 br\n // C c1 c2 bl\n // C c1 c2 tl (the redundant point in the last command is removed)\n\n const points = [\n patch[0].pos,\n patch[0].c2,\n patch[1].c1,\n patch[1].pos,\n patch[1].c2,\n patch[2].c1,\n patch[2].pos,\n patch[2].c2,\n patch[3].c1,\n patch[3].pos,\n patch[3].c2,\n patch[0].c1,\n ];\n const colors = props.colors\n ? props.colors.map((c) => processColor(ctx.Skia, c))\n : undefined;\n ctx.canvas.drawPatch(points, colors, texture, mode, ctx.paint);\n};\n\nexport const drawPath = (ctx: DrawingContext, props: PathProps) => {\n \"worklet\";\n const {\n start: trimStart,\n end: trimEnd,\n fillType,\n stroke,\n ...pathProps\n } = props;\n const start = Math.fround(saturate(trimStart));\n const end = Math.fround(saturate(trimEnd));\n const hasStartOffset = start !== 0;\n const hasEndOffset = end !== 1;\n const hasStrokeOptions = stroke !== undefined;\n const hasFillType = !!fillType;\n const willMutatePath =\n hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;\n const pristinePath = processPath(ctx.Skia, pathProps.path);\n const path = willMutatePath ? pristinePath.copy() : pristinePath;\n if (hasFillType) {\n path.setFillType(FillType[enumKey(fillType)]);\n }\n if (hasStrokeOptions) {\n path.stroke(stroke);\n }\n if (hasStartOffset || hasEndOffset) {\n path.trim(start, end, false);\n }\n ctx.canvas.drawPath(path, ctx.paint);\n};\n\nexport const drawRect = (ctx: DrawingContext, props: RectProps) => {\n \"worklet\";\n const derived = processRect(ctx.Skia, props);\n ctx.canvas.drawRect(derived, ctx.paint);\n};\n\nexport const drawRRect = (ctx: DrawingContext, props: RoundedRectProps) => {\n \"worklet\";\n const derived = processRRect(ctx.Skia, props);\n ctx.canvas.drawRRect(derived, ctx.paint);\n};\n\nexport const drawTextBlob = (ctx: DrawingContext, props: TextBlobProps) => {\n \"worklet\";\n const { blob, x, y } = props;\n ctx.canvas.drawTextBlob(blob, x, y, ctx.paint);\n};\n\ninterface ProcessedGlyphs {\n glyphs: number[];\n positions: SkPoint[];\n}\n\nexport const drawGlyphs = (ctx: DrawingContext, props: GlyphsProps) => {\n \"worklet\";\n const derived = 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 const { glyphs, positions } = derived;\n const { x, y, font } = props;\n if (font) {\n ctx.canvas.drawGlyphs(glyphs, positions, x, y, font, ctx.paint);\n }\n};\n\nexport const drawImageSVG = (ctx: DrawingContext, props: ImageSVGProps) => {\n \"worklet\";\n const { canvas } = ctx;\n const { svg } = props;\n const { x, y, width, height } = props.rect\n ? props.rect\n : { x: props.x, y: props.y, width: props.width, height: props.height };\n if (svg === null) {\n return;\n }\n canvas.save();\n if (x && y) {\n canvas.translate(x, y);\n }\n canvas.drawSvg(svg, width, height);\n canvas.restore();\n};\n\nexport const drawParagraph = (ctx: DrawingContext, props: ParagraphProps) => {\n \"worklet\";\n const { paragraph, x, y, width } = props;\n if (paragraph) {\n paragraph.layout(width);\n paragraph.paint(ctx.canvas, x, y);\n }\n};\n\nexport const drawPicture = (ctx: DrawingContext, props: PictureProps) => {\n \"worklet\";\n const { picture } = props;\n ctx.canvas.drawPicture(picture);\n};\n\nexport const drawAtlas = (ctx: DrawingContext, props: AtlasProps) => {\n \"worklet\";\n const { image, sprites, transforms, colors, blendMode, sampling } = props;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : undefined;\n if (image) {\n ctx.canvas.drawAtlas(\n image,\n sprites,\n transforms,\n ctx.paint,\n blend,\n colors,\n sampling\n );\n }\n};\n\nexport const drawCircle = (ctx: DrawingContext, props: CircleProps) => {\n \"worklet\";\n const { c } = processCircle(props);\n const { r } = props;\n ctx.canvas.drawCircle(c.x, c.y, r, ctx.paint);\n};\n\nexport const drawSkottie = (ctx: DrawingContext, props: SkottieProps) => {\n \"worklet\";\n const { animation, frame } = props;\n if (animation) {\n props.animation.seekFrame(frame);\n props.animation.render(ctx.canvas);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AA+BA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAWO,MAAMG,QAAQ,GAAGA,CAACC,GAAmB,EAAEC,KAAgB,KAAK;EACjE,SAAS;;EACT,MAAM;IAAEC,EAAE;IAAEC;EAAG,CAAC,GAAGF,KAAK;EACxBD,GAAG,CAACI,MAAM,CAACL,QAAQ,CAACG,EAAE,CAACG,CAAC,EAAEH,EAAE,CAACI,CAAC,EAAEH,EAAE,CAACE,CAAC,EAAEF,EAAE,CAACG,CAAC,EAAEN,GAAG,CAACO,KAAK,CAAC;AACxD,CAAC;AAACC,OAAA,CAAAT,QAAA,GAAAA,QAAA;AAEK,MAAMU,QAA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AAC;IAChCvJ,KAAK,CAACsJ,SAAS,CAACG,MAAM,CAAC1J,GAAG,CAACI,MAAM,CAAC;EACpC;AACF,CAAC;AAACI,OAAA,CAAA8I,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_nodes","require","_processors","_types","drawLine","ctx","props","p1","p2","canvas","x","y","paint","exports","drawOval","rect","processRect","Skia","drawImage","image","sampling","_props$fit","fit","src","dst","fitRects","width","height","isCubicSampling","drawImageRectCubic","B","C","_sampling$filter","_sampling$mipmap","drawImageRectOptions","filter","FilterMode","Linear","mipmap","MipmapMode","None","drawPoints","points","mode","PointMode","enumKey","drawVertices","textures","colors","indices","blendMode","vertexMode","VertexMode","Triangles","vertices","MakeVertices","map","c","processColor","undefined","defaultBlendMode","BlendMode","DstOver","SrcOver","blend","drawDiffRect","outer","inner","drawDRRect","drawTextPath","path","processPath","font","initialOffset","text","ids","getGlyphIDs","widths","getGlyphWidths","rsx","meas","ContourMeasureIter","cont","next","dist","i","length","substring","p","t","getPosTan","adjustedX","adjustedY","push","RSXform","derived","TextBlob","MakeFromRSXform","drawTextBlob","drawText","drawPatch","texture","patch","pos","c2","c1","drawPath","start","trimStart","end","trimEnd","fillType","stroke","pathProps","Math","fround","saturate","hasStartOffset","hasEndOffset","hasStrokeOptions","hasFillType","willMutatePath","pristinePath","copy","setFillType","FillType","trim","drawRect","drawRRect","processRRect","blob","drawGlyphs","glyphs","reduce","acc","glyph","id","positions","drawImageSVG","svg","save","translate","drawSvg","restore","drawParagraph","paragraph","layout","drawPicture","picture","drawAtlas","sprites","transforms","colorBlendMode","drawCircle","processCircle","r","drawSkottie","animation","frame","seekFrame","render"],"sources":["Drawing.ts"],"sourcesContent":["import {\n enumKey,\n fitRects,\n processCircle,\n processColor,\n processPath,\n processRect,\n processRRect,\n} from \"../../../dom/nodes\";\nimport type {\n AtlasProps,\n CircleProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n OvalProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n SkottieProps,\n TextBlobProps,\n TextPathProps,\n TextProps,\n VerticesProps,\n} from \"../../../dom/types\";\nimport { saturate } from \"../../../renderer/processors\";\nimport type { SkPoint, SkRSXform } from \"../../../skia/types\";\nimport {\n BlendMode,\n FillType,\n FilterMode,\n isCubicSampling,\n MipmapMode,\n PointMode,\n VertexMode,\n} from \"../../../skia/types\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nexport const drawLine = (ctx: DrawingContext, props: LineProps) => {\n \"worklet\";\n const { p1, p2 } = props;\n ctx.canvas.drawLine(p1.x, p1.y, p2.x, p2.y, ctx.paint);\n};\n\nexport const drawOval = (ctx: DrawingContext, props: OvalProps) => {\n \"worklet\";\n const rect = processRect(ctx.Skia, props);\n ctx.canvas.drawOval(rect, ctx.paint);\n};\n\nexport const drawImage = (ctx: DrawingContext, props: ImageProps) => {\n \"worklet\";\n const { image, sampling } = props;\n if (image) {\n const fit = props.fit ?? \"contain\";\n const rect = processRect(ctx.Skia, props);\n const { src, dst } = fitRects(\n fit,\n {\n x: 0,\n y: 0,\n width: image.width(),\n height: image.height(),\n },\n rect\n );\n if (sampling && isCubicSampling(sampling)) {\n ctx.canvas.drawImageRectCubic(\n image,\n src,\n dst,\n sampling.B,\n sampling.C,\n ctx.paint\n );\n } else {\n ctx.canvas.drawImageRectOptions(\n image,\n src,\n dst,\n sampling?.filter ?? FilterMode.Linear,\n sampling?.mipmap ?? MipmapMode.None,\n ctx.paint\n );\n }\n }\n};\n\nexport const drawPoints = (ctx: DrawingContext, props: PointsProps) => {\n \"worklet\";\n const { points, mode } = props;\n ctx.canvas.drawPoints(PointMode[enumKey(mode)], points, ctx.paint);\n};\n\nexport const drawVertices = (ctx: DrawingContext, props: VerticesProps) => {\n \"worklet\";\n const { mode, textures, colors, indices, blendMode } = props;\n const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;\n const vertices = ctx.Skia.MakeVertices(\n vertexMode,\n props.vertices,\n textures,\n colors ? colors.map((c) => processColor(ctx.Skia, c)) : undefined,\n indices\n );\n const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n\n ctx.canvas.drawVertices(vertices, blend, ctx.paint);\n};\n\nexport const drawDiffRect = (ctx: DrawingContext, props: DiffRectProps) => {\n \"worklet\";\n const { outer, inner } = props;\n ctx.canvas.drawDRRect(outer, inner, ctx.paint);\n};\n\nexport const drawTextPath = (ctx: DrawingContext, props: TextPathProps) => {\n \"worklet\";\n const path = processPath(ctx.Skia, props.path);\n const { font, initialOffset } = props;\n if (font) {\n let { text } = props;\n const ids = font.getGlyphIDs(text);\n const widths = font.getGlyphWidths(ids);\n const rsx: SkRSXform[] = [];\n const meas = ctx.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(ctx.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));\n dist += width / 2;\n }\n const derived = ctx.Skia.TextBlob.MakeFromRSXform(text, rsx, font);\n ctx.canvas.drawTextBlob(derived, 0, 0, ctx.paint);\n }\n};\n\nexport const drawText = (ctx: DrawingContext, props: TextProps) => {\n \"worklet\";\n const { text, x, y, font } = props;\n if (font != null) {\n ctx.canvas.drawText(text, x, y, ctx.paint, font);\n }\n};\n\nexport const drawPatch = (ctx: DrawingContext, props: PatchProps) => {\n \"worklet\";\n const { texture, blendMode, patch } = props;\n const defaultBlendMode = props.colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const mode = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n // Patch requires a path with the following constraints:\n // M tl\n // C c1 c2 br\n // C c1 c2 bl\n // C c1 c2 tl (the redundant point in the last command is removed)\n\n const points = [\n patch[0].pos,\n patch[0].c2,\n patch[1].c1,\n patch[1].pos,\n patch[1].c2,\n patch[2].c1,\n patch[2].pos,\n patch[2].c2,\n patch[3].c1,\n patch[3].pos,\n patch[3].c2,\n patch[0].c1,\n ];\n const colors = props.colors\n ? props.colors.map((c) => processColor(ctx.Skia, c))\n : undefined;\n ctx.canvas.drawPatch(points, colors, texture, mode, ctx.paint);\n};\n\nexport const drawPath = (ctx: DrawingContext, props: PathProps) => {\n \"worklet\";\n const {\n start: trimStart,\n end: trimEnd,\n fillType,\n stroke,\n ...pathProps\n } = props;\n const start = Math.fround(saturate(trimStart));\n const end = Math.fround(saturate(trimEnd));\n const hasStartOffset = start !== 0;\n const hasEndOffset = end !== 1;\n const hasStrokeOptions = stroke !== undefined;\n const hasFillType = !!fillType;\n const willMutatePath =\n hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;\n const pristinePath = processPath(ctx.Skia, pathProps.path);\n const path = willMutatePath ? pristinePath.copy() : pristinePath;\n if (hasFillType) {\n path.setFillType(FillType[enumKey(fillType)]);\n }\n if (hasStrokeOptions) {\n path.stroke(stroke);\n }\n if (hasStartOffset || hasEndOffset) {\n path.trim(start, end, false);\n }\n ctx.canvas.drawPath(path, ctx.paint);\n};\n\nexport const drawRect = (ctx: DrawingContext, props: RectProps) => {\n \"worklet\";\n const derived = processRect(ctx.Skia, props);\n ctx.canvas.drawRect(derived, ctx.paint);\n};\n\nexport const drawRRect = (ctx: DrawingContext, props: RoundedRectProps) => {\n \"worklet\";\n const derived = processRRect(ctx.Skia, props);\n ctx.canvas.drawRRect(derived, ctx.paint);\n};\n\nexport const drawTextBlob = (ctx: DrawingContext, props: TextBlobProps) => {\n \"worklet\";\n const { blob, x, y } = props;\n ctx.canvas.drawTextBlob(blob, x, y, ctx.paint);\n};\n\ninterface ProcessedGlyphs {\n glyphs: number[];\n positions: SkPoint[];\n}\n\nexport const drawGlyphs = (ctx: DrawingContext, props: GlyphsProps) => {\n \"worklet\";\n const derived = 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 const { glyphs, positions } = derived;\n const { x, y, font } = props;\n if (font) {\n ctx.canvas.drawGlyphs(glyphs, positions, x, y, font, ctx.paint);\n }\n};\n\nexport const drawImageSVG = (ctx: DrawingContext, props: ImageSVGProps) => {\n \"worklet\";\n const { canvas } = ctx;\n const { svg } = props;\n const { x, y, width, height } = props.rect\n ? props.rect\n : { x: props.x, y: props.y, width: props.width, height: props.height };\n if (svg === null) {\n return;\n }\n canvas.save();\n if (x && y) {\n canvas.translate(x, y);\n }\n canvas.drawSvg(svg, width, height);\n canvas.restore();\n};\n\nexport const drawParagraph = (ctx: DrawingContext, props: ParagraphProps) => {\n \"worklet\";\n const { paragraph, x, y, width } = props;\n if (paragraph) {\n paragraph.layout(width);\n paragraph.paint(ctx.canvas, x, y);\n }\n};\n\nexport const drawPicture = (ctx: DrawingContext, props: PictureProps) => {\n \"worklet\";\n const { picture } = props;\n ctx.canvas.drawPicture(picture);\n};\n\nexport const drawAtlas = (ctx: DrawingContext, props: AtlasProps) => {\n \"worklet\";\n const { image, sprites, transforms, colors, colorBlendMode, sampling } =\n props;\n const blend = colorBlendMode ? BlendMode[enumKey(colorBlendMode)] : undefined;\n if (image) {\n ctx.canvas.drawAtlas(\n image,\n sprites,\n transforms,\n ctx.paint,\n blend,\n colors,\n sampling\n );\n }\n};\n\nexport const drawCircle = (ctx: DrawingContext, props: CircleProps) => {\n \"worklet\";\n const { c } = processCircle(props);\n const { r } = props;\n ctx.canvas.drawCircle(c.x, c.y, r, ctx.paint);\n};\n\nexport const drawSkottie = (ctx: DrawingContext, props: SkottieProps) => {\n \"worklet\";\n const { animation, frame } = props;\n if (animation) {\n props.animation.seekFrame(frame);\n props.animation.render(ctx.canvas);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AA+BA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAWO,MAAMG,QAAQ,GAAGA,CAACC,GAAmB,EAAEC,KAAgB,KAAK;EACjE,SAAS;;EACT,MAAM;IAAEC,EAAE;IAAEC;EAAG,CAAC,GAAGF,KAAK;EACxBD,GAAG,CAACI,MAAM,CAACL,QAAQ,CAACG,EAAE,CAACG,CAAC,EAAEH,EAAE,CAACI,CAAC,EAAEH,EAAE,CAACE,CAAC,EAAEF,EAAE,CAACG,CAAC,EAAEN,GAAG,CAACO,KAAK,CAAC;AACxD,CAAC;AAACC,OAAA,CAAAT,QAAA,GAAAA,QAAA;AAEK,MAAMU,QAAQ,GAAGA,CAACT,GAAmB,EAAEC,KAAgB,KAAK;EACjE,SAAS;;EACT,MAAMS,IAAI,GAAG,IAAAC,kBAAW,EAACX,GAAG,CAACY,IAAI,EAAEX,KAAK,CAAC;EACzCD,GAAG,CAACI,MAAM,CAACK,QAAQ,CAACC,IAAI,EAAEV,GAAG,CAACO,KAAK,CAAC;AACtC,CAAC;AAACC,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAEK,MAAMI,SAAS,GAAGA,CAACb,GAAmB,EAAEC,KAAiB,KAAK;EACnE,SAAS;;EACT,MAAM;IAAEa,KAAK;IAAEC;EAAS,CAAC,GAAGd,KAAK;EACjC,IAAIa,KAAK,EAAE;IAAA,IAAAE,UAAA;IACT,MAAMC,GAAG,IAAAD,UAAA,GAAGf,KAAK,CAACgB,GAAG,cAAAD,UAAA,cAAAA,UAAA,GAAI,SAAS;IAClC,MAAMN,IAAI,GAAG,IAAAC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AACF,CAAC;AAACP,OAAA,CAAAwI,SAAA,GAAAA,SAAA;AAEK,MAAMI,UAAU,GAAGA,CAACpJ,GAAmB,EAAEC,KAAkB,KAAK;EACrE,SAAS;;EACT,MAAM;IAAEmD;EAAE,CAAC,GAAG,IAAAiG,oBAAa,EAACpJ,KAAK,CAAC;EAClC,MAAM;IAAEqJ;EAAE,CAAC,GAAGrJ,KAAK;EACnBD,GAAG,CAACI,MAAM,CAACgJ,UAAU,CAAChG,CAAC,CAAC/C,CAAC,EAAE+C,CAAC,CAAC9C,CAAC,EAAEgJ,CAAC,EAAEtJ,GAAG,CAACO,KAAK,CAAC;AAC/C,CAAC;AAACC,OAAA,CAAA4I,UAAA,GAAAA,UAAA;AAEK,MAAMG,WAAW,GAAGA,CAACvJ,GAAmB,EAAEC,KAAmB,KAAK;EACvE,SAAS;;EACT,MAAM;IAAEuJ,SAAS;IAAEC;EAAM,CAAC,GAAGxJ,KAAK;EAClC,IAAIuJ,SAAS,EAAE;IACbvJ,KAAK,CAACuJ,SAAS,CAACE,SAAS,CAACD,KAAK,CAAC;IAChCxJ,KAAK,CAACuJ,SAAS,CAACG,MAAM,CAAC3J,GAAG,CAACI,MAAM,CAAC;EACpC;AACF,CAAC;AAACI,OAAA,CAAA+I,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -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 SkRSXform,\n SkColor,\n SamplingOptions,\n SkSkottieAnimation,\n SkImageFilter,\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 sampling?: SamplingOptions;\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 AtlasProps extends DrawingNodeProps {\n image: SkImage | null;\n sprites: SkRect[];\n transforms: SkRSXform[];\n colors?: SkColor[];\n sampling?: SamplingOptions;\n}\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 SkottieProps extends DrawingNodeProps {\n animation: SkSkottieAnimation;\n frame: number;\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\nexport interface ImageFilterProps extends GroupProps {\n filter: SkImageFilter;\n}\n"],"mappings":"","ignoreList":[]}
|
|
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 SkRSXform,\n SkColor,\n SamplingOptions,\n SkSkottieAnimation,\n SkImageFilter,\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 sampling?: SamplingOptions;\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 AtlasProps extends DrawingNodeProps {\n image: SkImage | null;\n sprites: SkRect[];\n transforms: SkRSXform[];\n colors?: SkColor[];\n colorBlendMode?: SkEnum<typeof BlendMode>;\n sampling?: SamplingOptions;\n}\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 SkottieProps extends DrawingNodeProps {\n animation: SkSkottieAnimation;\n frame: number;\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\nexport interface ImageFilterProps extends GroupProps {\n filter: SkImageFilter;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -295,10 +295,10 @@ export const drawAtlas = (ctx, props) => {
|
|
|
295
295
|
sprites,
|
|
296
296
|
transforms,
|
|
297
297
|
colors,
|
|
298
|
-
|
|
298
|
+
colorBlendMode,
|
|
299
299
|
sampling
|
|
300
300
|
} = props;
|
|
301
|
-
const blend =
|
|
301
|
+
const blend = colorBlendMode ? BlendMode[enumKey(colorBlendMode)] : undefined;
|
|
302
302
|
if (image) {
|
|
303
303
|
ctx.canvas.drawAtlas(image, sprites, transforms, ctx.paint, blend, colors, sampling);
|
|
304
304
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["enumKey","fitRects","processCircle","processColor","processPath","processRect","processRRect","saturate","BlendMode","FillType","FilterMode","isCubicSampling","MipmapMode","PointMode","VertexMode","drawLine","ctx","props","p1","p2","canvas","x","y","paint","drawOval","rect","Skia","drawImage","image","sampling","_props$fit","fit","src","dst","width","height","drawImageRectCubic","B","C","_sampling$filter","_sampling$mipmap","drawImageRectOptions","filter","Linear","mipmap","None","drawPoints","points","mode","drawVertices","textures","colors","indices","blendMode","vertexMode","Triangles","vertices","MakeVertices","map","c","undefined","defaultBlendMode","DstOver","SrcOver","blend","drawDiffRect","outer","inner","drawDRRect","drawTextPath","path","font","initialOffset","text","ids","getGlyphIDs","widths","getGlyphWidths","rsx","meas","ContourMeasureIter","cont","next","dist","i","length","substring","p","t","getPosTan","adjustedX","adjustedY","push","RSXform","derived","TextBlob","MakeFromRSXform","drawTextBlob","drawText","drawPatch","texture","patch","pos","c2","c1","drawPath","start","trimStart","end","trimEnd","fillType","stroke","pathProps","Math","fround","hasStartOffset","hasEndOffset","hasStrokeOptions","hasFillType","willMutatePath","pristinePath","copy","setFillType","trim","drawRect","drawRRect","blob","drawGlyphs","glyphs","reduce","acc","glyph","id","positions","drawImageSVG","svg","save","translate","drawSvg","restore","drawParagraph","paragraph","layout","drawPicture","picture","drawAtlas","sprites","transforms","drawCircle","r","drawSkottie","animation","frame","seekFrame","render"],"sources":["Drawing.ts"],"sourcesContent":["import {\n enumKey,\n fitRects,\n processCircle,\n processColor,\n processPath,\n processRect,\n processRRect,\n} from \"../../../dom/nodes\";\nimport type {\n AtlasProps,\n CircleProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n OvalProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n SkottieProps,\n TextBlobProps,\n TextPathProps,\n TextProps,\n VerticesProps,\n} from \"../../../dom/types\";\nimport { saturate } from \"../../../renderer/processors\";\nimport type { SkPoint, SkRSXform } from \"../../../skia/types\";\nimport {\n BlendMode,\n FillType,\n FilterMode,\n isCubicSampling,\n MipmapMode,\n PointMode,\n VertexMode,\n} from \"../../../skia/types\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nexport const drawLine = (ctx: DrawingContext, props: LineProps) => {\n \"worklet\";\n const { p1, p2 } = props;\n ctx.canvas.drawLine(p1.x, p1.y, p2.x, p2.y, ctx.paint);\n};\n\nexport const drawOval = (ctx: DrawingContext, props: OvalProps) => {\n \"worklet\";\n const rect = processRect(ctx.Skia, props);\n ctx.canvas.drawOval(rect, ctx.paint);\n};\n\nexport const drawImage = (ctx: DrawingContext, props: ImageProps) => {\n \"worklet\";\n const { image, sampling } = props;\n if (image) {\n const fit = props.fit ?? \"contain\";\n const rect = processRect(ctx.Skia, props);\n const { src, dst } = fitRects(\n fit,\n {\n x: 0,\n y: 0,\n width: image.width(),\n height: image.height(),\n },\n rect\n );\n if (sampling && isCubicSampling(sampling)) {\n ctx.canvas.drawImageRectCubic(\n image,\n src,\n dst,\n sampling.B,\n sampling.C,\n ctx.paint\n );\n } else {\n ctx.canvas.drawImageRectOptions(\n image,\n src,\n dst,\n sampling?.filter ?? FilterMode.Linear,\n sampling?.mipmap ?? MipmapMode.None,\n ctx.paint\n );\n }\n }\n};\n\nexport const drawPoints = (ctx: DrawingContext, props: PointsProps) => {\n \"worklet\";\n const { points, mode } = props;\n ctx.canvas.drawPoints(PointMode[enumKey(mode)], points, ctx.paint);\n};\n\nexport const drawVertices = (ctx: DrawingContext, props: VerticesProps) => {\n \"worklet\";\n const { mode, textures, colors, indices, blendMode } = props;\n const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;\n const vertices = ctx.Skia.MakeVertices(\n vertexMode,\n props.vertices,\n textures,\n colors ? colors.map((c) => processColor(ctx.Skia, c)) : undefined,\n indices\n );\n const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n\n ctx.canvas.drawVertices(vertices, blend, ctx.paint);\n};\n\nexport const drawDiffRect = (ctx: DrawingContext, props: DiffRectProps) => {\n \"worklet\";\n const { outer, inner } = props;\n ctx.canvas.drawDRRect(outer, inner, ctx.paint);\n};\n\nexport const drawTextPath = (ctx: DrawingContext, props: TextPathProps) => {\n \"worklet\";\n const path = processPath(ctx.Skia, props.path);\n const { font, initialOffset } = props;\n if (font) {\n let { text } = props;\n const ids = font.getGlyphIDs(text);\n const widths = font.getGlyphWidths(ids);\n const rsx: SkRSXform[] = [];\n const meas = ctx.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(ctx.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));\n dist += width / 2;\n }\n const derived = ctx.Skia.TextBlob.MakeFromRSXform(text, rsx, font);\n ctx.canvas.drawTextBlob(derived, 0, 0, ctx.paint);\n }\n};\n\nexport const drawText = (ctx: DrawingContext, props: TextProps) => {\n \"worklet\";\n const { text, x, y, font } = props;\n if (font != null) {\n ctx.canvas.drawText(text, x, y, ctx.paint, font);\n }\n};\n\nexport const drawPatch = (ctx: DrawingContext, props: PatchProps) => {\n \"worklet\";\n const { texture, blendMode, patch } = props;\n const defaultBlendMode = props.colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const mode = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n // Patch requires a path with the following constraints:\n // M tl\n // C c1 c2 br\n // C c1 c2 bl\n // C c1 c2 tl (the redundant point in the last command is removed)\n\n const points = [\n patch[0].pos,\n patch[0].c2,\n patch[1].c1,\n patch[1].pos,\n patch[1].c2,\n patch[2].c1,\n patch[2].pos,\n patch[2].c2,\n patch[3].c1,\n patch[3].pos,\n patch[3].c2,\n patch[0].c1,\n ];\n const colors = props.colors\n ? props.colors.map((c) => processColor(ctx.Skia, c))\n : undefined;\n ctx.canvas.drawPatch(points, colors, texture, mode, ctx.paint);\n};\n\nexport const drawPath = (ctx: DrawingContext, props: PathProps) => {\n \"worklet\";\n const {\n start: trimStart,\n end: trimEnd,\n fillType,\n stroke,\n ...pathProps\n } = props;\n const start = Math.fround(saturate(trimStart));\n const end = Math.fround(saturate(trimEnd));\n const hasStartOffset = start !== 0;\n const hasEndOffset = end !== 1;\n const hasStrokeOptions = stroke !== undefined;\n const hasFillType = !!fillType;\n const willMutatePath =\n hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;\n const pristinePath = processPath(ctx.Skia, pathProps.path);\n const path = willMutatePath ? pristinePath.copy() : pristinePath;\n if (hasFillType) {\n path.setFillType(FillType[enumKey(fillType)]);\n }\n if (hasStrokeOptions) {\n path.stroke(stroke);\n }\n if (hasStartOffset || hasEndOffset) {\n path.trim(start, end, false);\n }\n ctx.canvas.drawPath(path, ctx.paint);\n};\n\nexport const drawRect = (ctx: DrawingContext, props: RectProps) => {\n \"worklet\";\n const derived = processRect(ctx.Skia, props);\n ctx.canvas.drawRect(derived, ctx.paint);\n};\n\nexport const drawRRect = (ctx: DrawingContext, props: RoundedRectProps) => {\n \"worklet\";\n const derived = processRRect(ctx.Skia, props);\n ctx.canvas.drawRRect(derived, ctx.paint);\n};\n\nexport const drawTextBlob = (ctx: DrawingContext, props: TextBlobProps) => {\n \"worklet\";\n const { blob, x, y } = props;\n ctx.canvas.drawTextBlob(blob, x, y, ctx.paint);\n};\n\ninterface ProcessedGlyphs {\n glyphs: number[];\n positions: SkPoint[];\n}\n\nexport const drawGlyphs = (ctx: DrawingContext, props: GlyphsProps) => {\n \"worklet\";\n const derived = 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 const { glyphs, positions } = derived;\n const { x, y, font } = props;\n if (font) {\n ctx.canvas.drawGlyphs(glyphs, positions, x, y, font, ctx.paint);\n }\n};\n\nexport const drawImageSVG = (ctx: DrawingContext, props: ImageSVGProps) => {\n \"worklet\";\n const { canvas } = ctx;\n const { svg } = props;\n const { x, y, width, height } = props.rect\n ? props.rect\n : { x: props.x, y: props.y, width: props.width, height: props.height };\n if (svg === null) {\n return;\n }\n canvas.save();\n if (x && y) {\n canvas.translate(x, y);\n }\n canvas.drawSvg(svg, width, height);\n canvas.restore();\n};\n\nexport const drawParagraph = (ctx: DrawingContext, props: ParagraphProps) => {\n \"worklet\";\n const { paragraph, x, y, width } = props;\n if (paragraph) {\n paragraph.layout(width);\n paragraph.paint(ctx.canvas, x, y);\n }\n};\n\nexport const drawPicture = (ctx: DrawingContext, props: PictureProps) => {\n \"worklet\";\n const { picture } = props;\n ctx.canvas.drawPicture(picture);\n};\n\nexport const drawAtlas = (ctx: DrawingContext, props: AtlasProps) => {\n \"worklet\";\n const { image, sprites, transforms, colors, blendMode, sampling } = props;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : undefined;\n if (image) {\n ctx.canvas.drawAtlas(\n image,\n sprites,\n transforms,\n ctx.paint,\n blend,\n colors,\n sampling\n );\n }\n};\n\nexport const drawCircle = (ctx: DrawingContext, props: CircleProps) => {\n \"worklet\";\n const { c } = processCircle(props);\n const { r } = props;\n ctx.canvas.drawCircle(c.x, c.y, r, ctx.paint);\n};\n\nexport const drawSkottie = (ctx: DrawingContext, props: SkottieProps) => {\n \"worklet\";\n const { animation, frame } = props;\n if (animation) {\n props.animation.seekFrame(frame);\n props.animation.render(ctx.canvas);\n }\n};\n"],"mappings":"AAAA,SACEA,OAAO,EACPC,QAAQ,EACRC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,YAAY,QACP,oBAAoB;AAuB3B,SAASC,QAAQ,QAAQ,8BAA8B;AAEvD,SACEC,SAAS,EACTC,QAAQ,EACRC,UAAU,EACVC,eAAe,EACfC,UAAU,EACVC,SAAS,EACTC,UAAU,QACL,qBAAqB;AAG5B,OAAO,MAAMC,QAAQ,GAAGA,CAACC,GAAmB,EAAEC,KAAgB,KAAK;EACjE,SAAS;;EACT,MAAM;IAAEC,EAAE;IAAEC;EAAG,CAAC,GAAGF,KAAK;EACxBD,GAAG,CAACI,MAAM,CAACL,QAAQ,CAACG,EAAE,CAACG,CAAC,EAAEH,EAAE,CAACI,CAAC,EAAEH,EAAE,CAACE,CAAC,EAAEF,EAAE,CAACG,CAAC,EAAEN,GAAG,CAACO,KAAK,CAAC;AACxD,CAAC;AAED,OAAO,MAAMC,QAAQ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GAAGzD,aAAa,CAACe,KAAK,CAAC;EAClC,MAAM;IAAEoI;EAAE,CAAC,GAAGpI,KAAK;EACnBD,GAAG,CAACI,MAAM,CAACgI,UAAU,CAACzF,CAAC,CAACtC,CAAC,EAAEsC,CAAC,CAACrC,CAAC,EAAE+H,CAAC,EAAErI,GAAG,CAACO,KAAK,CAAC;AAC/C,CAAC;AAED,OAAO,MAAM+H,WAAW,GAAGA,CAACtI,GAAmB,EAAEC,KAAmB,KAAK;EACvE,SAAS;;EACT,MAAM;IAAEsI,SAAS;IAAEC;EAAM,CAAC,GAAGvI,KAAK;EAClC,IAAIsI,SAAS,EAAE;IACbtI,KAAK,CAACsI,SAAS,CAACE,SAAS,CAACD,KAAK,CAAC;IAChCvI,KAAK,CAACsI,SAAS,CAACG,MAAM,CAAC1I,GAAG,CAACI,MAAM,CAAC;EACpC;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["enumKey","fitRects","processCircle","processColor","processPath","processRect","processRRect","saturate","BlendMode","FillType","FilterMode","isCubicSampling","MipmapMode","PointMode","VertexMode","drawLine","ctx","props","p1","p2","canvas","x","y","paint","drawOval","rect","Skia","drawImage","image","sampling","_props$fit","fit","src","dst","width","height","drawImageRectCubic","B","C","_sampling$filter","_sampling$mipmap","drawImageRectOptions","filter","Linear","mipmap","None","drawPoints","points","mode","drawVertices","textures","colors","indices","blendMode","vertexMode","Triangles","vertices","MakeVertices","map","c","undefined","defaultBlendMode","DstOver","SrcOver","blend","drawDiffRect","outer","inner","drawDRRect","drawTextPath","path","font","initialOffset","text","ids","getGlyphIDs","widths","getGlyphWidths","rsx","meas","ContourMeasureIter","cont","next","dist","i","length","substring","p","t","getPosTan","adjustedX","adjustedY","push","RSXform","derived","TextBlob","MakeFromRSXform","drawTextBlob","drawText","drawPatch","texture","patch","pos","c2","c1","drawPath","start","trimStart","end","trimEnd","fillType","stroke","pathProps","Math","fround","hasStartOffset","hasEndOffset","hasStrokeOptions","hasFillType","willMutatePath","pristinePath","copy","setFillType","trim","drawRect","drawRRect","blob","drawGlyphs","glyphs","reduce","acc","glyph","id","positions","drawImageSVG","svg","save","translate","drawSvg","restore","drawParagraph","paragraph","layout","drawPicture","picture","drawAtlas","sprites","transforms","colorBlendMode","drawCircle","r","drawSkottie","animation","frame","seekFrame","render"],"sources":["Drawing.ts"],"sourcesContent":["import {\n enumKey,\n fitRects,\n processCircle,\n processColor,\n processPath,\n processRect,\n processRRect,\n} from \"../../../dom/nodes\";\nimport type {\n AtlasProps,\n CircleProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n OvalProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n SkottieProps,\n TextBlobProps,\n TextPathProps,\n TextProps,\n VerticesProps,\n} from \"../../../dom/types\";\nimport { saturate } from \"../../../renderer/processors\";\nimport type { SkPoint, SkRSXform } from \"../../../skia/types\";\nimport {\n BlendMode,\n FillType,\n FilterMode,\n isCubicSampling,\n MipmapMode,\n PointMode,\n VertexMode,\n} from \"../../../skia/types\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nexport const drawLine = (ctx: DrawingContext, props: LineProps) => {\n \"worklet\";\n const { p1, p2 } = props;\n ctx.canvas.drawLine(p1.x, p1.y, p2.x, p2.y, ctx.paint);\n};\n\nexport const drawOval = (ctx: DrawingContext, props: OvalProps) => {\n \"worklet\";\n const rect = processRect(ctx.Skia, props);\n ctx.canvas.drawOval(rect, ctx.paint);\n};\n\nexport const drawImage = (ctx: DrawingContext, props: ImageProps) => {\n \"worklet\";\n const { image, sampling } = props;\n if (image) {\n const fit = props.fit ?? \"contain\";\n const rect = processRect(ctx.Skia, props);\n const { src, dst } = fitRects(\n fit,\n {\n x: 0,\n y: 0,\n width: image.width(),\n height: image.height(),\n },\n rect\n );\n if (sampling && isCubicSampling(sampling)) {\n ctx.canvas.drawImageRectCubic(\n image,\n src,\n dst,\n sampling.B,\n sampling.C,\n ctx.paint\n );\n } else {\n ctx.canvas.drawImageRectOptions(\n image,\n src,\n dst,\n sampling?.filter ?? FilterMode.Linear,\n sampling?.mipmap ?? MipmapMode.None,\n ctx.paint\n );\n }\n }\n};\n\nexport const drawPoints = (ctx: DrawingContext, props: PointsProps) => {\n \"worklet\";\n const { points, mode } = props;\n ctx.canvas.drawPoints(PointMode[enumKey(mode)], points, ctx.paint);\n};\n\nexport const drawVertices = (ctx: DrawingContext, props: VerticesProps) => {\n \"worklet\";\n const { mode, textures, colors, indices, blendMode } = props;\n const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;\n const vertices = ctx.Skia.MakeVertices(\n vertexMode,\n props.vertices,\n textures,\n colors ? colors.map((c) => processColor(ctx.Skia, c)) : undefined,\n indices\n );\n const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n\n ctx.canvas.drawVertices(vertices, blend, ctx.paint);\n};\n\nexport const drawDiffRect = (ctx: DrawingContext, props: DiffRectProps) => {\n \"worklet\";\n const { outer, inner } = props;\n ctx.canvas.drawDRRect(outer, inner, ctx.paint);\n};\n\nexport const drawTextPath = (ctx: DrawingContext, props: TextPathProps) => {\n \"worklet\";\n const path = processPath(ctx.Skia, props.path);\n const { font, initialOffset } = props;\n if (font) {\n let { text } = props;\n const ids = font.getGlyphIDs(text);\n const widths = font.getGlyphWidths(ids);\n const rsx: SkRSXform[] = [];\n const meas = ctx.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(ctx.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));\n dist += width / 2;\n }\n const derived = ctx.Skia.TextBlob.MakeFromRSXform(text, rsx, font);\n ctx.canvas.drawTextBlob(derived, 0, 0, ctx.paint);\n }\n};\n\nexport const drawText = (ctx: DrawingContext, props: TextProps) => {\n \"worklet\";\n const { text, x, y, font } = props;\n if (font != null) {\n ctx.canvas.drawText(text, x, y, ctx.paint, font);\n }\n};\n\nexport const drawPatch = (ctx: DrawingContext, props: PatchProps) => {\n \"worklet\";\n const { texture, blendMode, patch } = props;\n const defaultBlendMode = props.colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const mode = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n // Patch requires a path with the following constraints:\n // M tl\n // C c1 c2 br\n // C c1 c2 bl\n // C c1 c2 tl (the redundant point in the last command is removed)\n\n const points = [\n patch[0].pos,\n patch[0].c2,\n patch[1].c1,\n patch[1].pos,\n patch[1].c2,\n patch[2].c1,\n patch[2].pos,\n patch[2].c2,\n patch[3].c1,\n patch[3].pos,\n patch[3].c2,\n patch[0].c1,\n ];\n const colors = props.colors\n ? props.colors.map((c) => processColor(ctx.Skia, c))\n : undefined;\n ctx.canvas.drawPatch(points, colors, texture, mode, ctx.paint);\n};\n\nexport const drawPath = (ctx: DrawingContext, props: PathProps) => {\n \"worklet\";\n const {\n start: trimStart,\n end: trimEnd,\n fillType,\n stroke,\n ...pathProps\n } = props;\n const start = Math.fround(saturate(trimStart));\n const end = Math.fround(saturate(trimEnd));\n const hasStartOffset = start !== 0;\n const hasEndOffset = end !== 1;\n const hasStrokeOptions = stroke !== undefined;\n const hasFillType = !!fillType;\n const willMutatePath =\n hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;\n const pristinePath = processPath(ctx.Skia, pathProps.path);\n const path = willMutatePath ? pristinePath.copy() : pristinePath;\n if (hasFillType) {\n path.setFillType(FillType[enumKey(fillType)]);\n }\n if (hasStrokeOptions) {\n path.stroke(stroke);\n }\n if (hasStartOffset || hasEndOffset) {\n path.trim(start, end, false);\n }\n ctx.canvas.drawPath(path, ctx.paint);\n};\n\nexport const drawRect = (ctx: DrawingContext, props: RectProps) => {\n \"worklet\";\n const derived = processRect(ctx.Skia, props);\n ctx.canvas.drawRect(derived, ctx.paint);\n};\n\nexport const drawRRect = (ctx: DrawingContext, props: RoundedRectProps) => {\n \"worklet\";\n const derived = processRRect(ctx.Skia, props);\n ctx.canvas.drawRRect(derived, ctx.paint);\n};\n\nexport const drawTextBlob = (ctx: DrawingContext, props: TextBlobProps) => {\n \"worklet\";\n const { blob, x, y } = props;\n ctx.canvas.drawTextBlob(blob, x, y, ctx.paint);\n};\n\ninterface ProcessedGlyphs {\n glyphs: number[];\n positions: SkPoint[];\n}\n\nexport const drawGlyphs = (ctx: DrawingContext, props: GlyphsProps) => {\n \"worklet\";\n const derived = 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 const { glyphs, positions } = derived;\n const { x, y, font } = props;\n if (font) {\n ctx.canvas.drawGlyphs(glyphs, positions, x, y, font, ctx.paint);\n }\n};\n\nexport const drawImageSVG = (ctx: DrawingContext, props: ImageSVGProps) => {\n \"worklet\";\n const { canvas } = ctx;\n const { svg } = props;\n const { x, y, width, height } = props.rect\n ? props.rect\n : { x: props.x, y: props.y, width: props.width, height: props.height };\n if (svg === null) {\n return;\n }\n canvas.save();\n if (x && y) {\n canvas.translate(x, y);\n }\n canvas.drawSvg(svg, width, height);\n canvas.restore();\n};\n\nexport const drawParagraph = (ctx: DrawingContext, props: ParagraphProps) => {\n \"worklet\";\n const { paragraph, x, y, width } = props;\n if (paragraph) {\n paragraph.layout(width);\n paragraph.paint(ctx.canvas, x, y);\n }\n};\n\nexport const drawPicture = (ctx: DrawingContext, props: PictureProps) => {\n \"worklet\";\n const { picture } = props;\n ctx.canvas.drawPicture(picture);\n};\n\nexport const drawAtlas = (ctx: DrawingContext, props: AtlasProps) => {\n \"worklet\";\n const { image, sprites, transforms, colors, colorBlendMode, sampling } =\n props;\n const blend = colorBlendMode ? BlendMode[enumKey(colorBlendMode)] : undefined;\n if (image) {\n ctx.canvas.drawAtlas(\n image,\n sprites,\n transforms,\n ctx.paint,\n blend,\n colors,\n sampling\n );\n }\n};\n\nexport const drawCircle = (ctx: DrawingContext, props: CircleProps) => {\n \"worklet\";\n const { c } = processCircle(props);\n const { r } = props;\n ctx.canvas.drawCircle(c.x, c.y, r, ctx.paint);\n};\n\nexport const drawSkottie = (ctx: DrawingContext, props: SkottieProps) => {\n \"worklet\";\n const { animation, frame } = props;\n if (animation) {\n props.animation.seekFrame(frame);\n props.animation.render(ctx.canvas);\n }\n};\n"],"mappings":"AAAA,SACEA,OAAO,EACPC,QAAQ,EACRC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,YAAY,QACP,oBAAoB;AAuB3B,SAASC,QAAQ,QAAQ,8BAA8B;AAEvD,SACEC,SAAS,EACTC,QAAQ,EACRC,UAAU,EACVC,eAAe,EACfC,UAAU,EACVC,SAAS,EACTC,UAAU,QACL,qBAAqB;AAG5B,OAAO,MAAMC,QAAQ,GAAGA,CAACC,GAAmB,EAAEC,KAAgB,KAAK;EACjE,SAAS;;EACT,MAAM;IAAEC,EAAE;IAAEC;EAAG,CAAC,GAAGF,KAAK;EACxBD,GAAG,CAACI,MAAM,CAACL,QAAQ,CAACG,EAAE,CAACG,CAAC,EAAEH,EAAE,CAACI,CAAC,EAAEH,EAAE,CAACE,CAAC,EAAEF,EAAE,CAACG,CAAC,EAAEN,GAAG,CAACO,KAAK,CAAC;AACxD,CAAC;AAED,OAAO,MAAMC,QAAQ,GAAGA,CAACR,GAAmB,EAAEC,KAAgB,KAAK;EACjE,SAAS;;EACT,MAAMQ,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,GAAGrI,KAAK;EACnBD,GAAG,CAACI,MAAM,CAACiI,UAAU,CAAC1F,CAAC,CAACtC,CAAC,EAAEsC,CAAC,CAACrC,CAAC,EAAEgI,CAAC,EAAEtI,GAAG,CAACO,KAAK,CAAC;AAC/C,CAAC;AAED,OAAO,MAAMgI,WAAW,GAAGA,CAACvI,GAAmB,EAAEC,KAAmB,KAAK;EACvE,SAAS;;EACT,MAAM;IAAEuI,SAAS;IAAEC;EAAM,CAAC,GAAGxI,KAAK;EAClC,IAAIuI,SAAS,EAAE;IACbvI,KAAK,CAACuI,SAAS,CAACE,SAAS,CAACD,KAAK,CAAC;IAChCxI,KAAK,CAACuI,SAAS,CAACG,MAAM,CAAC3I,GAAG,CAACI,MAAM,CAAC;EACpC;AACF,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"setup-skia-web": "scripts/setup-canvaskit.js"
|
|
9
9
|
},
|
|
10
10
|
"title": "React Native Skia",
|
|
11
|
-
"version": "2.5.
|
|
11
|
+
"version": "2.5.1",
|
|
12
12
|
"description": "High-performance React Native Graphics using Skia",
|
|
13
13
|
"main": "lib/module/index.js",
|
|
14
14
|
"react-native": "src/index.ts",
|
|
@@ -4,43 +4,6 @@ require "json"
|
|
|
4
4
|
|
|
5
5
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
6
6
|
|
|
7
|
-
# Resolve npm package path using Node.js resolution (handles monorepos, pnpm, etc.)
|
|
8
|
-
resolve_skia_package = lambda do |package_name, required: true|
|
|
9
|
-
begin
|
|
10
|
-
# Use node to resolve the package - this handles all edge cases:
|
|
11
|
-
# - Hoisted packages in monorepos
|
|
12
|
-
# - pnpm symlinked packages
|
|
13
|
-
# - Yarn PnP
|
|
14
|
-
# - Different node_modules structures
|
|
15
|
-
result = `node -e "console.log(require.resolve('#{package_name}/package.json'))" 2>/dev/null`.strip
|
|
16
|
-
if $?.success? && !result.empty?
|
|
17
|
-
return File.dirname(result)
|
|
18
|
-
end
|
|
19
|
-
rescue => e
|
|
20
|
-
# Node resolution failed
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# Fallback: walk up directories looking for node_modules
|
|
24
|
-
current = __dir__
|
|
25
|
-
while current != "/"
|
|
26
|
-
candidate = File.join(current, "node_modules", package_name)
|
|
27
|
-
if File.exist?(File.join(candidate, "package.json"))
|
|
28
|
-
return candidate
|
|
29
|
-
end
|
|
30
|
-
current = File.dirname(current)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
if required
|
|
34
|
-
Pod::UI.puts "\n"
|
|
35
|
-
Pod::UI.puts "ERROR: Could not find #{package_name}".red
|
|
36
|
-
Pod::UI.puts "Make sure you have run 'yarn install' or 'npm install'".red
|
|
37
|
-
Pod::UI.puts "\n"
|
|
38
|
-
raise "#{package_name} not found. Please install dependencies."
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
nil
|
|
42
|
-
end
|
|
43
|
-
|
|
44
7
|
# Check if Graphite is enabled
|
|
45
8
|
use_graphite = false
|
|
46
9
|
if ENV['SK_GRAPHITE']
|
|
@@ -50,48 +13,6 @@ else
|
|
|
50
13
|
puts "-- SK_GRAPHITE: OFF (set SK_GRAPHITE=1 to enable)"
|
|
51
14
|
end
|
|
52
15
|
|
|
53
|
-
# Check if xcframeworks already exist (e.g., from install-skia-graphite script)
|
|
54
|
-
local_ios_libs = File.join(__dir__, "libs/ios")
|
|
55
|
-
local_macos_libs = File.join(__dir__, "libs/macos")
|
|
56
|
-
xcframeworks_preinstalled = File.exist?(local_ios_libs) &&
|
|
57
|
-
Dir.glob(File.join(local_ios_libs, "*.xcframework")).any? &&
|
|
58
|
-
File.exist?(local_macos_libs) &&
|
|
59
|
-
Dir.glob(File.join(local_macos_libs, "*.xcframework")).any?
|
|
60
|
-
|
|
61
|
-
if xcframeworks_preinstalled
|
|
62
|
-
puts "-- Using pre-installed xcframeworks from libs/"
|
|
63
|
-
ios_package = nil
|
|
64
|
-
macos_package = nil
|
|
65
|
-
tvos_package = nil
|
|
66
|
-
else
|
|
67
|
-
# Resolve Skia binary packages from npm
|
|
68
|
-
prefix = use_graphite ? "react-native-skia-graphite" : "react-native-skia"
|
|
69
|
-
|
|
70
|
-
ios_package = resolve_skia_package.call("#{prefix}-apple-ios")
|
|
71
|
-
macos_package = resolve_skia_package.call("#{prefix}-apple-macos")
|
|
72
|
-
tvos_package = use_graphite ? nil : resolve_skia_package.call("#{prefix}-apple-tvos", required: false)
|
|
73
|
-
|
|
74
|
-
puts "-- Skia iOS package: #{ios_package}"
|
|
75
|
-
puts "-- Skia macOS package: #{macos_package}"
|
|
76
|
-
puts "-- Skia tvOS package: #{tvos_package}" if tvos_package
|
|
77
|
-
|
|
78
|
-
# Verify the packages contain the expected files
|
|
79
|
-
ios_libs_path = File.join(ios_package, "libs")
|
|
80
|
-
unless File.exist?(ios_libs_path) && Dir.glob(File.join(ios_libs_path, "*.xcframework")).any?
|
|
81
|
-
Pod::UI.puts "\n"
|
|
82
|
-
Pod::UI.puts "┌─────────────────────────────────────────────────────────────────────────────┐".red
|
|
83
|
-
Pod::UI.puts "│ │".red
|
|
84
|
-
Pod::UI.puts "│ ERROR: Skia prebuilt binaries not found in #{prefix}-apple-ios! │".red
|
|
85
|
-
Pod::UI.puts "│ │".red
|
|
86
|
-
Pod::UI.puts "│ The package was found but doesn't contain the expected xcframeworks. │".red
|
|
87
|
-
Pod::UI.puts "│ Try reinstalling: yarn add #{prefix}-apple-ios │".red
|
|
88
|
-
Pod::UI.puts "│ │".red
|
|
89
|
-
Pod::UI.puts "└─────────────────────────────────────────────────────────────────────────────┘".red
|
|
90
|
-
Pod::UI.puts "\n"
|
|
91
|
-
raise "Skia xcframeworks not found in #{ios_libs_path}"
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
16
|
# Set preprocessor definitions based on GRAPHITE flag
|
|
96
17
|
preprocessor_defs = use_graphite ?
|
|
97
18
|
'$(inherited) SK_GRAPHITE=1 SK_IMAGE_READ_PIXELS_DISABLE_LEGACY_API=1 SK_DISABLE_LEGACY_SHAPER_FACTORY=1' :
|
|
@@ -105,22 +26,83 @@ framework_names = ['libskia', 'libsvg', 'libskshaper', 'libskparagraph',
|
|
|
105
26
|
# Build platform-specific framework paths (relative to pod's libs directory)
|
|
106
27
|
ios_frameworks = framework_names.map { |f| "libs/ios/#{f}.xcframework" }
|
|
107
28
|
osx_frameworks = framework_names.map { |f| "libs/macos/#{f}.xcframework" }
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
unless xcframeworks_preinstalled
|
|
114
|
-
prepare_commands << "rm -rf libs/ios libs/macos libs/tvos"
|
|
115
|
-
prepare_commands << "mkdir -p libs/ios libs/macos"
|
|
116
|
-
prepare_commands << "cp -R '#{ios_package}/libs/'*.xcframework libs/ios/"
|
|
117
|
-
prepare_commands << "cp -R '#{macos_package}/libs/'*.xcframework libs/macos/"
|
|
118
|
-
if tvos_package
|
|
119
|
-
prepare_commands << "mkdir -p libs/tvos"
|
|
120
|
-
prepare_commands << "cp -R '#{tvos_package}/libs/'*.xcframework libs/tvos/"
|
|
121
|
-
end
|
|
29
|
+
# tvOS frameworks - only declare if libs/tvos/ already exists (otherwise leave empty)
|
|
30
|
+
tvos_frameworks = if use_graphite || !Dir.exist?(File.join(__dir__, 'libs', 'tvos'))
|
|
31
|
+
[]
|
|
32
|
+
else
|
|
33
|
+
framework_names.map { |f| "libs/tvos/#{f}.xcframework" }
|
|
122
34
|
end
|
|
123
35
|
|
|
36
|
+
# Prepare command resolves paths at RUNTIME (not evaluation time) to ensure deterministic checksums
|
|
37
|
+
# This script:
|
|
38
|
+
# 1. Checks if xcframeworks are already installed (e.g., from Graphite script)
|
|
39
|
+
# 2. If not, resolves npm package paths and copies xcframeworks
|
|
40
|
+
# The script content is deterministic - no machine-specific paths embedded in the podspec
|
|
41
|
+
prepare_command_script = <<-'SCRIPT'
|
|
42
|
+
node -e "
|
|
43
|
+
const path = require('path');
|
|
44
|
+
const fs = require('fs');
|
|
45
|
+
const { execSync } = require('child_process');
|
|
46
|
+
|
|
47
|
+
const iosLibs = 'libs/ios';
|
|
48
|
+
const macosLibs = 'libs/macos';
|
|
49
|
+
|
|
50
|
+
// Check if xcframeworks are already installed
|
|
51
|
+
const hasIos = fs.existsSync(iosLibs) && fs.readdirSync(iosLibs).some(f => f.endsWith('.xcframework'));
|
|
52
|
+
const hasMacos = fs.existsSync(macosLibs) && fs.readdirSync(macosLibs).some(f => f.endsWith('.xcframework'));
|
|
53
|
+
|
|
54
|
+
if (hasIos && hasMacos) {
|
|
55
|
+
console.log('-- Using pre-installed xcframeworks from libs/');
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Determine package prefix based on SK_GRAPHITE env var
|
|
60
|
+
const useGraphite = process.env.SK_GRAPHITE === '1' || (process.env.SK_GRAPHITE || '').toLowerCase() === 'true';
|
|
61
|
+
const prefix = useGraphite ? 'react-native-skia-graphite' : 'react-native-skia';
|
|
62
|
+
|
|
63
|
+
// Resolve package paths
|
|
64
|
+
let iosPackage, macosPackage, tvosPackage;
|
|
65
|
+
try {
|
|
66
|
+
iosPackage = path.dirname(require.resolve(prefix + '-apple-ios/package.json'));
|
|
67
|
+
macosPackage = path.dirname(require.resolve(prefix + '-apple-macos/package.json'));
|
|
68
|
+
} catch (e) {
|
|
69
|
+
console.error('ERROR: Could not find ' + prefix + '-apple-ios or ' + prefix + '-apple-macos');
|
|
70
|
+
console.error('Make sure you have run yarn install or npm install');
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Verify xcframeworks exist in the packages
|
|
75
|
+
const iosXcf = path.join(iosPackage, 'libs');
|
|
76
|
+
if (!fs.existsSync(iosXcf) || !fs.readdirSync(iosXcf).some(f => f.endsWith('.xcframework'))) {
|
|
77
|
+
console.error('ERROR: Skia prebuilt binaries not found in ' + prefix + '-apple-ios!');
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
console.log('-- Skia iOS package: ' + iosPackage);
|
|
82
|
+
console.log('-- Skia macOS package: ' + macosPackage);
|
|
83
|
+
|
|
84
|
+
// Clean and copy
|
|
85
|
+
execSync('rm -rf libs/ios libs/macos libs/tvos', { stdio: 'inherit' });
|
|
86
|
+
execSync('mkdir -p libs/ios libs/macos', { stdio: 'inherit' });
|
|
87
|
+
execSync('cp -R \"' + iosPackage + '/libs/\"*.xcframework libs/ios/', { stdio: 'inherit' });
|
|
88
|
+
execSync('cp -R \"' + macosPackage + '/libs/\"*.xcframework libs/macos/', { stdio: 'inherit' });
|
|
89
|
+
|
|
90
|
+
// Handle tvOS (non-Graphite only)
|
|
91
|
+
if (!useGraphite) {
|
|
92
|
+
try {
|
|
93
|
+
tvosPackage = path.dirname(require.resolve(prefix + '-apple-tvos/package.json'));
|
|
94
|
+
console.log('-- Skia tvOS package: ' + tvosPackage);
|
|
95
|
+
execSync('mkdir -p libs/tvos', { stdio: 'inherit' });
|
|
96
|
+
execSync('cp -R \"' + tvosPackage + '/libs/\"*.xcframework libs/tvos/', { stdio: 'inherit' });
|
|
97
|
+
} catch (e) {
|
|
98
|
+
console.log('-- tvOS package not found, skipping');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
console.log('-- Copied xcframeworks from npm packages');
|
|
103
|
+
"
|
|
104
|
+
SCRIPT
|
|
105
|
+
|
|
124
106
|
Pod::Spec.new do |s|
|
|
125
107
|
s.name = "react-native-skia"
|
|
126
108
|
s.version = package["version"]
|
|
@@ -139,7 +121,8 @@ Pod::Spec.new do |s|
|
|
|
139
121
|
s.source = { :git => "https://github.com/shopify/react-native-skia/react-native-skia.git", :tag => "#{s.version}" }
|
|
140
122
|
|
|
141
123
|
# Copy xcframeworks from npm packages into pod directory structure
|
|
142
|
-
|
|
124
|
+
# The script is deterministic - path resolution happens at runtime, not evaluation time
|
|
125
|
+
s.prepare_command = prepare_command_script
|
|
143
126
|
|
|
144
127
|
s.requires_arc = true
|
|
145
128
|
s.pod_target_xcconfig = {
|
|
@@ -306,8 +306,9 @@ export const drawPicture = (ctx: DrawingContext, props: PictureProps) => {
|
|
|
306
306
|
|
|
307
307
|
export const drawAtlas = (ctx: DrawingContext, props: AtlasProps) => {
|
|
308
308
|
"worklet";
|
|
309
|
-
const { image, sprites, transforms, colors,
|
|
310
|
-
|
|
309
|
+
const { image, sprites, transforms, colors, colorBlendMode, sampling } =
|
|
310
|
+
props;
|
|
311
|
+
const blend = colorBlendMode ? BlendMode[enumKey(colorBlendMode)] : undefined;
|
|
311
312
|
if (image) {
|
|
312
313
|
ctx.canvas.drawAtlas(
|
|
313
314
|
image,
|