@shopify/react-native-skia 0.1.162 → 0.1.164

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +2 -0
  2. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +2 -2
  3. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
  4. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +5 -5
  5. package/cpp/api/JsiSkCanvas.h +8 -8
  6. package/cpp/api/JsiSkColor.h +1 -1
  7. package/cpp/api/JsiSkColorFilter.h +1 -1
  8. package/cpp/api/JsiSkColorFilterFactory.h +2 -2
  9. package/cpp/api/JsiSkContourMeasure.h +1 -1
  10. package/cpp/api/JsiSkContourMeasureIter.h +2 -2
  11. package/cpp/api/JsiSkData.h +2 -2
  12. package/cpp/api/JsiSkDataFactory.h +1 -1
  13. package/cpp/api/JsiSkFont.h +2 -2
  14. package/cpp/api/JsiSkImage.h +3 -3
  15. package/cpp/api/JsiSkImageFilter.h +1 -1
  16. package/cpp/api/JsiSkImageFilterFactory.h +1 -1
  17. package/cpp/api/JsiSkImageInfo.h +1 -1
  18. package/cpp/api/JsiSkMaskFilter.h +1 -1
  19. package/cpp/api/JsiSkMaskFilterFactory.h +1 -1
  20. package/cpp/api/JsiSkMatrix.h +1 -1
  21. package/cpp/api/JsiSkPaint.h +7 -1
  22. package/cpp/api/JsiSkPath.h +15 -15
  23. package/cpp/api/JsiSkPathEffect.h +1 -1
  24. package/cpp/api/JsiSkPathEffectFactory.h +4 -4
  25. package/cpp/api/JsiSkPathFactory.h +2 -2
  26. package/cpp/api/JsiSkPicture.h +1 -1
  27. package/cpp/api/JsiSkPictureFactory.h +2 -2
  28. package/cpp/api/JsiSkPictureRecorder.h +2 -2
  29. package/cpp/api/JsiSkPoint.h +1 -1
  30. package/cpp/api/JsiSkRRect.h +1 -1
  31. package/cpp/api/JsiSkRSXform.h +1 -1
  32. package/cpp/api/JsiSkRect.h +1 -1
  33. package/cpp/api/JsiSkRuntimeEffect.h +1 -1
  34. package/cpp/api/JsiSkRuntimeShaderBuilder.h +1 -1
  35. package/cpp/api/JsiSkSVGFactory.h +1 -1
  36. package/cpp/api/JsiSkShader.h +2 -2
  37. package/cpp/api/JsiSkShaderFactory.h +3 -3
  38. package/cpp/api/JsiSkSurface.h +1 -1
  39. package/cpp/api/JsiSkSurfaceFactory.h +2 -2
  40. package/cpp/api/JsiSkTextBlob.h +1 -1
  41. package/cpp/api/JsiSkTextBlobFactory.h +1 -1
  42. package/cpp/api/JsiSkTypeface.h +2 -2
  43. package/cpp/api/JsiSkVertices.h +1 -1
  44. package/cpp/jsi/JsiHostObject.h +25 -25
  45. package/cpp/rnskia/RNSkJsView.h +3 -3
  46. package/cpp/rnskia/RNSkPictureView.h +3 -3
  47. package/cpp/rnskia/RNSkPlatformContext.h +5 -3
  48. package/cpp/rnskia/RNSkView.h +2 -2
  49. package/cpp/rnskia/dom/base/DrawingContext.cpp +24 -9
  50. package/cpp/rnskia/dom/base/DrawingContext.h +3 -2
  51. package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +12 -2
  52. package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +4 -4
  53. package/cpp/rnskia/dom/base/JsiDomNode.h +68 -10
  54. package/cpp/rnskia/dom/base/JsiDomRenderNode.h +26 -61
  55. package/cpp/rnskia/dom/base/NodeProp.h +2 -1
  56. package/cpp/rnskia/dom/base/NodePropsContainer.h +10 -0
  57. package/cpp/rnskia/dom/nodes/JsiBlendNode.h +7 -9
  58. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +3 -6
  59. package/cpp/rnskia/dom/nodes/JsiBoxNode.h +2 -4
  60. package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +1 -2
  61. package/cpp/rnskia/dom/nodes/JsiCircleNode.h +2 -3
  62. package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +4 -8
  63. package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +1 -2
  64. package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +2 -7
  65. package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +4 -8
  66. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +19 -37
  67. package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -1
  68. package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +2 -4
  69. package/cpp/rnskia/dom/nodes/JsiLineNode.h +2 -7
  70. package/cpp/rnskia/dom/nodes/JsiOvalNode.h +1 -3
  71. package/cpp/rnskia/dom/nodes/JsiPaintNode.h +2 -3
  72. package/cpp/rnskia/dom/nodes/JsiPatchNode.h +4 -8
  73. package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +14 -28
  74. package/cpp/rnskia/dom/nodes/JsiPathNode.h +16 -24
  75. package/cpp/rnskia/dom/nodes/JsiPictureNode.h +1 -2
  76. package/cpp/rnskia/dom/nodes/JsiPointsNode.h +2 -5
  77. package/cpp/rnskia/dom/nodes/JsiRRectNode.h +1 -2
  78. package/cpp/rnskia/dom/nodes/JsiRectNode.h +1 -2
  79. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +37 -69
  80. package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +3 -6
  81. package/cpp/rnskia/dom/nodes/JsiTextNode.h +4 -8
  82. package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +1 -2
  83. package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +2 -4
  84. package/cpp/rnskia/dom/props/BlendModeProp.h +2 -2
  85. package/cpp/rnskia/dom/props/PaintProps.h +3 -0
  86. package/cpp/rnskia/dom/props/TransformProp.h +0 -2
  87. package/cpp/utils/RNSkLog.h +1 -1
  88. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +8 -7
  89. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -1
  90. package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +4 -4
  91. package/ios/RNSkia-iOS/SkiaManager.mm +5 -5
  92. package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +3 -3
  93. package/ios/RNSkia-iOS/SkiaUIView.mm +10 -10
  94. package/lib/commonjs/dom/nodes/RenderNode.js +12 -16
  95. package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
  96. package/lib/commonjs/dom/nodes/datatypes/index.js +0 -13
  97. package/lib/commonjs/dom/nodes/datatypes/index.js.map +1 -1
  98. package/lib/commonjs/dom/nodes/drawings/Box.js +6 -6
  99. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  100. package/lib/commonjs/dom/nodes/drawings/PatchNode.js +3 -7
  101. package/lib/commonjs/dom/nodes/drawings/PatchNode.js.map +1 -1
  102. package/lib/commonjs/dom/nodes/drawings/VerticesNode.js +1 -1
  103. package/lib/commonjs/dom/nodes/drawings/VerticesNode.js.map +1 -1
  104. package/lib/commonjs/dom/nodes/paint/ColorFilters.js +1 -3
  105. package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
  106. package/lib/commonjs/dom/nodes/paint/ImageFilters.js +1 -1
  107. package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
  108. package/lib/commonjs/dom/nodes/paint/Shaders.js +1 -3
  109. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  110. package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
  111. package/lib/commonjs/renderer/Canvas.js +2 -11
  112. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  113. package/lib/commonjs/renderer/Container.js +2 -1
  114. package/lib/commonjs/renderer/Container.js.map +1 -1
  115. package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
  116. package/lib/commonjs/renderer/components/Mask.js +11 -25
  117. package/lib/commonjs/renderer/components/Mask.js.map +1 -1
  118. package/lib/commonjs/renderer/index.js +0 -13
  119. package/lib/commonjs/renderer/index.js.map +1 -1
  120. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  121. package/lib/commonjs/skia/web/JsiSkPaint.js +4 -0
  122. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  123. package/lib/commonjs/web/LoadSkiaWeb.js +1 -1
  124. package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
  125. package/lib/module/dom/nodes/RenderNode.js +12 -16
  126. package/lib/module/dom/nodes/RenderNode.js.map +1 -1
  127. package/lib/module/dom/nodes/datatypes/index.js +0 -1
  128. package/lib/module/dom/nodes/datatypes/index.js.map +1 -1
  129. package/lib/module/dom/nodes/drawings/Box.js +6 -5
  130. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  131. package/lib/module/dom/nodes/drawings/PatchNode.js +4 -8
  132. package/lib/module/dom/nodes/drawings/PatchNode.js.map +1 -1
  133. package/lib/module/dom/nodes/drawings/VerticesNode.js +2 -2
  134. package/lib/module/dom/nodes/drawings/VerticesNode.js.map +1 -1
  135. package/lib/module/dom/nodes/paint/ColorFilters.js +1 -2
  136. package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
  137. package/lib/module/dom/nodes/paint/ImageFilters.js +2 -2
  138. package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
  139. package/lib/module/dom/nodes/paint/Shaders.js +1 -2
  140. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  141. package/lib/module/dom/types/DrawingContext.js.map +1 -1
  142. package/lib/module/renderer/Canvas.js +3 -10
  143. package/lib/module/renderer/Canvas.js.map +1 -1
  144. package/lib/module/renderer/Container.js +2 -1
  145. package/lib/module/renderer/Container.js.map +1 -1
  146. package/lib/module/renderer/DrawingContext.js.map +1 -1
  147. package/lib/module/renderer/components/Mask.js +9 -21
  148. package/lib/module/renderer/components/Mask.js.map +1 -1
  149. package/lib/module/renderer/index.js +0 -1
  150. package/lib/module/renderer/index.js.map +1 -1
  151. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  152. package/lib/module/skia/web/JsiSkPaint.js +4 -0
  153. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  154. package/lib/module/web/LoadSkiaWeb.js +1 -1
  155. package/lib/module/web/LoadSkiaWeb.js.map +1 -1
  156. package/lib/typescript/src/dom/nodes/datatypes/index.d.ts +0 -1
  157. package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +1 -1
  158. package/lib/typescript/src/dom/nodes/drawings/PatchNode.d.ts +1 -1
  159. package/lib/typescript/src/dom/types/DrawingContext.d.ts +0 -1
  160. package/lib/typescript/src/renderer/Container.d.ts +1 -1
  161. package/lib/typescript/src/renderer/DrawingContext.d.ts +3 -5
  162. package/lib/typescript/src/renderer/index.d.ts +0 -1
  163. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +4 -0
  164. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  165. package/package.json +1 -1
  166. package/src/dom/nodes/RenderNode.ts +11 -21
  167. package/src/dom/nodes/datatypes/index.ts +0 -1
  168. package/src/dom/nodes/drawings/Box.ts +7 -4
  169. package/src/dom/nodes/drawings/PatchNode.ts +4 -18
  170. package/src/dom/nodes/drawings/VerticesNode.ts +2 -2
  171. package/src/dom/nodes/paint/ColorFilters.ts +1 -2
  172. package/src/dom/nodes/paint/ImageFilters.ts +2 -2
  173. package/src/dom/nodes/paint/Shaders.ts +1 -2
  174. package/src/dom/types/DrawingContext.ts +0 -1
  175. package/src/renderer/Canvas.tsx +2 -12
  176. package/src/renderer/Container.tsx +1 -1
  177. package/src/renderer/DrawingContext.ts +5 -5
  178. package/src/renderer/components/Mask.tsx +11 -20
  179. package/src/renderer/index.ts +0 -1
  180. package/src/skia/types/Paint/Paint.ts +5 -0
  181. package/src/skia/web/JsiSkPaint.ts +4 -0
  182. package/src/web/LoadSkiaWeb.tsx +1 -1
  183. package/lib/commonjs/dom/nodes/datatypes/Color.js +0 -27
  184. package/lib/commonjs/dom/nodes/datatypes/Color.js.map +0 -1
  185. package/lib/commonjs/renderer/useCanvas.js +0 -32
  186. package/lib/commonjs/renderer/useCanvas.js.map +0 -1
  187. package/lib/module/dom/nodes/datatypes/Color.js +0 -11
  188. package/lib/module/dom/nodes/datatypes/Color.js.map +0 -1
  189. package/lib/module/renderer/useCanvas.js +0 -15
  190. package/lib/module/renderer/useCanvas.js.map +0 -1
  191. package/lib/typescript/src/dom/nodes/datatypes/Color.d.ts +0 -7
  192. package/lib/typescript/src/renderer/useCanvas.d.ts +0 -9
  193. package/src/dom/nodes/datatypes/Color.ts +0 -15
  194. package/src/renderer/useCanvas.ts +0 -21
@@ -1 +1 @@
1
- {"version":3,"names":["paintProps","JsiRenderNode","JsiNode","constructor","ctx","type","props","matrix","Skia","Matrix","onPropChange","setProps","paintCache","setProp","key","value","hasChanged","includes","identity","clipPath","undefined","clipRect","clipRRect","computeMatrix","computeClip","addChild","child","JsiDeclarationNode","setInvalidate","insertChildBefore","before","clip","isPathDef","processPath","isRRect","processTransformProps","getPaintCtx","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","Color","BlendMode","enumKey","PaintStyle","StrokeJoin","StrokeCap","_children","forEach","isColorFilter","cf","materialize","colorFilter","ColorFilter","MakeCompose","isShader","shader","isPathEffect","pe","pathEffect","PathEffect","isImageFilter","filter","imageFilter","ImageFilter","isMaskFilter","maskFilter","render","parentCtx","invertClip","layer","transform","canvas","parent","paint","paintCtx","concatPaint","hasTransform","hasClip","shouldSave","op","ClipOp","Difference","Intersect","saveLayer","save","concat","renderNode","restore","alpha","copy","setShader","setColor","cl","getColor","setStrokeWidth","setAntiAlias","setBlendMode","setColorFilter","setImageFilter","setMaskFilter","setPathEffect","setAlphaf","setStrokeCap","setStrokeJoin","setStrokeMiter","setStyle"],"sources":["RenderNode.ts"],"sourcesContent":["import type {\n SkMatrix,\n SkRect,\n SkRRect,\n SkPath,\n SkPaint,\n} from \"../../skia/types\";\nimport {\n StrokeCap,\n StrokeJoin,\n PaintStyle,\n BlendMode,\n ClipOp,\n isRRect,\n} from \"../../skia/types\";\nimport type {\n RenderNode,\n GroupProps,\n DrawingContext,\n NodeType,\n Node,\n} from \"../types\";\n\nimport { isPathDef, processPath, processTransformProps } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiNode, JsiDeclarationNode } from \"./Node\";\nimport type { PaintContext } from \"./PaintContext\";\nimport { enumKey } from \"./datatypes/Enum\";\n\nconst paintProps = [\n \"color\",\n \"strokeWidth\",\n \"blendMode\",\n \"strokeCap\",\n \"strokeJoin\",\n \"strokeMiter\",\n \"style\",\n \"antiAlias\",\n \"opacity\",\n];\n\ninterface PaintCache {\n parent: SkPaint;\n child: SkPaint;\n}\n\nexport abstract class JsiRenderNode<P extends GroupProps>\n extends JsiNode<P>\n implements RenderNode<P>\n{\n paintCache: PaintCache | null = null;\n matrix: SkMatrix;\n clipRect?: SkRect;\n clipRRect?: SkRRect;\n clipPath?: SkPath;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.matrix = this.Skia.Matrix();\n this.onPropChange();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.onPropChange();\n this.paintCache = null;\n }\n\n setProp<K extends keyof P>(key: K, value: P[K]) {\n const hasChanged = super.setProp(key, value);\n if (hasChanged) {\n this.onPropChange();\n if (paintProps.includes(key as string)) {\n this.paintCache = null;\n }\n }\n return hasChanged;\n }\n\n protected onPropChange() {\n this.matrix.identity();\n this.clipPath = undefined;\n this.clipRect = undefined;\n this.clipRRect = undefined;\n this.computeMatrix();\n this.computeClip();\n }\n\n addChild(child: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.addChild(child);\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.insertChildBefore(child, before);\n }\n\n private computeClip() {\n const { clip } = this.props;\n if (clip) {\n if (isPathDef(clip)) {\n this.clipPath = processPath(this.Skia, clip);\n } else if (isRRect(clip)) {\n this.clipRRect = clip;\n } else {\n this.clipRect = clip;\n }\n }\n }\n\n private computeMatrix() {\n processTransformProps(this.matrix, this.props);\n }\n\n private getPaintCtx() {\n let ctx: PaintContext | undefined;\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n } = this.props;\n if (\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n opacity !== undefined ||\n antiAlias !== undefined\n ) {\n ctx = {};\n if (color !== undefined) {\n ctx.color = this.Skia.Color(color);\n }\n if (strokeWidth !== undefined) {\n ctx.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n ctx.blendMode = BlendMode[enumKey(blendMode)];\n }\n if (style !== undefined) {\n ctx.style = PaintStyle[enumKey(style)];\n }\n if (strokeJoin !== undefined) {\n ctx.strokeJoin = StrokeJoin[enumKey(strokeJoin)];\n }\n if (strokeCap !== undefined) {\n ctx.strokeCap = StrokeCap[enumKey(strokeCap)];\n }\n if (strokeMiter !== undefined) {\n ctx.strokeMiter = strokeMiter;\n }\n if (opacity !== undefined) {\n ctx.opacity = opacity;\n }\n if (antiAlias !== undefined) {\n ctx.antiAlias = antiAlias;\n }\n }\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n if (child.isColorFilter()) {\n ctx = ctx || {};\n const cf = child.materialize();\n ctx.colorFilter = ctx.colorFilter\n ? this.Skia.ColorFilter.MakeCompose(cf, ctx.colorFilter)\n : cf;\n } else if (child.isShader()) {\n ctx = ctx || {};\n const shader = child.materialize();\n ctx.shader = shader;\n } else if (child.isPathEffect()) {\n ctx = ctx || {};\n const pe = child.materialize();\n ctx.pathEffect = ctx.pathEffect\n ? this.Skia.PathEffect.MakeCompose(pe, ctx.pathEffect)\n : pe;\n } else if (child.isImageFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.imageFilter = ctx.imageFilter\n ? this.Skia.ImageFilter.MakeCompose(filter, ctx.imageFilter)\n : filter;\n } else if (child.isMaskFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.maskFilter = filter;\n }\n }\n });\n return ctx;\n }\n\n render(parentCtx: DrawingContext) {\n const { invertClip, layer, matrix, transform } = this.props;\n const { canvas } = parentCtx;\n\n const opacity =\n this.props.opacity !== undefined\n ? parentCtx.opacity * this.props.opacity\n : parentCtx.opacity;\n\n if (\n this.paintCache === null ||\n this.paintCache.parent !== parentCtx.paint\n ) {\n const paintCtx = this.getPaintCtx();\n const child = paintCtx\n ? concatPaint(parentCtx.paint, paintCtx, parentCtx.opacity)\n : parentCtx.paint;\n this.paintCache = { parent: parentCtx.paint, child };\n }\n const paint = this.paintCache.child;\n // TODO: can we only recreate a new context here if needed?\n const ctx = { ...parentCtx, opacity, paint };\n const hasTransform = matrix !== undefined || transform !== undefined;\n const hasClip =\n this.clipRect !== undefined ||\n this.clipPath !== undefined ||\n this.clipRRect !== undefined;\n const shouldSave = hasTransform || hasClip || !!layer;\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else {\n canvas.saveLayer(layer);\n }\n } else {\n canvas.save();\n }\n }\n\n if (this.matrix) {\n canvas.concat(this.matrix);\n }\n if (this.clipRect) {\n canvas.clipRect(this.clipRect, op, true);\n } else if (this.clipRRect) {\n canvas.clipRRect(this.clipRRect, op, true);\n } else if (this.clipPath) {\n canvas.clipPath(this.clipPath, op, true);\n }\n\n this.renderNode(ctx);\n\n if (shouldSave) {\n canvas.restore();\n }\n }\n\n abstract renderNode(ctx: DrawingContext): void;\n}\n\nconst concatPaint = (\n parent: SkPaint,\n {\n color,\n strokeWidth,\n shader,\n antiAlias,\n blendMode,\n colorFilter,\n imageFilter,\n maskFilter,\n pathEffect,\n opacity: alpha,\n strokeCap,\n strokeJoin,\n strokeMiter,\n style,\n }: PaintContext,\n opacity: number\n) => {\n const paint = parent.copy();\n if (color !== undefined) {\n paint.setShader(null);\n color[3] *= opacity;\n paint.setColor(color);\n } else {\n const cl = paint.getColor();\n cl[3] = opacity;\n paint.setColor(cl);\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (shader !== undefined) {\n paint.setShader(shader);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(blendMode);\n }\n if (colorFilter !== undefined) {\n paint.setColorFilter(colorFilter);\n }\n if (imageFilter !== undefined) {\n paint.setImageFilter(imageFilter);\n }\n if (maskFilter !== undefined) {\n paint.setMaskFilter(maskFilter);\n }\n if (pathEffect !== undefined) {\n paint.setPathEffect(pathEffect);\n }\n if (alpha !== undefined) {\n paint.setAlphaf(alpha * opacity);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(strokeCap);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(strokeJoin);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (style !== undefined) {\n paint.setStyle(style);\n }\n return paint;\n};\n"],"mappings":";;;;;;;AAOA;;AAgBA;;AAEA;;AAEA;;;;AAEA,MAAMA,UAAU,GAAG,CACjB,OADiB,EAEjB,aAFiB,EAGjB,WAHiB,EAIjB,WAJiB,EAKjB,YALiB,EAMjB,aANiB,EAOjB,OAPiB,EAQjB,WARiB,EASjB,SATiB,CAAnB;;AAiBO,MAAeC,aAAf,SACGC,aADH,CAGP;EAOEC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWC,IAAX,EAAiBC,KAAjB;;IADsD,oCANxB,IAMwB;;IAAA;;IAAA;;IAAA;;IAAA;;IAEtD,KAAKC,MAAL,GAAc,KAAKC,IAAL,CAAUC,MAAV,EAAd;IACA,KAAKC,YAAL;EACD;;EAEDC,QAAQ,CAACL,KAAD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KAAK,CAACiB,SAAN,CAAgBnC,MAAhB;EACD;;EACD,IAAIhB,SAAS,KAAKzB,SAAlB,EAA6B;IAC3B2D,KAAK,CAACsB,YAAN,CAAmBxD,SAAnB;EACD;;EACD,IAAIN,SAAS,KAAKnB,SAAlB,EAA6B;IAC3B2D,KAAK,CAACuB,YAAN,CAAmB/D,SAAnB;EACD;;EACD,IAAIkB,WAAW,KAAKrC,SAApB,EAA+B;IAC7B2D,KAAK,CAACwB,cAAN,CAAqB9C,WAArB;EACD;;EACD,IAAIW,WAAW,KAAKhD,SAApB,EAA+B;IAC7B2D,KAAK,CAACyB,cAAN,CAAqBpC,WAArB;EACD;;EACD,IAAIG,UAAU,KAAKnD,SAAnB,EAA8B;IAC5B2D,KAAK,CAAC0B,aAAN,CAAoBlC,UAApB;EACD;;EACD,IAAIP,UAAU,KAAK5C,SAAnB,EAA8B;IAC5B2D,KAAK,CAAC2B,aAAN,CAAoB1C,UAApB;EACD;;EACD,IAAI8B,KAAK,KAAK1E,SAAd,EAAyB;IACvB2D,KAAK,CAAC4B,SAAN,CAAgBb,KAAK,GAAGlD,OAAxB;EACD;;EACD,IAAIF,SAAS,KAAKtB,SAAlB,EAA6B;IAC3B2D,KAAK,CAAC6B,YAAN,CAAmBlE,SAAnB;EACD;;EACD,IAAID,UAAU,KAAKrB,SAAnB,EAA8B;IAC5B2D,KAAK,CAAC8B,aAAN,CAAoBpE,UAApB;EACD;;EACD,IAAIE,WAAW,KAAKvB,SAApB,EAA+B;IAC7B2D,KAAK,CAAC+B,cAAN,CAAqBnE,WAArB;EACD;;EACD,IAAIH,KAAK,KAAKpB,SAAd,EAAyB;IACvB2D,KAAK,CAACgC,QAAN,CAAevE,KAAf;EACD;;EACD,OAAOuC,KAAP;AACD,CAtED"}
1
+ {"version":3,"names":["paintProps","JsiRenderNode","JsiNode","constructor","ctx","type","props","matrix","Skia","Matrix","onPropChange","setProps","paintCache","setProp","key","value","hasChanged","includes","identity","clipPath","undefined","clipRect","clipRRect","computeMatrix","computeClip","addChild","child","JsiDeclarationNode","setInvalidate","insertChildBefore","before","clip","isPathDef","processPath","isRRect","processTransformProps","getPaintCtx","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","Color","BlendMode","enumKey","PaintStyle","StrokeJoin","StrokeCap","_children","forEach","isColorFilter","cf","materialize","colorFilter","ColorFilter","MakeCompose","isShader","shader","isPathEffect","pe","pathEffect","PathEffect","isImageFilter","filter","imageFilter","ImageFilter","isMaskFilter","maskFilter","render","parentCtx","invertClip","layer","transform","canvas","parent","paint","paintCtx","concatPaint","copy","hasTransform","hasClip","shouldSave","op","ClipOp","Difference","Intersect","saveLayer","save","concat","renderNode","restore","setAlphaf","getAlphaf","currentOpacity","setShader","setColor","setStrokeWidth","setAntiAlias","setBlendMode","setColorFilter","setImageFilter","setMaskFilter","setPathEffect","setStrokeCap","setStrokeJoin","setStrokeMiter","setStyle"],"sources":["RenderNode.ts"],"sourcesContent":["import type {\n SkMatrix,\n SkRect,\n SkRRect,\n SkPath,\n SkPaint,\n} from \"../../skia/types\";\nimport {\n StrokeCap,\n StrokeJoin,\n PaintStyle,\n BlendMode,\n ClipOp,\n isRRect,\n} from \"../../skia/types\";\nimport type {\n RenderNode,\n GroupProps,\n DrawingContext,\n NodeType,\n Node,\n} from \"../types\";\n\nimport { isPathDef, processPath, processTransformProps } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiNode, JsiDeclarationNode } from \"./Node\";\nimport type { PaintContext } from \"./PaintContext\";\nimport { enumKey } from \"./datatypes/Enum\";\n\nconst paintProps = [\n \"color\",\n \"strokeWidth\",\n \"blendMode\",\n \"strokeCap\",\n \"strokeJoin\",\n \"strokeMiter\",\n \"style\",\n \"antiAlias\",\n \"opacity\",\n];\n\ninterface PaintCache {\n parent: SkPaint;\n child: SkPaint;\n}\n\nexport abstract class JsiRenderNode<P extends GroupProps>\n extends JsiNode<P>\n implements RenderNode<P>\n{\n paintCache: PaintCache | null = null;\n matrix: SkMatrix;\n clipRect?: SkRect;\n clipRRect?: SkRRect;\n clipPath?: SkPath;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.matrix = this.Skia.Matrix();\n this.onPropChange();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.onPropChange();\n this.paintCache = null;\n }\n\n setProp<K extends keyof P>(key: K, value: P[K]) {\n const hasChanged = super.setProp(key, value);\n if (hasChanged) {\n this.onPropChange();\n if (paintProps.includes(key as string)) {\n this.paintCache = null;\n }\n }\n return hasChanged;\n }\n\n protected onPropChange() {\n this.matrix.identity();\n this.clipPath = undefined;\n this.clipRect = undefined;\n this.clipRRect = undefined;\n this.computeMatrix();\n this.computeClip();\n }\n\n addChild(child: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.addChild(child);\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n if (child instanceof JsiDeclarationNode) {\n child.setInvalidate(() => (this.paintCache = null));\n }\n super.insertChildBefore(child, before);\n }\n\n private computeClip() {\n const { clip } = this.props;\n if (clip) {\n if (isPathDef(clip)) {\n this.clipPath = processPath(this.Skia, clip);\n } else if (isRRect(clip)) {\n this.clipRRect = clip;\n } else {\n this.clipRect = clip;\n }\n }\n }\n\n private computeMatrix() {\n processTransformProps(this.matrix, this.props);\n }\n\n private getPaintCtx() {\n let ctx: PaintContext | undefined;\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n } = this.props;\n if (\n color !== undefined ||\n strokeWidth !== undefined ||\n blendMode !== undefined ||\n style !== undefined ||\n strokeJoin !== undefined ||\n strokeCap !== undefined ||\n strokeMiter !== undefined ||\n opacity !== undefined ||\n antiAlias !== undefined\n ) {\n ctx = { opacity: 1 };\n if (color !== undefined) {\n ctx.color = this.Skia.Color(color);\n }\n if (strokeWidth !== undefined) {\n ctx.strokeWidth = strokeWidth;\n }\n if (blendMode !== undefined) {\n ctx.blendMode = BlendMode[enumKey(blendMode)];\n }\n if (style !== undefined) {\n ctx.style = PaintStyle[enumKey(style)];\n }\n if (strokeJoin !== undefined) {\n ctx.strokeJoin = StrokeJoin[enumKey(strokeJoin)];\n }\n if (strokeCap !== undefined) {\n ctx.strokeCap = StrokeCap[enumKey(strokeCap)];\n }\n if (strokeMiter !== undefined) {\n ctx.strokeMiter = strokeMiter;\n }\n if (opacity !== undefined) {\n ctx.opacity = opacity;\n }\n if (antiAlias !== undefined) {\n ctx.antiAlias = antiAlias;\n }\n }\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n if (child.isColorFilter()) {\n ctx = ctx || {};\n const cf = child.materialize();\n ctx.colorFilter = ctx.colorFilter\n ? this.Skia.ColorFilter.MakeCompose(cf, ctx.colorFilter)\n : cf;\n } else if (child.isShader()) {\n ctx = ctx || {};\n const shader = child.materialize();\n ctx.shader = shader;\n } else if (child.isPathEffect()) {\n ctx = ctx || {};\n const pe = child.materialize();\n ctx.pathEffect = ctx.pathEffect\n ? this.Skia.PathEffect.MakeCompose(pe, ctx.pathEffect)\n : pe;\n } else if (child.isImageFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.imageFilter = ctx.imageFilter\n ? this.Skia.ImageFilter.MakeCompose(filter, ctx.imageFilter)\n : filter;\n } else if (child.isMaskFilter()) {\n ctx = ctx || {};\n const filter = child.materialize();\n ctx.maskFilter = filter;\n }\n }\n });\n return ctx;\n }\n\n render(parentCtx: DrawingContext) {\n const { invertClip, layer, matrix, transform } = this.props;\n const { canvas } = parentCtx;\n\n if (\n this.paintCache === null ||\n this.paintCache.parent !== parentCtx.paint\n ) {\n const paintCtx = this.getPaintCtx();\n const child = paintCtx\n ? concatPaint(parentCtx.paint.copy(), paintCtx)\n : parentCtx.paint;\n this.paintCache = { parent: parentCtx.paint, child };\n }\n const paint = this.paintCache.child;\n // TODO: can we only recreate a new context here if needed?\n const ctx = { ...parentCtx, paint };\n const hasTransform = matrix !== undefined || transform !== undefined;\n const hasClip =\n this.clipRect !== undefined ||\n this.clipPath !== undefined ||\n this.clipRRect !== undefined;\n const shouldSave = hasTransform || hasClip || !!layer;\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else {\n canvas.saveLayer(layer);\n }\n } else {\n canvas.save();\n }\n }\n\n if (this.matrix) {\n canvas.concat(this.matrix);\n }\n if (this.clipRect) {\n canvas.clipRect(this.clipRect, op, true);\n } else if (this.clipRRect) {\n canvas.clipRRect(this.clipRRect, op, true);\n } else if (this.clipPath) {\n canvas.clipPath(this.clipPath, op, true);\n }\n\n this.renderNode(ctx);\n\n if (shouldSave) {\n canvas.restore();\n }\n }\n\n abstract renderNode(ctx: DrawingContext): void;\n}\n\nconst concatPaint = (\n paint: SkPaint,\n {\n color,\n strokeWidth,\n shader,\n antiAlias,\n blendMode,\n colorFilter,\n imageFilter,\n maskFilter,\n pathEffect,\n opacity,\n strokeCap,\n strokeJoin,\n strokeMiter,\n style,\n }: PaintContext\n) => {\n if (opacity !== undefined) {\n paint.setAlphaf(paint.getAlphaf() * opacity);\n }\n if (color !== undefined) {\n const currentOpacity = paint.getAlphaf();\n paint.setShader(null);\n paint.setColor(color);\n paint.setAlphaf(currentOpacity * paint.getAlphaf());\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (shader !== undefined) {\n paint.setShader(shader);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(blendMode);\n }\n if (colorFilter !== undefined) {\n paint.setColorFilter(colorFilter);\n }\n if (imageFilter !== undefined) {\n paint.setImageFilter(imageFilter);\n }\n if (maskFilter !== undefined) {\n paint.setMaskFilter(maskFilter);\n }\n if (pathEffect !== undefined) {\n paint.setPathEffect(pathEffect);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(strokeCap);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(strokeJoin);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (style !== undefined) {\n paint.setStyle(style);\n }\n return paint;\n};\n"],"mappings":";;;;;;;AAOA;;AAgBA;;AAEA;;AAEA;;;;AAEA,MAAMA,UAAU,GAAG,CACjB,OADiB,EAEjB,aAFiB,EAGjB,WAHiB,EAIjB,WAJiB,EAKjB,YALiB,EAMjB,aANiB,EAOjB,OAPiB,EAQjB,WARiB,EASjB,SATiB,CAAnB;;AAiBO,MAAeC,aAAf,SACGC,aADH,CAGP;EAOEC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWC,IAAX,EAAiBC,KAAjB;;IADsD,oCANxB,IAMwB;;IAAA;;IAAA;;IAAA;;IAAA;;IAEtD,KAAKC,MAAL,GAAc,KAAKC,IAAL,CAAUC,MAAV,EAAd;IACA,KAAKC,YAAL;EACD;;EAEDC,QAAQ,CAACL,KAAD,EAAW;IACjB,MAAMK,QAAN,CAAeL,KAAf;IACA,KAAKI,YAAL;IACA,KAAKE,UAAL,GAAkB,IAAlB;EACD;;EAEDC,OAAO,CAAoBC,GAApB,EAA4BC,KAA5B,EAAyC;IAC9C,MAAMC,UAAU,GAAG,MAAMH,OAAN,CAAcC,GAAd,EAAmBC,KAAnB,CAAnB;;IACA,IAAIC,UAAJ,EAAgB;MACd,KAAKN,YAAL;;MACA,IAAIV,UAAU,CAACiB,QAAX,CAAoBH,GAApB,CAAJ,EAAwC;QACtC,KAAKF,UAAL,GAAkB,IAAlB;MACD;IACF;;IACD,OAAOI,UAAP;EACD;;EAESN,YAAY,GAAG;IACvB,KAAKH,MAAL,CAAYW,QAAZ;IACA,KAAKC,QAAL,GAAgBC,SAAhB;IACA,KAAKC,QAAL,GAAgBD,SAAhB;IACA,KAAKE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KAAK,CAAC6B,aAAN,CAAoBnE,UAApB;EACD;;EACD,IAAIE,WAAW,KAAKvB,SAApB,EAA+B;IAC7B2D,KAAK,CAAC8B,cAAN,CAAqBlE,WAArB;EACD;;EACD,IAAIH,KAAK,KAAKpB,SAAd,EAAyB;IACvB2D,KAAK,CAAC+B,QAAN,CAAetE,KAAf;EACD;;EACD,OAAOuC,KAAP;AACD,CAjED"}
@@ -43,19 +43,6 @@ Object.keys(_Fitting).forEach(function (key) {
43
43
  });
44
44
  });
45
45
 
46
- var _Color = require("./Color");
47
-
48
- Object.keys(_Color).forEach(function (key) {
49
- if (key === "default" || key === "__esModule") return;
50
- if (key in exports && exports[key] === _Color[key]) return;
51
- Object.defineProperty(exports, key, {
52
- enumerable: true,
53
- get: function () {
54
- return _Color[key];
55
- }
56
- });
57
- });
58
-
59
46
  var _Rect = require("./Rect");
60
47
 
61
48
  Object.keys(_Rect).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Enum\";\nexport * from \"./Path\";\nexport * from \"./Fitting\";\nexport * from \"./Color\";\nexport * from \"./Rect\";\nexport * from \"./Radius\";\nexport * from \"./Circle\";\nexport * from \"./Gradient\";\nexport * from \"./Transform\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Enum\";\nexport * from \"./Path\";\nexport * from \"./Fitting\";\nexport * from \"./Rect\";\nexport * from \"./Radius\";\nexport * from \"./Circle\";\nexport * from \"./Gradient\";\nexport * from \"./Transform\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -11,8 +11,6 @@ var _types2 = require("../../types");
11
11
 
12
12
  var _Node = require("../Node");
13
13
 
14
- var _datatypes = require("../datatypes");
15
-
16
14
  var _RenderNode = require("../RenderNode");
17
15
 
18
16
  const inflate = function (Skia, box, dx, dy) {
@@ -48,12 +46,12 @@ class BoxNode extends _RenderNode.JsiRenderNode {
48
46
  renderNode(_ref) {
49
47
  let {
50
48
  canvas,
51
- paint,
52
- opacity
49
+ paint
53
50
  } = _ref;
54
51
  const {
55
52
  box: defaultBox
56
53
  } = this.props;
54
+ const opacity = paint.getAlphaf();
57
55
  const box = (0, _types.isRRect)(defaultBox) ? defaultBox : this.Skia.RRectXY(defaultBox, 0, 0);
58
56
 
59
57
  const shadows = this._children.map(node => {
@@ -73,7 +71,8 @@ class BoxNode extends _RenderNode.JsiRenderNode {
73
71
  dy = 0
74
72
  } = shadow;
75
73
  const lPaint = this.Skia.Paint();
76
- lPaint.setColor((0, _datatypes.processColor)(this.Skia, color, opacity));
74
+ lPaint.setColor(this.Skia.Color(color));
75
+ lPaint.setAlphaf(paint.getAlphaf() * opacity);
77
76
  lPaint.setMaskFilter(this.Skia.MaskFilter.MakeBlur(_types.BlurStyle.Normal, blur, true));
78
77
  canvas.drawRRect(inflate(this.Skia, box, spread, spread, dx, dy), lPaint);
79
78
  });
@@ -90,7 +89,8 @@ class BoxNode extends _RenderNode.JsiRenderNode {
90
89
  canvas.save();
91
90
  canvas.clipRRect(box, _types.ClipOp.Intersect, false);
92
91
  const lPaint = this.Skia.Paint();
93
- lPaint.setColor((0, _datatypes.processColor)(this.Skia, color, opacity));
92
+ lPaint.setColor(this.Skia.Color(color));
93
+ lPaint.setAlphaf(paint.getAlphaf() * opacity);
94
94
  lPaint.setMaskFilter(this.Skia.MaskFilter.MakeBlur(_types.BlurStyle.Normal, blur, true));
95
95
  const inner = deflate(this.Skia, box, spread, spread, dx, dy);
96
96
  const outer = inflate(this.Skia, box, delta.x, delta.y);
@@ -1 +1 @@
1
- {"version":3,"names":["inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","Unknown","NodeType","Box","materialize","BoxNode","JsiRenderNode","renderNode","canvas","paint","opacity","defaultBox","isRRect","shadows","_children","map","node","filter","n","shadow","inner","color","blur","spread","lPaint","Paint","setColor","processColor","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","ClipOp","Intersect","outer","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import type { SkRRect, Skia } from \"../../../skia/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { DrawingContext } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport type { BoxShadowProps, BoxProps } from \"../../types/Drawings\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { processColor } from \"../datatypes\";\nimport { JsiRenderNode } from \"../RenderNode\";\n\nconst inflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) =>\n Skia.RRectXY(\n Skia.XYWHRect(\n box.rect.x - dx + tx,\n box.rect.y - dy + ty,\n box.rect.width + 2 * dx,\n box.rect.height + 2 * dy\n ),\n box.rx + dx,\n box.ry + dy\n );\n\nconst deflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) => inflate(Skia, box, -dx, -dy, tx, ty);\n\nexport class BoxShadowNode extends JsiDeclarationNode<\n BoxShadowProps,\n BoxShadowProps\n> {\n constructor(ctx: NodeContext, props: BoxShadowProps) {\n super(ctx, DeclarationType.Unknown, NodeType.Box, props);\n }\n\n materialize() {\n return this.props;\n }\n}\n\nexport class BoxNode extends JsiRenderNode<BoxProps> {\n constructor(ctx: NodeContext, props: BoxProps) {\n super(ctx, NodeType.Box, props);\n }\n\n renderNode({ canvas, paint, opacity }: DrawingContext) {\n const { box: defaultBox } = this.props;\n const box = isRRect(defaultBox)\n ? defaultBox\n : this.Skia.RRectXY(defaultBox, 0, 0);\n const shadows = this._children\n .map((node) => {\n if (node instanceof BoxShadowNode) {\n return node.materialize();\n }\n return null;\n })\n .filter((n): n is BoxShadowProps => n !== null);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = this.Skia.Paint();\n lPaint.setColor(processColor(this.Skia, color, opacity));\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(\n inflate(this.Skia, box, spread, spread, dx, dy),\n lPaint\n );\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = this.Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = this.Skia.Paint();\n lPaint.setColor(processColor(this.Skia, color, opacity));\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(this.Skia, box, spread, spread, dx, dy);\n const outer = inflate(this.Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AAGA;;AACA;;AACA;;AAEA,MAAMA,OAAO,GAAG,UACdC,IADc,EAEdC,GAFc,EAGdC,EAHc,EAIdC,EAJc;EAAA,IAKdC,EALc,uEAKT,CALS;EAAA,IAMdC,EANc,uEAMT,CANS;EAAA,OAQdL,IAAI,CAACM,OAAL,CACEN,IAAI,CAACO,QAAL,CACEN,GAAG,CAACO,IAAJ,CAASC,CAAT,GAAaP,EAAb,GAAkBE,EADpB,EAEEH,GAAG,CAACO,IAAJ,CAASE,CAAT,GAAaP,EAAb,GAAkBE,EAFpB,EAGEJ,GAAG,CAACO,IAAJ,CAASG,KAAT,GAAiB,IAAIT,EAHvB,EAIED,GAAG,CAACO,IAAJ,CAASI,MAAT,GAAkB,IAAIT,EAJxB,CADF,EAOEF,GAAG,CAACY,EAAJ,GAASX,EAPX,EAQED,GAAG,CAACa,EAAJ,GAASX,EARX,CARc;AAAA,CAAhB;;AAmBA,MAAMY,OAAO,GAAG,UACdf,IADc,EAEdC,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AAOC,SAA7B,EAAwC,KAAxC;MACA,MAAMjB,MAAM,GAAG,KAAK7C,IAAL,CAAU8C,KAAV,EAAf;MACAD,MAAM,CAACE,QAAP,CAAgB,IAAAC,uBAAA,EAAa,KAAKhD,IAAlB,EAAwB0C,KAAxB,EAA+BX,OAA/B,CAAhB;MACAc,MAAM,CAACI,aAAP,CACE,KAAKjD,IAAL,CAAUkD,UAAV,CAAqBC,QAArB,CAA8BC,gBAAA,CAAUC,MAAxC,EAAgDV,IAAhD,EAAsD,IAAtD,CADF;MAGA,MAAMF,KAAK,GAAG1B,OAAO,CAAC,KAAKf,IAAN,EAAYC,GAAZ,EAAiB2C,MAAjB,EAAyBA,MAAzB,EAAiC1C,EAAjC,EAAqCC,EAArC,CAArB;MACA,MAAM4D,KAAK,GAAGhE,OAAO,CAAC,KAAKC,IAAN,EAAYC,GAAZ,EAAiBsD,KAAK,CAAC9C,CAAvB,EAA0B8C,KAAK,CAAC7C,CAAhC,CAArB;MACAmB,MAAM,CAACmC,UAAP,CAAkBD,KAAlB,EAAyBtB,KAAzB,EAAgCI,MAAhC;MACAhB,MAAM,CAACoC,OAAP;IACD,CAhBH;EAiBD;;AApDkD"}
1
+ {"version":3,"names":["inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","Unknown","NodeType","Box","materialize","BoxNode","JsiRenderNode","renderNode","canvas","paint","defaultBox","opacity","getAlphaf","isRRect","shadows","_children","map","node","filter","n","shadow","inner","color","blur","spread","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","BlurStyle","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","ClipOp","Intersect","outer","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import type { SkRRect, Skia } from \"../../../skia/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { DrawingContext } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport type { BoxShadowProps, BoxProps } from \"../../types/Drawings\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { JsiRenderNode } from \"../RenderNode\";\n\nconst inflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) =>\n Skia.RRectXY(\n Skia.XYWHRect(\n box.rect.x - dx + tx,\n box.rect.y - dy + ty,\n box.rect.width + 2 * dx,\n box.rect.height + 2 * dy\n ),\n box.rx + dx,\n box.ry + dy\n );\n\nconst deflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) => inflate(Skia, box, -dx, -dy, tx, ty);\n\nexport class BoxShadowNode extends JsiDeclarationNode<\n BoxShadowProps,\n BoxShadowProps\n> {\n constructor(ctx: NodeContext, props: BoxShadowProps) {\n super(ctx, DeclarationType.Unknown, NodeType.Box, props);\n }\n\n materialize() {\n return this.props;\n }\n}\n\nexport class BoxNode extends JsiRenderNode<BoxProps> {\n constructor(ctx: NodeContext, props: BoxProps) {\n super(ctx, NodeType.Box, props);\n }\n\n renderNode({ canvas, paint }: DrawingContext) {\n const { box: defaultBox } = this.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox)\n ? defaultBox\n : this.Skia.RRectXY(defaultBox, 0, 0);\n const shadows = this._children\n .map((node) => {\n if (node instanceof BoxShadowNode) {\n return node.materialize();\n }\n return null;\n })\n .filter((n): n is BoxShadowProps => n !== null);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(\n inflate(this.Skia, box, spread, spread, dx, dy),\n lPaint\n );\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = this.Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(this.Skia, box, spread, spread, dx, dy);\n const outer = inflate(this.Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AAGA;;AACA;;AAEA,MAAMA,OAAO,GAAG,UACdC,IADc,EAEdC,GAFc,EAGdC,EAHc,EAIdC,EAJc;EAAA,IAKdC,EALc,uEAKT,CALS;EAAA,IAMdC,EANc,uEAMT,CANS;EAAA,OAQdL,IAAI,CAACM,OAAL,CACEN,IAAI,CAACO,QAAL,CACEN,GAAG,CAACO,IAAJ,CAASC,CAAT,GAAaP,EAAb,GAAkBE,EADpB,EAEEH,GAAG,CAACO,IAAJ,CAASE,CAAT,GAAaP,EAAb,GAAkBE,EAFpB,EAGEJ,GAAG,CAACO,IAAJ,CAASG,KAAT,GAAiB,IAAIT,EAHvB,EAIED,GAAG,CAACO,IAAJ,CAASI,MAAT,GAAkB,IAAIT,EAJxB,CADF,EAOEF,GAAG,CAACY,EAAJ,GAASX,EAPX,EAQED,GAAG,CAACa,EAAJ,GAASX,EARX,CARc;AAAA,CAAhB;;AAmBA,MAAMY,OAAO,GAAG,UACdf,IADc,EAEdC,GAFc,EAGdC,EAHc,EAIdC,EAJc;EAAA,IAKdC,EALc,uEAKT,CALS;EAAA,IAMdC,EANc,uEAMT,CANS;EA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AwC,KAAxC;MACA,MAAMlB,MAAM,GAAG,KAAK9C,IAAL,CAAU+C,KAAV,EAAf;MACAD,MAAM,CAACE,QAAP,CAAgB,KAAKhD,IAAL,CAAUiD,KAAV,CAAgBN,KAAhB,CAAhB;MACAG,MAAM,CAACI,SAAP,CAAiBpB,KAAK,CAACG,SAAN,KAAoBD,OAArC;MAEAc,MAAM,CAACK,aAAP,CACE,KAAKnD,IAAL,CAAUoD,UAAV,CAAqBC,QAArB,CAA8BC,gBAAA,CAAUC,MAAxC,EAAgDX,IAAhD,EAAsD,IAAtD,CADF;MAGA,MAAMF,KAAK,GAAG3B,OAAO,CAAC,KAAKf,IAAN,EAAYC,GAAZ,EAAiB4C,MAAjB,EAAyBA,MAAzB,EAAiC3C,EAAjC,EAAqCC,EAArC,CAArB;MACA,MAAM8D,KAAK,GAAGlE,OAAO,CAAC,KAAKC,IAAN,EAAYC,GAAZ,EAAiBwD,KAAK,CAAChD,CAAvB,EAA0BgD,KAAK,CAAC/C,CAAhC,CAArB;MACAmB,MAAM,CAACqC,UAAP,CAAkBD,KAAlB,EAAyBvB,KAAzB,EAAgCI,MAAhC;MACAjB,MAAM,CAACsC,OAAP;IACD,CAlBH;EAmBD;;AAxDkD"}
@@ -34,15 +34,14 @@ class PatchNode extends _DrawingNode.JsiDrawingNode {
34
34
  return {
35
35
  mode,
36
36
  points: [patch[0].pos, patch[0].c2, patch[1].c1, patch[1].pos, patch[1].c2, patch[2].c1, patch[2].pos, patch[2].c2, patch[3].c1, patch[3].pos, patch[3].c2, patch[0].c1],
37
- colors: colors ? colors.map(c => (0, _datatypes.processColor)(this.Skia, c, 1)) : undefined
37
+ colors: colors ? colors.map(c => this.Skia.Color(c)) : undefined
38
38
  };
39
39
  }
40
40
 
41
41
  draw(_ref) {
42
42
  let {
43
43
  canvas,
44
- paint,
45
- opacity
44
+ paint
46
45
  } = _ref;
47
46
 
48
47
  if (!this.derived) {
@@ -57,10 +56,7 @@ class PatchNode extends _DrawingNode.JsiDrawingNode {
57
56
  points,
58
57
  mode
59
58
  } = this.derived;
60
- canvas.drawPatch(points, opacity === 1 ? colors : colors && colors.map(c => {
61
- c[_datatypes.ALPHA] = c[_datatypes.ALPHA] * opacity;
62
- return c;
63
- }), texture, mode, paint);
59
+ canvas.drawPatch(points, colors, texture, mode, paint);
64
60
  }
65
61
 
66
62
  }
@@ -1 +1 @@
1
- {"version":3,"names":["PatchNode","JsiDrawingNode","constructor","ctx","props","NodeType","Patch","deriveProps","colors","blendMode","patch","defaultBlendMode","BlendMode","DstOver","SrcOver","mode","enumKey","points","pos","c2","c1","map","c","processColor","Skia","undefined","draw","canvas","paint","opacity","derived","Error","texture","drawPatch","ALPHA"],"sources":["PatchNode.ts"],"sourcesContent":["import type { SkColor, SkPoint } from \"../../../skia/types\";\nimport { BlendMode } from \"../../../skia/types\";\nimport type { DrawingContext, PatchProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { ALPHA, enumKey, processColor } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class PatchNode extends JsiDrawingNode<\n PatchProps,\n { points: SkPoint[]; colors: SkColor[] | undefined; mode: BlendMode }\n> {\n constructor(ctx: NodeContext, props: PatchProps) {\n super(ctx, NodeType.Patch, props);\n }\n\n deriveProps() {\n const { colors, blendMode, patch } = this.props;\n const defaultBlendMode = 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 return {\n mode,\n 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 colors: colors\n ? colors.map((c) => processColor(this.Skia, c, 1))\n : undefined,\n };\n }\n\n draw({ canvas, paint, opacity }: DrawingContext) {\n if (!this.derived) {\n throw new Error(\"PatchNode: derived props not set\");\n }\n const { texture } = this.props;\n const { colors, points, mode } = this.derived;\n canvas.drawPatch(\n points,\n opacity === 1\n ? colors\n : colors &&\n colors.map((c) => {\n c[ALPHA] = c[ALPHA] * opacity;\n return c;\n }),\n texture,\n mode,\n paint\n );\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AACA;;AAGO,MAAMA,SAAN,SAAwBC,2BAAxB,CAGL;EACAC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAsC;IAC/C,MAAMD,GAAN,EAAWE,gBAAA,CAASC,KAApB,EAA2BF,KAA3B;EACD;;EAEDG,WAAW,GAAG;IACZ,MAAM;MAAEC,MAAF;MAAUC,SAAV;MAAqBC;IAArB,IAA+B,KAAKN,KAA1C;IACA,MAAMO,gBAAgB,GAAGH,MAAM,GAAGI,gBAAA,CAAUC,OAAb,GAAuBD,gBAAA,CAAUE,OAAhE;IACA,MAAMC,IAAI,GAAGN,SAAS,GAAGG,gBAAA,CAAU,IAAAI,kBAAA,EAAQP,SAAR,CAAV,CAAH,GAAmCE,gBAAzD,CAHY,CAIZ;IACA;IACA;IACA;IACA;;IACA,OAAO;MACLI,IADK;MAELE,MAAM,EAAE,CACNP,KAAK,CAAC,CAAD,CAAL,CAASQ,GADH,EAENR,KAAK,CAAC,CAAD,CAAL,CAASS,EAFH,EAGNT,KAAK,CAAC,CAAD,CAAL,CAASU,EAHH,EAINV,KAAK,CAAC,CAAD,CAAL,CAASQ,GAJH,EAKNR,KAAK,CAAC,CAAD,CAAL,CAASS,EALH,EAMNT,KAAK,CAAC,CAAD,CAAL,CAASU,EANH,EAONV,KAAK,CAAC,CAAD,CAAL,CAASQ,GAPH,EAQNR,KAAK,CAAC,CAAD,CAAL,CAASS,EARH,EASNT,KAAK,CAAC,CAAD,CAAL,CAASU,EATH,EAUNV,KAAK,CAAC,CAAD,CAAL,CAASQ,GAVH,EAWNR,KAAK,CAAC,CAAD,CAAL,CAASS,EAXH,EAYNT,KAAK,CAAC,CAAD,CAAL,CAASU,EAZH,CAFH;MAgBLZ,MAAM,EAAEA,MAAM,GACVA,MAAM,CAACa,GAAP,CAAYC,CAAD,IAAO,IAAAC,uBAAA,EAAa,KAAKC,IAAlB,EAAwBF,CAAxB,EAA2B,CAA3B,CAAlB,CADU,GAEVG;IAlBC,CAAP;EAoBD;;EAEDC,IAAI,OAA6C;IAAA,IAA5C;MAAEC,MAAF;MAAUC,KAAV;MAAiBC;IAAjB,CAA4C;;IAC/C,IAAI,CAAC,KAAKC,OAAV,EAAmB;MACjB,MAAM,IAAIC,KAAJ,CAAU,kCAAV,CAAN;IACD;;IACD,MAAM;MAAEC;IAAF,IAAc,KAAK5B,KAAzB;IACA,MAAM;MAAEI,MAAF;MAAUS,MAAV;MAAkBF;IAAlB,IAA2B,KAAKe,OAAtC;IACAH,MAAM,CAACM,SAAP,CACEhB,MADF,EAEEY,OAAO,KAAK,CAAZ,GACIrB,MADJ,GAEIA,MAAM,IACJA,MAAM,CAACa,GAAP,CAAYC,CAAD,IAAO;MAChBA,CAAC,CAACY,gBAAD,CAAD,GAAWZ,CAAC,CAACY,gBAAD,CAAD,GAAWL,OAAtB;MACA,OAAOP,CAAP;IACD,CAHD,CALR,EASEU,OATF,EAUEjB,IAVF,EAWEa,KAXF;EAaD;;AAvDD"}
1
+ {"version":3,"names":["PatchNode","JsiDrawingNode","constructor","ctx","props","NodeType","Patch","deriveProps","colors","blendMode","patch","defaultBlendMode","BlendMode","DstOver","SrcOver","mode","enumKey","points","pos","c2","c1","map","c","Skia","Color","undefined","draw","canvas","paint","derived","Error","texture","drawPatch"],"sources":["PatchNode.ts"],"sourcesContent":["import type { SkColor, SkPoint } from \"../../../skia/types\";\nimport { BlendMode } from \"../../../skia/types\";\nimport type { DrawingContext, PatchProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class PatchNode extends JsiDrawingNode<\n PatchProps,\n { points: SkPoint[]; colors: SkColor[] | undefined; mode: BlendMode }\n> {\n constructor(ctx: NodeContext, props: PatchProps) {\n super(ctx, NodeType.Patch, props);\n }\n\n deriveProps() {\n const { colors, blendMode, patch } = this.props;\n const defaultBlendMode = 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 return {\n mode,\n 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 colors: colors ? colors.map((c) => this.Skia.Color(c)) : undefined,\n };\n }\n\n draw({ canvas, paint }: DrawingContext) {\n if (!this.derived) {\n throw new Error(\"PatchNode: derived props not set\");\n }\n const { texture } = this.props;\n const { colors, points, mode } = this.derived;\n canvas.drawPatch(points, colors, texture, mode, paint);\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AACA;;AAGO,MAAMA,SAAN,SAAwBC,2BAAxB,CAGL;EACAC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAsC;IAC/C,MAAMD,GAAN,EAAWE,gBAAA,CAASC,KAApB,EAA2BF,KAA3B;EACD;;EAEDG,WAAW,GAAG;IACZ,MAAM;MAAEC,MAAF;MAAUC,SAAV;MAAqBC;IAArB,IAA+B,KAAKN,KAA1C;IACA,MAAMO,gBAAgB,GAAGH,MAAM,GAAGI,gBAAA,CAAUC,OAAb,GAAuBD,gBAAA,CAAUE,OAAhE;IACA,MAAMC,IAAI,GAAGN,SAAS,GAAGG,gBAAA,CAAU,IAAAI,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DrawingNode.JsiDrawingNode {
27
27
  indices
28
28
  } = this.props;
29
29
  const vertexMode = mode ? _types.VertexMode[(0, _datatypes.enumKey)(mode)] : _types.VertexMode.Triangles;
30
- return this.Skia.MakeVertices(vertexMode, vertices, textures, colors ? colors.map(c => (0, _datatypes.processColor)(this.Skia, c, 1)) : undefined, indices);
30
+ return this.Skia.MakeVertices(vertexMode, vertices, textures, colors ? colors.map(c => this.Skia.Color(c)) : undefined, indices);
31
31
  }
32
32
 
33
33
  draw(_ref) {
@@ -1 +1 @@
1
- {"version":3,"names":["VerticesNode","JsiDrawingNode","constructor","ctx","props","NodeType","Vertices","deriveProps","mode","vertices","textures","colors","indices","vertexMode","VertexMode","enumKey","Triangles","Skia","MakeVertices","map","c","processColor","undefined","draw","canvas","paint","blendMode","defaultBlendMode","BlendMode","DstOver","SrcOver","blend","derived","Error","drawVertices"],"sources":["VerticesNode.ts"],"sourcesContent":["import type { SkVertices } from \"../../../skia/types\";\nimport { VertexMode, BlendMode } from \"../../../skia/types\";\nimport type { DrawingContext, VerticesProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { enumKey, processColor } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class VerticesNode extends JsiDrawingNode<VerticesProps, SkVertices> {\n constructor(ctx: NodeContext, props: VerticesProps) {\n super(ctx, NodeType.Vertices, props);\n }\n\n protected deriveProps() {\n const { mode, vertices, textures, colors, indices } = this.props;\n const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;\n return this.Skia.MakeVertices(\n vertexMode,\n vertices,\n textures,\n colors ? colors.map((c) => processColor(this.Skia, c, 1)) : undefined,\n indices\n );\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { colors, blendMode } = this.props;\n const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n if (this.derived === undefined) {\n thro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KAAKF,OAAzB,EAAkCD,KAAlC,EAAyCN,KAAzC;EACD;;AAzByE"}
1
+ {"version":3,"names":["VerticesNode","JsiDrawingNode","constructor","ctx","props","NodeType","Vertices","deriveProps","mode","vertices","textures","colors","indices","vertexMode","VertexMode","enumKey","Triangles","Skia","MakeVertices","map","c","Color","undefined","draw","canvas","paint","blendMode","defaultBlendMode","BlendMode","DstOver","SrcOver","blend","derived","Error","drawVertices"],"sources":["VerticesNode.ts"],"sourcesContent":["import type { SkVertices } from \"../../../skia/types\";\nimport { VertexMode, BlendMode } from \"../../../skia/types\";\nimport type { DrawingContext, VerticesProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class VerticesNode extends JsiDrawingNode<VerticesProps, SkVertices> {\n constructor(ctx: NodeContext, props: VerticesProps) {\n super(ctx, NodeType.Vertices, props);\n }\n\n protected deriveProps() {\n const { mode, vertices, textures, colors, indices } = this.props;\n const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;\n return this.Skia.MakeVertices(\n vertexMode,\n vertices,\n textures,\n colors ? colors.map((c) => this.Skia.Color(c)) : undefined,\n indices\n );\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { colors, blendMode } = this.props;\n const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n if (this.derived === undefined) {\n throw new Error(\"VerticesNode: vertices is undefined\");\n }\n canvas.drawVertices(this.derived, blend, paint);\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AACA;;AAGO,MAAMA,YAAN,SAA2BC,2BAA3B,CAAqE;EAC1EC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAyC;IAClD,MAAMD,GAAN,EAAWE,gBAAA,CAASC,QAApB,EAA8BF,KAA9B;EACD;;EAESG,WAAW,GAAG;IACtB,MAAM;MAAEC,IAAF;MAAQC,QAAR;MAAkBC,QAAlB;MAA4BC,MAA5B;MAAoCC;IAApC,IAAgD,KAAKR,KAA3D;IACA,MAAMS,UAAU,GAAGL,IAAI,GAAGM,iBAAA,CAAW,IAAAC,kBAAA,EAAQP,IAAR,CAAX,CAAH,GAA+BM,iBAAA,CAAWE,SAAjE;IACA,OAAO,KAAKC,IAAL,CAAUC,YAAV,CACLL,UADK,EAELJ,QAFK,EAGLC,QAHK,EAILC,MAAM,GAAGA,MAAM,CAACQ,GAAP,CAAYC,CAAD,IAAO,KAAKH,IAAL,CAAUI,KAAV,CAAgBD,CAAhB,CAAlB,CAAH,GAA2CE,SAJ5C,EAKLV,OALK,CAAP;EAOD;;EAEDW,IAAI,OAAoC;IAAA,IAAnC;MAAEC,MAAF;MAAUC;IAAV,CAAmC;IACtC,MAAM;MAAEd,MAAF;MAAUe;IAAV,IAAwB,KAAKtB,KAAnC;IACA,MAAMuB,gBAAgB,GAAGhB,MAAM,GAAGiB,gBAAA,CAAUC,OAAb,GAAuBD,gBAAA,CAAUE,OAAhE;IACA,MAAMC,KAAK,GAAGL,SAAS,GAAGE,gBAAA,CAAU,IAAAb,kBAAA,EAAQW,SAAR,CAAV,CAAH,GAAmCC,gBAA1D;;IACA,IAAI,KAAKK,OAAL,KAAiBV,SAArB,EAAgC;MAC9B,MAAM,IAAIW,KAAJ,CAAU,qCAAV,CAAN;IACD;;IACDT,MAAM,CAACU,YAAP,CAAoB,KAAKF,OAAzB,EAAkCD,KAAlC,EAAyCN,KAAzC;EACD;;AAzByE"}
@@ -11,8 +11,6 @@ var _Node = require("../Node");
11
11
 
12
12
  var _types2 = require("../../types");
13
13
 
14
- var _datatypes = require("../datatypes");
15
-
16
14
  var _Enum = require("../datatypes/Enum");
17
15
 
18
16
  class ColorFilterDeclaration extends _Node.JsiDeclarationNode {
@@ -82,7 +80,7 @@ class BlendColorFilterNode extends ColorFilterDeclaration {
82
80
  const {
83
81
  mode
84
82
  } = this.props;
85
- const color = (0, _datatypes.processColor)(this.Skia, this.props.color, 1);
83
+ const color = this.Skia.Color(this.props.color);
86
84
  const cf = this.Skia.ColorFilter.MakeBlend(color, _types.BlendMode[(0, _Enum.enumKey)(mode)]);
87
85
  return this.compose(cf);
88
86
  }
@@ -1 +1 @@
1
- {"version":3,"names":["ColorFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","ColorFilter","addChild","child","Error","insertChildBefore","before","compose","filter","children","_children","length","Skia","MakeCompose","reduce","acc","materialize","MatrixColorFilterNode","NodeType","MatrixColorFilter","matrix","cf","MakeMatrix","BlendColorFilterNode","BlendColorFilter","mode","color","processColor","MakeBlend","BlendMode","enumKey","LinearToSRGBGammaColorFilterNode","LinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","SRGBToLinearGammaColorFilterNode","SRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma","LumaColorFilterNode","LumaColorFilter","MakeLumaColorFilter","LerpColorFilterNode","LerpColorFilter","t","first","second","MakeLerp"],"sources":["ColorFilters.ts"],"sourcesContent":["import { BlendMode } from \"../../../skia/types\";\nimport type { SkColorFilter } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n BlendColorFilterProps,\n MatrixColorFilterProps,\n Node,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processColor } from \"../datatypes\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport type { LerpColorFilterProps } from \"../../types/ColorFilters\";\n\nexport abstract class ColorFilterDeclaration<\n P,\n Nullable extends null | never = never\n> extends JsiDeclarationNode<P, SkColorFilter, Nullable> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ColorFilter, type, props);\n }\n\n addChild(child: Node<unknown>) {\n if (!(child instanceof ColorFilterDeclaration)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof ColorFilterDeclaration)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n }\n\n compose(filter: SkColorFilter) {\n const children = this._children as ColorFilterDeclaration<unknown>[];\n if (this._children.length === 0) {\n return filter;\n } else {\n return this.Skia.ColorFilter.MakeCompose(\n filter,\n children.reduce<SkColorFilter | null>((acc, child) => {\n if (acc === null) {\n return child.materialize();\n }\n return this.Skia.ColorFilter.MakeCompose(acc, child.materialize());\n }, null) as SkColorFilter\n );\n }\n }\n}\n\nexport class MatrixColorFilterNode extends ColorFilterDeclaration<MatrixColorFilterProps> {\n constructor(ctx: NodeContext, props: MatrixColorFilterProps) {\n super(ctx, NodeType.MatrixColorFilter, props);\n }\n\n materialize() {\n const { matrix } = this.props;\n const cf = this.Skia.ColorFilter.MakeMatrix(matrix);\n return this.compose(cf);\n }\n}\n\nexport class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilterProps> {\n constructor(ctx: NodeContext, props: BlendColorFilterProps) {\n super(ctx, NodeType.BlendColorFilter, props);\n }\n\n materialize() {\n const { mode } = this.props;\n const color = processColor(this.Skia, this.props.color, 1);\n const cf = this.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n return this.compose(cf);\n }\n}\n\nexport class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LinearToSRGBGammaColorFilter, null);\n }\n\n materialize() {\n const cf = this.Skia.ColorFilter.MakeLinearToSRGBGamma();\n return this.compose(cf);\n }\n}\n\nexport class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SRGBToLinearGammaColorFilter, null);\n }\n\n materialize() {\n const cf = this.Skia.ColorFilter.MakeSRGBToLinearGamma();\n return this.compose(cf);\n }\n}\n\nexport class LumaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LumaColorFilter, null);\n }\n\n materialize() {\n const cf = this.Skia.ColorFilter.MakeLumaColorFilter();\n return this.compose(cf);\n }\n}\n\nexport class LerpColorFilterNode extends ColorFilterDeclaration<LerpColorFilterProps> {\n constructor(ctx: NodeContext, props: LerpColorFilterProps) {\n super(ctx, NodeType.LerpColorFilter, props);\n }\n\n materialize() {\n const { t } = this.props;\n const [first, second] = this.children() as JsiDeclarationNode<\n unknown,\n SkColorFilter\n >[];\n return this.Skia.ColorFilter.MakeLerp(\n t,\n first.materialize(),\n second.materialize()\n );\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAGA;;AAMA;;AACA;;AACA;;AAGO,MAAeA,sBAAf,SAGGC,wBAHH,CAGkD;EACvDC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWG,uBAAA,CAAgBC,WAA3B,EAAwCH,IAAxC,EAA8CC,KAA9C;EACD;;EAEDG,QAAQ,CAACC,KAAD,EAAuB;IAC7B,IAAI,EAAEA,KAAK,YAAYT,sBAAnB,CAAJ,EAAgD;MAC9C,MAAM,IAAIU,KAAJ,CAAW,4BAA2BD,KAAK,CAACL,IAAK,OAAM,KAAKA,IAAK,EAAjE,CAAN;IACD;;IACD,MAAMI,QAAN,CAAeC,KAAf;EACD;;EAEDE,iBAAiB,CAACF,KAAD,EAAuBG,MAAvB,EAAoD;IACnE,IAAI,EAAEH,KAAK,YAAYT,sBAAnB,CAAJ,EAAgD;MAC9C,MAAM,IAAIU,KAAJ,CAAW,4BAA2BD,KAAK,CAACL,IAAK,OAAM,KAAKA,IAAK,EAAjE,CAAN;IACD;;IACD,MAAMO,iBAAN,CAAwBF,KAAxB,EAA+BG,MAA/B;EACD;;EAEDC,OAAO,CAACC,MAAD,EAAwB;IAC7B,MAAMC,QAAQ,GAAG,KAAKC,SAAtB;;IACA,IAAI,KAAKA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C,KAArC;EACD;;EAEDiB,WAAW,GAAG;IACZ,MAAM;MAAE0B;IAAF,IAAQ,KAAK3C,KAAnB;IACA,MAAM,CAAC4C,KAAD,EAAQC,MAAR,IAAkB,KAAKnC,QAAL,EAAxB;IAIA,OAAO,KAAKG,IAAL,CAAUX,WAAV,CAAsB4C,QAAtB,CACLH,CADK,EAELC,KAAK,CAAC3B,WAAN,EAFK,EAGL4B,MAAM,CAAC5B,WAAP,EAHK,CAAP;EAKD;;AAhBmF"}
1
+ {"version":3,"names":["ColorFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","ColorFilter","addChild","child","Error","insertChildBefore","before","compose","filter","children","_children","length","Skia","MakeCompose","reduce","acc","materialize","MatrixColorFilterNode","NodeType","MatrixColorFilter","matrix","cf","MakeMatrix","BlendColorFilterNode","BlendColorFilter","mode","color","Color","MakeBlend","BlendMode","enumKey","LinearToSRGBGammaColorFilterNode","LinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","SRGBToLinearGammaColorFilterNode","SRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma","LumaColorFilterNode","LumaColorFilter","MakeLumaColorFilter","LerpColorFilterNode","LerpColorFilter","t","first","second","MakeLerp"],"sources":["ColorFilters.ts"],"sourcesContent":["import { BlendMode } from \"../../../skia/types\";\nimport type { SkColorFilter } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n BlendColorFilterProps,\n MatrixColorFilterProps,\n Node,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport type { LerpColorFilterProps } from \"../../types/ColorFilters\";\n\nexport abstract class ColorFilterDeclaration<\n P,\n Nullable extends null | never = never\n> extends JsiDeclarationNode<P, SkColorFilter, Nullable> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ColorFilter, type, props);\n }\n\n addChild(child: Node<unknown>) {\n if (!(child instanceof ColorFilterDeclaration)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof ColorFilterDeclaration)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n }\n\n compose(filter: SkColorFilter) {\n const children = this._children as ColorFilterDeclaration<unknown>[];\n if (this._children.length === 0) {\n return filter;\n } else {\n return this.Skia.ColorFilter.MakeCompose(\n filter,\n children.reduce<SkColorFilter | null>((acc, child) => {\n if (acc === null) {\n return child.materialize();\n }\n return this.Skia.ColorFilter.MakeCompose(acc, child.materialize());\n }, null) as SkColorFilter\n );\n }\n }\n}\n\nexport class MatrixColorFilterNode extends ColorFilterDeclaration<MatrixColorFilterProps> {\n constructor(ctx: NodeContext, props: MatrixColorFilterProps) {\n super(ctx, NodeType.MatrixColorFilter, props);\n }\n\n materialize() {\n const { matrix } = this.props;\n const cf = this.Skia.ColorFilter.MakeMatrix(matrix);\n return this.compose(cf);\n }\n}\n\nexport class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilterProps> {\n constructor(ctx: NodeContext, props: BlendColorFilterProps) {\n super(ctx, NodeType.BlendColorFilter, props);\n }\n\n materialize() {\n const { mode } = this.props;\n const color = this.Skia.Color(this.props.color);\n const cf = this.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n return this.compose(cf);\n }\n}\n\nexport class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LinearToSRGBGammaColorFilter, null);\n }\n\n materialize() {\n const cf = this.Skia.ColorFilter.MakeLinearToSRGBGamma();\n return this.compose(cf);\n }\n}\n\nexport class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SRGBToLinearGammaColorFilter, null);\n }\n\n materialize() {\n const cf = this.Skia.ColorFilter.MakeSRGBToLinearGamma();\n return this.compose(cf);\n }\n}\n\nexport class LumaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LumaColorFilter, null);\n }\n\n materialize() {\n const cf = this.Skia.ColorFilter.MakeLumaColorFilter();\n return this.compose(cf);\n }\n}\n\nexport class LerpColorFilterNode extends ColorFilterDeclaration<LerpColorFilterProps> {\n constructor(ctx: NodeContext, props: LerpColorFilterProps) {\n super(ctx, NodeType.LerpColorFilter, props);\n }\n\n materialize() {\n const { t } = this.props;\n const [first, second] = this.children() as JsiDeclarationNode<\n unknown,\n SkColorFilter\n >[];\n return this.Skia.ColorFilter.MakeLerp(\n t,\n first.materialize(),\n second.materialize()\n );\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAGA;;AAMA;;AACA;;AAGO,MAAeA,sBAAf,SAGGC,wBAHH,CAGkD;EACvDC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWG,uBAAA,CAAgBC,WAA3B,EAAwCH,IAAxC,EAA8CC,KAA9C;EACD;;EAEDG,QAAQ,CAACC,KAAD,EAAuB;IAC7B,IAAI,EAAEA,KAAK,YAAYT,sBAAnB,CAAJ,EAAgD;MAC9C,MAAM,IAAIU,KAAJ,CAAW,4BAA2BD,KAAK,CAACL,IAAK,OAAM,KAAKA,IAAK,EAAjE,CAAN;IACD;;IACD,MAAMI,QAAN,CAAeC,KAAf;EACD;;EAEDE,iBAAiB,CAACF,KAAD,EAAuBG,MAAvB,EAAoD;IACnE,IAAI,EAAEH,KAAK,YAAYT,sBAAnB,CAAJ,EAAgD;MAC9C,MAAM,IAAIU,KAAJ,CAAW,4BAA2BD,KAAK,CAACL,IAAK,OAAM,KAAKA,IAAK,EAAjE,CAAN;IACD;;IACD,MAAMO,iBAAN,CAAwBF,KAAxB,EAA+BG,MAA/B;EACD;;EAEDC,OAAO,CAACC,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D,MAAMF,GAAN,EAAWqB,gBAAA,CAASuB,eAApB,EAAqC1C,KAArC;EACD;;EAEDiB,WAAW,GAAG;IACZ,MAAM;MAAE0B;IAAF,IAAQ,KAAK3C,KAAnB;IACA,MAAM,CAAC4C,KAAD,EAAQC,MAAR,IAAkB,KAAKnC,QAAL,EAAxB;IAIA,OAAO,KAAKG,IAAL,CAAUX,WAAV,CAAsB4C,QAAtB,CACLH,CADK,EAELC,KAAK,CAAC3B,WAAN,EAFK,EAGL4B,MAAM,CAAC5B,WAAP,EAHK,CAAP;EAKD;;AAhBmF"}
@@ -134,7 +134,7 @@ class DropShadowImageFilterNode extends ImageFilterDeclaration {
134
134
  color: cl,
135
135
  inner
136
136
  } = this.props;
137
- const color = (0, _datatypes.processColor)(this.Skia, cl, 1);
137
+ const color = this.Skia.Color(cl);
138
138
  const input = this.getOptionalChildInstance(0);
139
139
  let factory;
140
140
 
@@ -1 +1 @@
1
- {"version":3,"names":["Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","BlendMode","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","TileMode","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","getOptionalChildInstance","index","child","_children","getMandatoryChildInstance","isImageFilter","materialize","isShader","MakeShader","declarationType","Error","OffsetImageFilterNode","NodeType","OffsetImageFilter","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","MakeDisplacementMap","ColorChannel","enumKey","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","processRadius","DropShadowImageFilterNode","cl","inner","processColor","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","processUniforms","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processRadius, enumKey, processColor } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nexport abstract class ImageFilterDeclaration<\n P,\n Nullable extends null | never = never\n> extends JsiDeclarationNode<P, SkImageFilter, Nullable> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n getOptionalChildInstance(index: number) {\n const child = this._children[index];\n if (!child) {\n return null;\n }\n return this.getMandatoryChildInstance(index);\n }\n\n getMandatoryChildInstance(index: number) {\n const child = this._children[index];\n if (child instanceof JsiDeclarationNode) {\n if (child.isImageFilter()) {\n return child.materialize();\n } else if (child.isShader()) {\n return this.Skia.ImageFilter.MakeShader(child.materialize(), null);\n } else if (child.declarationType === DeclarationType.ColorFilter) {\n return this.Skia.ImageFilter.MakeColorFilter(child.materialize(), null);\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n materialize() {\n const { x, y } = this.props;\n return this.Skia.ImageFilter.MakeOffset(\n x,\n y,\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n materialize() {\n const { channelX, channelY, scale } = this.props;\n return this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n this.getMandatoryChildInstance(0),\n this.getOptionalChildInstance(1)\n );\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n materialize() {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n return this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n materialize() {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = processColor(this.Skia, cl, 1);\n const input = this.getOptionalChildInstance(0);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n materialize() {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n const input = this.getOptionalChildInstance(0);\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n return this.Skia.ImageFilter.MakeErode(r.x, r.y, input);\n }\n return this.Skia.ImageFilter.MakeDilate(r.x, r.y, input);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n materialize() {\n const { mode } = this.props;\n const a = this.getMandatoryChildInstance(0);\n const b = this.getMandatoryChildInstance(1);\n return this.Skia.ImageFilter.MakeBlend(mode, a, b);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n materialize() {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const input = this.getOptionalChildInstance(0);\n return this.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input);\n }\n}\n"],"mappings":";;;;;;;AACA;;AAeA;;AACA;;AAEA;;AAEA,MAAMA,KAAK,GAAGC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CAAd;;AAEA,MAAMC,eAAe,GAAG,CACtBC,IADsB,EAEtBC,UAFsB,EAGtBC,EAHsB,EAItBC,EAJsB,EAKtBC,MALsB,EAMtBC,MANsB,EAOtBC,KAPsB,EAQtBC,KARsB,KASnB;EACH,MAAMC,aAAa,GAAGR,IAAI,CAACS,WAAL,CAAiBC,eAAjB,CACpBV,IAAI,CAACW,WAAL,CAAiBC,SAAjB,CAA2BhB,KAA3B,EAAkCiB,gBAAA,CAAUC,GAA5C,CADoB,EAEpB,IAFoB,CAAtB;EAIA,MAAMC,WAAW,GAAGf,IAAI,CAACS,WAAL,CAAiBC,eAAjB,CAClBV,IAAI,CAACW,WAAL,CAAiBC,SAAjB,CAA2BhB,KAA3B,EAAkCiB,gBAAA,CAAUG,KAA5C,CADkB,EAElB,IAFkB,CAApB;EAIA,MAAMC,EAAE,GAAGjB,IAAI,CAACS,WAAL,CAAiBC,eAAjB,CACTV,IAAI,CAACW,WAAL,CAAiBC,SAAjB,CAA2BN,KAA3B,EAAkCO,gBAAA,CAAUK,MAA5C,CADS,EAET,IAFS,CAAX;EAIA,MAAMC,EAAE,GAAGnB,IAAI,CAACS,WAAL,CAAiBW,UAAjB,CAA4BlB,EAA5B,EAAgCC,EAAhC,EAAoCc,EAApC,CAAX;EACA,MAAMI,EAAE,GAAGrB,IAAI,CAACS,WAAL,CAAiBa,QAAjB,CAA0BlB,MAA1B,EAA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C,EAAmDnF,KAAnD,CAAP;EACD;;AAbqG"}
1
+ {"version":3,"names":["Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","BlendMode","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","TileMode","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","getOptionalChildInstance","index","child","_children","getMandatoryChildInstance","isImageFilter","materialize","isShader","MakeShader","declarationType","Error","OffsetImageFilterNode","NodeType","OffsetImageFilter","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","MakeDisplacementMap","ColorChannel","enumKey","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","processRadius","DropShadowImageFilterNode","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","processUniforms","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processRadius, enumKey } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nexport abstract class ImageFilterDeclaration<\n P,\n Nullable extends null | never = never\n> extends JsiDeclarationNode<P, SkImageFilter, Nullable> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n getOptionalChildInstance(index: number) {\n const child = this._children[index];\n if (!child) {\n return null;\n }\n return this.getMandatoryChildInstance(index);\n }\n\n getMandatoryChildInstance(index: number) {\n const child = this._children[index];\n if (child instanceof JsiDeclarationNode) {\n if (child.isImageFilter()) {\n return child.materialize();\n } else if (child.isShader()) {\n return this.Skia.ImageFilter.MakeShader(child.materialize(), null);\n } else if (child.declarationType === DeclarationType.ColorFilter) {\n return this.Skia.ImageFilter.MakeColorFilter(child.materialize(), null);\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n materialize() {\n const { x, y } = this.props;\n return this.Skia.ImageFilter.MakeOffset(\n x,\n y,\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n materialize() {\n const { channelX, channelY, scale } = this.props;\n return this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n this.getMandatoryChildInstance(0),\n this.getOptionalChildInstance(1)\n );\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n materialize() {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n return this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n materialize() {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\n const input = this.getOptionalChildInstance(0);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n materialize() {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n const input = this.getOptionalChildInstance(0);\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n return this.Skia.ImageFilter.MakeErode(r.x, r.y, input);\n }\n return this.Skia.ImageFilter.MakeDilate(r.x, r.y, input);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n materialize() {\n const { mode } = this.props;\n const a = this.getMandatoryChildInstance(0);\n const b = this.getMandatoryChildInstance(1);\n return this.Skia.ImageFilter.MakeBlend(mode, a, b);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n materialize() {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const input = this.getOptionalChildInstance(0);\n return this.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input);\n }\n}\n"],"mappings":";;;;;;;AACA;;AAeA;;AACA;;AAEA;;AAEA,MAAMA,KAAK,GAAGC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CAAd;;AAEA,MAAMC,eAAe,GAAG,CACtBC,IADsB,EAEtBC,UAFsB,EAGtBC,EAHsB,EAItBC,EAJsB,EAKtBC,MALsB,EAMtBC,MANsB,EAOtBC,KAPsB,EAQtBC,KARsB,KASnB;EACH,MAAMC,aAAa,GAAGR,IA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AAsBG,SAAtB,CAAgCiD,IAAhC,EAAsCuB,CAAtC,EAAyCC,CAAzC,CAAP;EACD;;AAVqF;;;;AAajF,MAAMC,4BAAN,SAA2C1D,sBAA3C,CAAiG;EACtGE,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAyD;IAClE,MAAMF,GAAN,EAAWgB,gBAAA,CAASwC,wBAApB,EAA8CtD,KAA9C;EACD;;EAEDQ,WAAW,GAAG;IACZ,MAAM;MAAE+C,MAAF;MAAUC;IAAV,IAAuB,KAAKxD,KAAlC;IACA,MAAMyD,GAAG,GAAG,KAAK1F,IAAL,CAAU2F,oBAAV,CAA+BH,MAA/B,CAAZ;;IACA,IAAIC,QAAJ,EAAc;MACZ,IAAAG,sBAAA,EAAgBJ,MAAhB,EAAwBC,QAAxB,EAAkCC,GAAlC;IACD;;IACD,MAAMnF,KAAK,GAAG,KAAK4B,wBAAL,CAA8B,CAA9B,CAAd;IACA,OAAO,KAAKnC,IAAL,CAAUS,WAAV,CAAsBoF,iBAAtB,CAAwCH,GAAxC,EAA6C,IAA7C,EAAmDnF,KAAnD,CAAP;EACD;;AAbqG"}
@@ -11,8 +11,6 @@ var _Node = require("../Node");
11
11
 
12
12
  var _types2 = require("../../types");
13
13
 
14
- var _Color = require("../datatypes/Color");
15
-
16
14
  var _datatypes = require("../datatypes");
17
15
 
18
16
  class ShaderDeclaration extends _Node.JsiDeclarationNode {
@@ -90,7 +88,7 @@ class ColorNode extends ShaderDeclaration {
90
88
  const {
91
89
  color
92
90
  } = this.props;
93
- return this.Skia.Shader.MakeColor((0, _Color.processColor)(this.Skia, color, 1));
91
+ return this.Skia.Shader.MakeColor(this.Skia.Color(color));
94
92
  }
95
93
 
96
94
  }
@@ -1 +1 @@
1
- {"version":3,"names":["ShaderDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","Shader","ShaderNode","NodeType","materialize","source","uniforms","transform","m3","Skia","Matrix","processTransformProps","makeShaderWithChildren","processUniforms","children","filter","child","isShader","map","ImageShaderNode","ImageShader","fit","image","tx","ty","fm","mm","imageShaderProps","rct","getRect","rects","fitRects","x","y","width","height","rect2rect","src","dst","lm","makeShaderOptions","TileMode","enumKey","FilterMode","MipmapMode","ColorNode","ColorShader","color","MakeColor","processColor","TurbulenceNode","Turbulence","freqX","freqY","octaves","seed","tileWidth","tileHeight","MakeTurbulence","FractalNoiseNode","FractalNoise","MakeFractalNoise","LinearGradientNode","LinearGradient","start","end","colors","positions","mode","localMatrix","flags","processGradientProps","MakeLinearGradient","RadialGradientNode","RadialGradient","c","r","MakeRadialGradient","SweepGradientNode","SweepGradient","MakeSweepGradient","TwoPointConicalGradientNode","TwoPointConicalGradient","startR","endR","MakeTwoPointConicalGradient"],"sources":["Shaders.ts"],"sourcesContent":["import {\n processUniforms,\n FilterMode,\n MipmapMode,\n TileMode,\n} from \"../../../skia/types\";\nimport type { SkShader } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n ColorProps,\n FractalNoiseProps,\n ImageShaderProps,\n LinearGradientProps,\n RadialGradientProps,\n ShaderProps,\n SweepGradientProps,\n TurbulenceProps,\n TwoPointConicalGradientProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processColor } from \"../datatypes/Color\";\nimport {\n enumKey,\n fitRects,\n getRect,\n processGradientProps,\n processTransformProps,\n rect2rect,\n} from \"../datatypes\";\n\nexport abstract class ShaderDeclaration<P> extends JsiDeclarationNode<\n P,\n SkShader\n> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.Shader, type, props);\n }\n}\n\nexport class ShaderNode extends ShaderDeclaration<ShaderProps> {\n constructor(ctx: NodeContext, props: ShaderProps) {\n super(ctx, NodeType.Shader, props);\n }\n\n materialize() {\n const { source, uniforms, ...transform } = this.props;\n const m3 = this.Skia.Matrix();\n processTransformProps(m3, transform);\n return source.makeShaderWithChildren(\n processUniforms(source, uniforms),\n this.children()\n .filter(\n (child): child is JsiDeclarationNode<unknown, SkShader> =>\n child instanceof JsiDeclarationNode && child.isShader()\n )\n .map((child) => child.materialize()),\n m3\n );\n }\n}\n\nexport class ImageShaderNode extends ShaderDeclaration<ImageShaderProps> {\n constructor(ctx: NodeContext, props: ImageShaderProps) {\n super(ctx, NodeType.ImageShader, props);\n }\n\n materialize() {\n const { fit, image, tx, ty, fm, mm, ...imageShaderProps } = this.props;\n const rct = getRect(this.Skia, imageShaderProps);\n if (rct) {\n const rects = fitRects(\n fit,\n { x: 0, y: 0, width: image.width(), height: image.height() },\n rct\n );\n const m3 = rect2rect(rects.src, rects.dst);\n imageShaderProps.transform = [\n ...(imageShaderProps.transform ?? []),\n ...m3,\n ];\n }\n const lm = this.Skia.Matrix();\n processTransformProps(lm, imageShaderProps);\n return image.makeShaderOptions(\n TileMode[enumKey(tx)],\n TileMode[enumKey(ty)],\n FilterMode[enumKey(fm)],\n MipmapMode[enumKey(mm)],\n lm\n );\n }\n}\n\nexport class ColorNode extends ShaderDeclaration<ColorProps> {\n constructor(ctx: NodeContext, props: ColorProps) {\n super(ctx, NodeType.ColorShader, props);\n }\n\n materialize() {\n const { color } = this.props;\n return this.Skia.Shader.MakeColor(processColor(this.Skia, color, 1));\n }\n}\n\nexport class TurbulenceNode extends ShaderDeclaration<TurbulenceProps> {\n constructor(ctx: NodeContext, props: TurbulenceProps) {\n super(ctx, NodeType.Turbulence, props);\n }\n\n materialize() {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n return this.Skia.Shader.MakeTurbulence(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n }\n}\n\nexport class FractalNoiseNode extends ShaderDeclaration<FractalNoiseProps> {\n constructor(ctx: NodeContext, props: FractalNoiseProps) {\n super(ctx, NodeType.FractalNoise, props);\n }\n\n materialize() {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n return this.Skia.Shader.MakeFractalNoise(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n }\n}\n\nexport class LinearGradientNode extends ShaderDeclaration<LinearGradientProps> {\n constructor(ctx: NodeContext, props: LinearGradientProps) {\n super(ctx, NodeType.LinearGradient, props);\n }\n\n materialize() {\n const { start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeLinearGradient(\n start,\n end,\n colors,\n positions ?? null,\n mode,\n localMatrix,\n flags\n );\n }\n}\n\nexport class RadialGradientNode extends ShaderDeclaration<RadialGradientProps> {\n constructor(ctx: NodeContext, props: RadialGradientProps) {\n super(ctx, NodeType.RadialGradient, props);\n }\n\n materialize() {\n const { c, r } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeRadialGradient(\n c,\n r,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n }\n}\n\nexport class SweepGradientNode extends ShaderDeclaration<SweepGradientProps> {\n constructor(ctx: NodeContext, props: SweepGradientProps) {\n super(ctx, NodeType.SweepGradient, props);\n }\n\n materialize() {\n const { c, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeSweepGradient(\n c.x,\n c.y,\n colors,\n positions,\n mode,\n localMatrix,\n flags,\n start,\n end\n );\n }\n}\n\nexport class TwoPointConicalGradientNode extends ShaderDeclaration<TwoPointConicalGradientProps> {\n constructor(ctx: NodeContext, props: TwoPointConicalGradientProps) {\n super(ctx, NodeType.TwoPointConicalGradient, props);\n }\n\n materialize() {\n const { startR, endR, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeTwoPointConicalGradient(\n start,\n startR,\n end,\n endR,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAQA;;AAYA;;AACA;;AACA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AF;MAAUC,SAAV;MAAqBC,IAArB;MAA2BC,WAA3B;MAAwCC;IAAxC,IACJ,IAAAC,+BAAA,EAAqB,KAAK9D,IAA1B,EAAgC,KAAKV,KAArC,CADF;IAEA,OAAO,KAAKU,IAAL,CAAUR,MAAV,CAAiB+E,iBAAjB,CACLL,CAAC,CAAC3C,CADG,EAEL2C,CAAC,CAAC1C,CAFG,EAGLiC,MAHK,EAILC,SAJK,EAKLC,IALK,EAMLC,WANK,EAOLC,KAPK,EAQLN,KARK,EASLC,GATK,CAAP;EAWD;;AApB0E;;;;AAuBtE,MAAMgB,2BAAN,SAA0CvF,iBAA1C,CAA0F;EAC/FE,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAwD;IACjE,MAAMF,GAAN,EAAWM,gBAAA,CAAS+E,uBAApB,EAA6CnF,KAA7C;EACD;;EAEDK,WAAW,GAAG;IACZ,MAAM;MAAE+E,MAAF;MAAUC,IAAV;MAAgBpB,KAAhB;MAAuBC;IAAvB,IAA+B,KAAKlE,KAA1C;IACA,MAAM;MAAEmE,MAAF;MAAUC,SAAV;MAAqBC,IAArB;MAA2BC,WAA3B;MAAwCC;IAAxC,IACJ,IAAAC,+BAAA,EAAqB,KAAK9D,IAA1B,EAAgC,KAAKV,KAArC,CADF;IAEA,OAAO,KAAKU,IAAL,CAAUR,MAAV,CAAiBoF,2BAAjB,CACLrB,KADK,EAELmB,MAFK,EAGLlB,GAHK,EAILmB,IAJK,EAKLlB,MALK,EAMLC,SANK,EAOLC,IAPK,EAQLC,WARK,EASLC,KATK,CAAP;EAWD;;AApB8F"}
1
+ {"version":3,"names":["ShaderDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","Shader","ShaderNode","NodeType","materialize","source","uniforms","transform","m3","Skia","Matrix","processTransformProps","makeShaderWithChildren","processUniforms","children","filter","child","isShader","map","ImageShaderNode","ImageShader","fit","image","tx","ty","fm","mm","imageShaderProps","rct","getRect","rects","fitRects","x","y","width","height","rect2rect","src","dst","lm","makeShaderOptions","TileMode","enumKey","FilterMode","MipmapMode","ColorNode","ColorShader","color","MakeColor","Color","TurbulenceNode","Turbulence","freqX","freqY","octaves","seed","tileWidth","tileHeight","MakeTurbulence","FractalNoiseNode","FractalNoise","MakeFractalNoise","LinearGradientNode","LinearGradient","start","end","colors","positions","mode","localMatrix","flags","processGradientProps","MakeLinearGradient","RadialGradientNode","RadialGradient","c","r","MakeRadialGradient","SweepGradientNode","SweepGradient","MakeSweepGradient","TwoPointConicalGradientNode","TwoPointConicalGradient","startR","endR","MakeTwoPointConicalGradient"],"sources":["Shaders.ts"],"sourcesContent":["import {\n processUniforms,\n FilterMode,\n MipmapMode,\n TileMode,\n} from \"../../../skia/types\";\nimport type { SkShader } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n ColorProps,\n FractalNoiseProps,\n ImageShaderProps,\n LinearGradientProps,\n RadialGradientProps,\n ShaderProps,\n SweepGradientProps,\n TurbulenceProps,\n TwoPointConicalGradientProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport {\n enumKey,\n fitRects,\n getRect,\n processGradientProps,\n processTransformProps,\n rect2rect,\n} from \"../datatypes\";\n\nexport abstract class ShaderDeclaration<P> extends JsiDeclarationNode<\n P,\n SkShader\n> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.Shader, type, props);\n }\n}\n\nexport class ShaderNode extends ShaderDeclaration<ShaderProps> {\n constructor(ctx: NodeContext, props: ShaderProps) {\n super(ctx, NodeType.Shader, props);\n }\n\n materialize() {\n const { source, uniforms, ...transform } = this.props;\n const m3 = this.Skia.Matrix();\n processTransformProps(m3, transform);\n return source.makeShaderWithChildren(\n processUniforms(source, uniforms),\n this.children()\n .filter(\n (child): child is JsiDeclarationNode<unknown, SkShader> =>\n child instanceof JsiDeclarationNode && child.isShader()\n )\n .map((child) => child.materialize()),\n m3\n );\n }\n}\n\nexport class ImageShaderNode extends ShaderDeclaration<ImageShaderProps> {\n constructor(ctx: NodeContext, props: ImageShaderProps) {\n super(ctx, NodeType.ImageShader, props);\n }\n\n materialize() {\n const { fit, image, tx, ty, fm, mm, ...imageShaderProps } = this.props;\n const rct = getRect(this.Skia, imageShaderProps);\n if (rct) {\n const rects = fitRects(\n fit,\n { x: 0, y: 0, width: image.width(), height: image.height() },\n rct\n );\n const m3 = rect2rect(rects.src, rects.dst);\n imageShaderProps.transform = [\n ...(imageShaderProps.transform ?? []),\n ...m3,\n ];\n }\n const lm = this.Skia.Matrix();\n processTransformProps(lm, imageShaderProps);\n return image.makeShaderOptions(\n TileMode[enumKey(tx)],\n TileMode[enumKey(ty)],\n FilterMode[enumKey(fm)],\n MipmapMode[enumKey(mm)],\n lm\n );\n }\n}\n\nexport class ColorNode extends ShaderDeclaration<ColorProps> {\n constructor(ctx: NodeContext, props: ColorProps) {\n super(ctx, NodeType.ColorShader, props);\n }\n\n materialize() {\n const { color } = this.props;\n return this.Skia.Shader.MakeColor(this.Skia.Color(color));\n }\n}\n\nexport class TurbulenceNode extends ShaderDeclaration<TurbulenceProps> {\n constructor(ctx: NodeContext, props: TurbulenceProps) {\n super(ctx, NodeType.Turbulence, props);\n }\n\n materialize() {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n return this.Skia.Shader.MakeTurbulence(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n }\n}\n\nexport class FractalNoiseNode extends ShaderDeclaration<FractalNoiseProps> {\n constructor(ctx: NodeContext, props: FractalNoiseProps) {\n super(ctx, NodeType.FractalNoise, props);\n }\n\n materialize() {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n return this.Skia.Shader.MakeFractalNoise(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n }\n}\n\nexport class LinearGradientNode extends ShaderDeclaration<LinearGradientProps> {\n constructor(ctx: NodeContext, props: LinearGradientProps) {\n super(ctx, NodeType.LinearGradient, props);\n }\n\n materialize() {\n const { start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeLinearGradient(\n start,\n end,\n colors,\n positions ?? null,\n mode,\n localMatrix,\n flags\n );\n }\n}\n\nexport class RadialGradientNode extends ShaderDeclaration<RadialGradientProps> {\n constructor(ctx: NodeContext, props: RadialGradientProps) {\n super(ctx, NodeType.RadialGradient, props);\n }\n\n materialize() {\n const { c, r } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeRadialGradient(\n c,\n r,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n }\n}\n\nexport class SweepGradientNode extends ShaderDeclaration<SweepGradientProps> {\n constructor(ctx: NodeContext, props: SweepGradientProps) {\n super(ctx, NodeType.SweepGradient, props);\n }\n\n materialize() {\n const { c, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeSweepGradient(\n c.x,\n c.y,\n colors,\n positions,\n mode,\n localMatrix,\n flags,\n start,\n end\n );\n }\n}\n\nexport class TwoPointConicalGradientNode extends ShaderDeclaration<TwoPointConicalGradientProps> {\n constructor(ctx: NodeContext, props: TwoPointConicalGradientProps) {\n super(ctx, NodeType.TwoPointConicalGradient, props);\n }\n\n materialize() {\n const { startR, endR, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeTwoPointConicalGradient(\n start,\n startR,\n end,\n endR,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAQA;;AAYA;;AACA;;AASO,MAAeA,iBAAf,SAA4CC,wBAA5C,CAGL;EACAC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAA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AL,CAAUR,MAAV,CAAiB+E,iBAAjB,CACLL,CAAC,CAAC3C,CADG,EAEL2C,CAAC,CAAC1C,CAFG,EAGLiC,MAHK,EAILC,SAJK,EAKLC,IALK,EAMLC,WANK,EAOLC,KAPK,EAQLN,KARK,EASLC,GATK,CAAP;EAWD;;AApB0E;;;;AAuBtE,MAAMgB,2BAAN,SAA0CvF,iBAA1C,CAA0F;EAC/FE,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAwD;IACjE,MAAMF,GAAN,EAAWM,gBAAA,CAAS+E,uBAApB,EAA6CnF,KAA7C;EACD;;EAEDK,WAAW,GAAG;IACZ,MAAM;MAAE+E,MAAF;MAAUC,IAAV;MAAgBpB,KAAhB;MAAuBC;IAAvB,IAA+B,KAAKlE,KAA1C;IACA,MAAM;MAAEmE,MAAF;MAAUC,SAAV;MAAqBC,IAArB;MAA2BC,WAA3B;MAAwCC;IAAxC,IACJ,IAAAC,+BAAA,EAAqB,KAAK9D,IAA1B,EAAgC,KAAKV,KAArC,CADF;IAEA,OAAO,KAAKU,IAAL,CAAUR,MAAV,CAAiBoF,2BAAjB,CACLrB,KADK,EAELmB,MAFK,EAGLlB,GAHK,EAILmB,IAJK,EAKLlB,MALK,EAMLC,SANK,EAOLC,IAPK,EAQLC,WARK,EASLC,KATK,CAAP;EAWD;;AApB8F"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["DrawingContext.ts"],"sourcesContent":["import type { SkCanvas, SkPaint } from \"../../skia/types\";\n\nexport interface DrawingContext {\n canvas: SkCanvas;\n paint: SkPaint;\n opacity: number;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["DrawingContext.ts"],"sourcesContent":["import type { SkCanvas, SkPaint } from \"../../skia/types\";\n\nexport interface DrawingContext {\n canvas: SkCanvas;\n paint: SkPaint;\n}\n"],"mappings":""}
@@ -9,8 +9,6 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactReconciler = _interopRequireDefault(require("react-reconciler"));
11
11
 
12
- var _reactNative = require("react-native");
13
-
14
12
  var _views = require("../views");
15
13
 
16
14
  var _Skia = require("../skia/Skia");
@@ -21,8 +19,6 @@ var _Container = require("./Container");
21
19
 
22
20
  var _DependencyManager = require("./DependencyManager");
23
21
 
24
- var _useCanvas = require("./useCanvas");
25
-
26
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
23
 
28
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -64,11 +60,10 @@ const Canvas = /*#__PURE__*/(0, _react.forwardRef)((_ref, forwardedRef) => {
64
60
  } = _ref;
65
61
  const innerRef = useCanvasRef();
66
62
  const ref = useCombinedRefs(forwardedRef, innerRef);
67
- const [, setTick] = (0, _react.useState)(0);
68
63
  const redraw = (0, _react.useCallback)(() => {
69
64
  var _innerRef$current;
70
65
 
71
- _reactNative.Platform.OS === "web" ? setTick(tick => tick + 1) : (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.redraw();
66
+ (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.redraw();
72
67
  }, [innerRef]);
73
68
  const registerValues = (0, _react.useCallback)(values => {
74
69
  if (ref.current === null) {
@@ -83,11 +78,7 @@ const Canvas = /*#__PURE__*/(0, _react.forwardRef)((_ref, forwardedRef) => {
83
78
  const root = (0, _react.useMemo)(() => skiaReconciler.createContainer(container, 0, null, true, null, "", console.error, null), [container]); // Render effect
84
79
 
85
80
  (0, _react.useEffect)(() => {
86
- render( /*#__PURE__*/_react.default.createElement(_useCanvas.CanvasProvider, {
87
- value: {
88
- Skia: _Skia.Skia
89
- }
90
- }, children), root, container);
81
+ render(children, root, container);
91
82
  }, [children, root, redraw, container]);
92
83
  (0, _react.useEffect)(() => {
93
84
  return () => {