@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.
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +2 -0
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +2 -2
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +5 -5
- package/cpp/api/JsiSkCanvas.h +8 -8
- package/cpp/api/JsiSkColor.h +1 -1
- package/cpp/api/JsiSkColorFilter.h +1 -1
- package/cpp/api/JsiSkColorFilterFactory.h +2 -2
- package/cpp/api/JsiSkContourMeasure.h +1 -1
- package/cpp/api/JsiSkContourMeasureIter.h +2 -2
- package/cpp/api/JsiSkData.h +2 -2
- package/cpp/api/JsiSkDataFactory.h +1 -1
- package/cpp/api/JsiSkFont.h +2 -2
- package/cpp/api/JsiSkImage.h +3 -3
- package/cpp/api/JsiSkImageFilter.h +1 -1
- package/cpp/api/JsiSkImageFilterFactory.h +1 -1
- package/cpp/api/JsiSkImageInfo.h +1 -1
- package/cpp/api/JsiSkMaskFilter.h +1 -1
- package/cpp/api/JsiSkMaskFilterFactory.h +1 -1
- package/cpp/api/JsiSkMatrix.h +1 -1
- package/cpp/api/JsiSkPaint.h +7 -1
- package/cpp/api/JsiSkPath.h +15 -15
- package/cpp/api/JsiSkPathEffect.h +1 -1
- package/cpp/api/JsiSkPathEffectFactory.h +4 -4
- package/cpp/api/JsiSkPathFactory.h +2 -2
- package/cpp/api/JsiSkPicture.h +1 -1
- package/cpp/api/JsiSkPictureFactory.h +2 -2
- package/cpp/api/JsiSkPictureRecorder.h +2 -2
- package/cpp/api/JsiSkPoint.h +1 -1
- package/cpp/api/JsiSkRRect.h +1 -1
- package/cpp/api/JsiSkRSXform.h +1 -1
- package/cpp/api/JsiSkRect.h +1 -1
- package/cpp/api/JsiSkRuntimeEffect.h +1 -1
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +1 -1
- package/cpp/api/JsiSkSVGFactory.h +1 -1
- package/cpp/api/JsiSkShader.h +2 -2
- package/cpp/api/JsiSkShaderFactory.h +3 -3
- package/cpp/api/JsiSkSurface.h +1 -1
- package/cpp/api/JsiSkSurfaceFactory.h +2 -2
- package/cpp/api/JsiSkTextBlob.h +1 -1
- package/cpp/api/JsiSkTextBlobFactory.h +1 -1
- package/cpp/api/JsiSkTypeface.h +2 -2
- package/cpp/api/JsiSkVertices.h +1 -1
- package/cpp/jsi/JsiHostObject.h +25 -25
- package/cpp/rnskia/RNSkJsView.h +3 -3
- package/cpp/rnskia/RNSkPictureView.h +3 -3
- package/cpp/rnskia/RNSkPlatformContext.h +5 -3
- package/cpp/rnskia/RNSkView.h +2 -2
- package/cpp/rnskia/dom/base/DrawingContext.cpp +24 -9
- package/cpp/rnskia/dom/base/DrawingContext.h +3 -2
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +12 -2
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +4 -4
- package/cpp/rnskia/dom/base/JsiDomNode.h +68 -10
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +26 -61
- package/cpp/rnskia/dom/base/NodeProp.h +2 -1
- package/cpp/rnskia/dom/base/NodePropsContainer.h +10 -0
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +7 -9
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +3 -6
- package/cpp/rnskia/dom/nodes/JsiBoxNode.h +2 -4
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiCircleNode.h +2 -3
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +4 -8
- package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +2 -7
- package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +4 -8
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +19 -37
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +2 -4
- package/cpp/rnskia/dom/nodes/JsiLineNode.h +2 -7
- package/cpp/rnskia/dom/nodes/JsiOvalNode.h +1 -3
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +2 -3
- package/cpp/rnskia/dom/nodes/JsiPatchNode.h +4 -8
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +14 -28
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +16 -24
- package/cpp/rnskia/dom/nodes/JsiPictureNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiPointsNode.h +2 -5
- package/cpp/rnskia/dom/nodes/JsiRRectNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiRectNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +37 -69
- package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +3 -6
- package/cpp/rnskia/dom/nodes/JsiTextNode.h +4 -8
- package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +1 -2
- package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +2 -4
- package/cpp/rnskia/dom/props/BlendModeProp.h +2 -2
- package/cpp/rnskia/dom/props/PaintProps.h +3 -0
- package/cpp/rnskia/dom/props/TransformProp.h +0 -2
- package/cpp/utils/RNSkLog.h +1 -1
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +8 -7
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -1
- package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +4 -4
- package/ios/RNSkia-iOS/SkiaManager.mm +5 -5
- package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +3 -3
- package/ios/RNSkia-iOS/SkiaUIView.mm +10 -10
- package/lib/commonjs/dom/nodes/RenderNode.js +12 -16
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/datatypes/index.js +0 -13
- package/lib/commonjs/dom/nodes/datatypes/index.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js +6 -6
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/PatchNode.js +3 -7
- package/lib/commonjs/dom/nodes/drawings/PatchNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/VerticesNode.js +1 -1
- package/lib/commonjs/dom/nodes/drawings/VerticesNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js +1 -3
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/Shaders.js +1 -3
- package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +2 -11
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Container.js +2 -1
- package/lib/commonjs/renderer/Container.js.map +1 -1
- package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
- package/lib/commonjs/renderer/components/Mask.js +11 -25
- package/lib/commonjs/renderer/components/Mask.js.map +1 -1
- package/lib/commonjs/renderer/index.js +0 -13
- package/lib/commonjs/renderer/index.js.map +1 -1
- package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +4 -0
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/web/LoadSkiaWeb.js +1 -1
- package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.js +12 -16
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/index.js +0 -1
- package/lib/module/dom/nodes/datatypes/index.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Box.js +6 -5
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/module/dom/nodes/drawings/PatchNode.js +4 -8
- package/lib/module/dom/nodes/drawings/PatchNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/VerticesNode.js +2 -2
- package/lib/module/dom/nodes/drawings/VerticesNode.js.map +1 -1
- package/lib/module/dom/nodes/paint/ColorFilters.js +1 -2
- package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/ImageFilters.js +2 -2
- package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/Shaders.js +1 -2
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/module/dom/types/DrawingContext.js.map +1 -1
- package/lib/module/renderer/Canvas.js +3 -10
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Container.js +2 -1
- package/lib/module/renderer/Container.js.map +1 -1
- package/lib/module/renderer/DrawingContext.js.map +1 -1
- package/lib/module/renderer/components/Mask.js +9 -21
- package/lib/module/renderer/components/Mask.js.map +1 -1
- package/lib/module/renderer/index.js +0 -1
- package/lib/module/renderer/index.js.map +1 -1
- package/lib/module/skia/types/Paint/Paint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +4 -0
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/web/LoadSkiaWeb.js +1 -1
- package/lib/module/web/LoadSkiaWeb.js.map +1 -1
- package/lib/typescript/src/dom/nodes/datatypes/index.d.ts +0 -1
- package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/drawings/PatchNode.d.ts +1 -1
- package/lib/typescript/src/dom/types/DrawingContext.d.ts +0 -1
- package/lib/typescript/src/renderer/Container.d.ts +1 -1
- package/lib/typescript/src/renderer/DrawingContext.d.ts +3 -5
- package/lib/typescript/src/renderer/index.d.ts +0 -1
- package/lib/typescript/src/skia/types/Paint/Paint.d.ts +4 -0
- package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
- package/package.json +1 -1
- package/src/dom/nodes/RenderNode.ts +11 -21
- package/src/dom/nodes/datatypes/index.ts +0 -1
- package/src/dom/nodes/drawings/Box.ts +7 -4
- package/src/dom/nodes/drawings/PatchNode.ts +4 -18
- package/src/dom/nodes/drawings/VerticesNode.ts +2 -2
- package/src/dom/nodes/paint/ColorFilters.ts +1 -2
- package/src/dom/nodes/paint/ImageFilters.ts +2 -2
- package/src/dom/nodes/paint/Shaders.ts +1 -2
- package/src/dom/types/DrawingContext.ts +0 -1
- package/src/renderer/Canvas.tsx +2 -12
- package/src/renderer/Container.tsx +1 -1
- package/src/renderer/DrawingContext.ts +5 -5
- package/src/renderer/components/Mask.tsx +11 -20
- package/src/renderer/index.ts +0 -1
- package/src/skia/types/Paint/Paint.ts +5 -0
- package/src/skia/web/JsiSkPaint.ts +4 -0
- package/src/web/LoadSkiaWeb.tsx +1 -1
- package/lib/commonjs/dom/nodes/datatypes/Color.js +0 -27
- package/lib/commonjs/dom/nodes/datatypes/Color.js.map +0 -1
- package/lib/commonjs/renderer/useCanvas.js +0 -32
- package/lib/commonjs/renderer/useCanvas.js.map +0 -1
- package/lib/module/dom/nodes/datatypes/Color.js +0 -11
- package/lib/module/dom/nodes/datatypes/Color.js.map +0 -1
- package/lib/module/renderer/useCanvas.js +0 -15
- package/lib/module/renderer/useCanvas.js.map +0 -1
- package/lib/typescript/src/dom/nodes/datatypes/Color.d.ts +0 -7
- package/lib/typescript/src/renderer/useCanvas.d.ts +0 -9
- package/src/dom/nodes/datatypes/Color.ts +0 -15
- package/src/renderer/useCanvas.ts +0 -21
@@ -6,7 +6,7 @@ export declare class Container {
|
|
6
6
|
redraw: () => void;
|
7
7
|
private _root;
|
8
8
|
Sk: SkDOM;
|
9
|
-
constructor(Skia: Skia, depMgr: DependencyManager, redraw
|
9
|
+
constructor(Skia: Skia, depMgr: DependencyManager, redraw?: () => void);
|
10
10
|
draw(ctx: DrawingContext): void;
|
11
11
|
get root(): RenderNode<GroupProps>;
|
12
12
|
}
|
@@ -1,10 +1,8 @@
|
|
1
1
|
import type { RefObject } from "react";
|
2
2
|
import type { DrawingInfo, SkiaView } from "../views";
|
3
|
-
import type {
|
4
|
-
|
5
|
-
|
6
|
-
paint: SkPaint;
|
7
|
-
opacity: number;
|
3
|
+
import type { Skia, Vector } from "../skia/types";
|
4
|
+
import type { DrawingContext as DOMDrawingContext } from "../dom/types";
|
5
|
+
export interface DrawingContext extends Omit<DrawingInfo, "touches">, DOMDrawingContext {
|
8
6
|
center: Vector;
|
9
7
|
ref: RefObject<SkiaView>;
|
10
8
|
Skia: Skia;
|
@@ -22,6 +22,10 @@ export declare enum StrokeJoin {
|
|
22
22
|
}
|
23
23
|
export declare const isPaint: (obj: SkJSIInstance<string> | null) => obj is SkPaint;
|
24
24
|
export interface SkPaint extends SkJSIInstance<"Paint"> {
|
25
|
+
/**
|
26
|
+
* Retrieves alpha from the color used when stroking and filling.
|
27
|
+
*/
|
28
|
+
getAlphaf(): number;
|
25
29
|
/**
|
26
30
|
* Returns a copy of this paint.
|
27
31
|
*/
|
@@ -5,6 +5,7 @@ export declare class JsiSkPaint extends HostObject<Paint, "Paint"> implements Sk
|
|
5
5
|
constructor(CanvasKit: CanvasKit, ref: Paint);
|
6
6
|
copy(): JsiSkPaint;
|
7
7
|
reset(): void;
|
8
|
+
getAlphaf(): number;
|
8
9
|
getColor(): Float32Array;
|
9
10
|
getStrokeCap(): number;
|
10
11
|
getStrokeJoin(): number;
|
package/package.json
CHANGED
@@ -141,7 +141,7 @@ export abstract class JsiRenderNode<P extends GroupProps>
|
|
141
141
|
opacity !== undefined ||
|
142
142
|
antiAlias !== undefined
|
143
143
|
) {
|
144
|
-
ctx = {};
|
144
|
+
ctx = { opacity: 1 };
|
145
145
|
if (color !== undefined) {
|
146
146
|
ctx.color = this.Skia.Color(color);
|
147
147
|
}
|
@@ -208,24 +208,19 @@ export abstract class JsiRenderNode<P extends GroupProps>
|
|
208
208
|
const { invertClip, layer, matrix, transform } = this.props;
|
209
209
|
const { canvas } = parentCtx;
|
210
210
|
|
211
|
-
const opacity =
|
212
|
-
this.props.opacity !== undefined
|
213
|
-
? parentCtx.opacity * this.props.opacity
|
214
|
-
: parentCtx.opacity;
|
215
|
-
|
216
211
|
if (
|
217
212
|
this.paintCache === null ||
|
218
213
|
this.paintCache.parent !== parentCtx.paint
|
219
214
|
) {
|
220
215
|
const paintCtx = this.getPaintCtx();
|
221
216
|
const child = paintCtx
|
222
|
-
? concatPaint(parentCtx.paint, paintCtx
|
217
|
+
? concatPaint(parentCtx.paint.copy(), paintCtx)
|
223
218
|
: parentCtx.paint;
|
224
219
|
this.paintCache = { parent: parentCtx.paint, child };
|
225
220
|
}
|
226
221
|
const paint = this.paintCache.child;
|
227
222
|
// TODO: can we only recreate a new context here if needed?
|
228
|
-
const ctx = { ...parentCtx,
|
223
|
+
const ctx = { ...parentCtx, paint };
|
229
224
|
const hasTransform = matrix !== undefined || transform !== undefined;
|
230
225
|
const hasClip =
|
231
226
|
this.clipRect !== undefined ||
|
@@ -267,7 +262,7 @@ export abstract class JsiRenderNode<P extends GroupProps>
|
|
267
262
|
}
|
268
263
|
|
269
264
|
const concatPaint = (
|
270
|
-
|
265
|
+
paint: SkPaint,
|
271
266
|
{
|
272
267
|
color,
|
273
268
|
strokeWidth,
|
@@ -278,23 +273,21 @@ const concatPaint = (
|
|
278
273
|
imageFilter,
|
279
274
|
maskFilter,
|
280
275
|
pathEffect,
|
281
|
-
opacity
|
276
|
+
opacity,
|
282
277
|
strokeCap,
|
283
278
|
strokeJoin,
|
284
279
|
strokeMiter,
|
285
280
|
style,
|
286
|
-
}: PaintContext
|
287
|
-
opacity: number
|
281
|
+
}: PaintContext
|
288
282
|
) => {
|
289
|
-
|
283
|
+
if (opacity !== undefined) {
|
284
|
+
paint.setAlphaf(paint.getAlphaf() * opacity);
|
285
|
+
}
|
290
286
|
if (color !== undefined) {
|
287
|
+
const currentOpacity = paint.getAlphaf();
|
291
288
|
paint.setShader(null);
|
292
|
-
color[3] *= opacity;
|
293
289
|
paint.setColor(color);
|
294
|
-
|
295
|
-
const cl = paint.getColor();
|
296
|
-
cl[3] = opacity;
|
297
|
-
paint.setColor(cl);
|
290
|
+
paint.setAlphaf(currentOpacity * paint.getAlphaf());
|
298
291
|
}
|
299
292
|
if (strokeWidth !== undefined) {
|
300
293
|
paint.setStrokeWidth(strokeWidth);
|
@@ -320,9 +313,6 @@ const concatPaint = (
|
|
320
313
|
if (pathEffect !== undefined) {
|
321
314
|
paint.setPathEffect(pathEffect);
|
322
315
|
}
|
323
|
-
if (alpha !== undefined) {
|
324
|
-
paint.setAlphaf(alpha * opacity);
|
325
|
-
}
|
326
316
|
if (strokeCap !== undefined) {
|
327
317
|
paint.setStrokeCap(strokeCap);
|
328
318
|
}
|
@@ -5,7 +5,6 @@ import { DeclarationType, NodeType } from "../../types";
|
|
5
5
|
import type { BoxShadowProps, BoxProps } from "../../types/Drawings";
|
6
6
|
import type { NodeContext } from "../Node";
|
7
7
|
import { JsiDeclarationNode } from "../Node";
|
8
|
-
import { processColor } from "../datatypes";
|
9
8
|
import { JsiRenderNode } from "../RenderNode";
|
10
9
|
|
11
10
|
const inflate = (
|
@@ -54,8 +53,9 @@ export class BoxNode extends JsiRenderNode<BoxProps> {
|
|
54
53
|
super(ctx, NodeType.Box, props);
|
55
54
|
}
|
56
55
|
|
57
|
-
renderNode({ canvas, paint
|
56
|
+
renderNode({ canvas, paint }: DrawingContext) {
|
58
57
|
const { box: defaultBox } = this.props;
|
58
|
+
const opacity = paint.getAlphaf();
|
59
59
|
const box = isRRect(defaultBox)
|
60
60
|
? defaultBox
|
61
61
|
: this.Skia.RRectXY(defaultBox, 0, 0);
|
@@ -72,7 +72,8 @@ export class BoxNode extends JsiRenderNode<BoxProps> {
|
|
72
72
|
.map((shadow) => {
|
73
73
|
const { color = "black", blur, spread = 0, dx = 0, dy = 0 } = shadow;
|
74
74
|
const lPaint = this.Skia.Paint();
|
75
|
-
lPaint.setColor(
|
75
|
+
lPaint.setColor(this.Skia.Color(color));
|
76
|
+
lPaint.setAlphaf(paint.getAlphaf() * opacity);
|
76
77
|
lPaint.setMaskFilter(
|
77
78
|
this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)
|
78
79
|
);
|
@@ -92,7 +93,9 @@ export class BoxNode extends JsiRenderNode<BoxProps> {
|
|
92
93
|
canvas.save();
|
93
94
|
canvas.clipRRect(box, ClipOp.Intersect, false);
|
94
95
|
const lPaint = this.Skia.Paint();
|
95
|
-
lPaint.setColor(
|
96
|
+
lPaint.setColor(this.Skia.Color(color));
|
97
|
+
lPaint.setAlphaf(paint.getAlphaf() * opacity);
|
98
|
+
|
96
99
|
lPaint.setMaskFilter(
|
97
100
|
this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)
|
98
101
|
);
|
@@ -2,7 +2,7 @@ import type { SkColor, SkPoint } from "../../../skia/types";
|
|
2
2
|
import { BlendMode } from "../../../skia/types";
|
3
3
|
import type { DrawingContext, PatchProps } from "../../types";
|
4
4
|
import { NodeType } from "../../types";
|
5
|
-
import {
|
5
|
+
import { enumKey } from "../datatypes";
|
6
6
|
import { JsiDrawingNode } from "../DrawingNode";
|
7
7
|
import type { NodeContext } from "../Node";
|
8
8
|
|
@@ -39,30 +39,16 @@ export class PatchNode extends JsiDrawingNode<
|
|
39
39
|
patch[3].c2,
|
40
40
|
patch[0].c1,
|
41
41
|
],
|
42
|
-
colors: colors
|
43
|
-
? colors.map((c) => processColor(this.Skia, c, 1))
|
44
|
-
: undefined,
|
42
|
+
colors: colors ? colors.map((c) => this.Skia.Color(c)) : undefined,
|
45
43
|
};
|
46
44
|
}
|
47
45
|
|
48
|
-
draw({ canvas, paint
|
46
|
+
draw({ canvas, paint }: DrawingContext) {
|
49
47
|
if (!this.derived) {
|
50
48
|
throw new Error("PatchNode: derived props not set");
|
51
49
|
}
|
52
50
|
const { texture } = this.props;
|
53
51
|
const { colors, points, mode } = this.derived;
|
54
|
-
canvas.drawPatch(
|
55
|
-
points,
|
56
|
-
opacity === 1
|
57
|
-
? colors
|
58
|
-
: colors &&
|
59
|
-
colors.map((c) => {
|
60
|
-
c[ALPHA] = c[ALPHA] * opacity;
|
61
|
-
return c;
|
62
|
-
}),
|
63
|
-
texture,
|
64
|
-
mode,
|
65
|
-
paint
|
66
|
-
);
|
52
|
+
canvas.drawPatch(points, colors, texture, mode, paint);
|
67
53
|
}
|
68
54
|
}
|
@@ -2,7 +2,7 @@ import type { SkVertices } from "../../../skia/types";
|
|
2
2
|
import { VertexMode, BlendMode } from "../../../skia/types";
|
3
3
|
import type { DrawingContext, VerticesProps } from "../../types";
|
4
4
|
import { NodeType } from "../../types";
|
5
|
-
import { enumKey
|
5
|
+
import { enumKey } from "../datatypes";
|
6
6
|
import { JsiDrawingNode } from "../DrawingNode";
|
7
7
|
import type { NodeContext } from "../Node";
|
8
8
|
|
@@ -18,7 +18,7 @@ export class VerticesNode extends JsiDrawingNode<VerticesProps, SkVertices> {
|
|
18
18
|
vertexMode,
|
19
19
|
vertices,
|
20
20
|
textures,
|
21
|
-
colors ? colors.map((c) =>
|
21
|
+
colors ? colors.map((c) => this.Skia.Color(c)) : undefined,
|
22
22
|
indices
|
23
23
|
);
|
24
24
|
}
|
@@ -8,7 +8,6 @@ import type {
|
|
8
8
|
Node,
|
9
9
|
} from "../../types";
|
10
10
|
import { DeclarationType, NodeType } from "../../types";
|
11
|
-
import { processColor } from "../datatypes";
|
12
11
|
import { enumKey } from "../datatypes/Enum";
|
13
12
|
import type { LerpColorFilterProps } from "../../types/ColorFilters";
|
14
13
|
|
@@ -71,7 +70,7 @@ export class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilte
|
|
71
70
|
|
72
71
|
materialize() {
|
73
72
|
const { mode } = this.props;
|
74
|
-
const color =
|
73
|
+
const color = this.Skia.Color(this.props.color);
|
75
74
|
const cf = this.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);
|
76
75
|
return this.compose(cf);
|
77
76
|
}
|
@@ -15,7 +15,7 @@ import type {
|
|
15
15
|
RuntimeShaderImageFilterProps,
|
16
16
|
} from "../../types";
|
17
17
|
import { DeclarationType, NodeType } from "../../types";
|
18
|
-
import { processRadius, enumKey
|
18
|
+
import { processRadius, enumKey } from "../datatypes";
|
19
19
|
import type { NodeContext } from "../Node";
|
20
20
|
import { JsiDeclarationNode } from "../Node";
|
21
21
|
|
@@ -145,7 +145,7 @@ export class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadow
|
|
145
145
|
|
146
146
|
materialize() {
|
147
147
|
const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;
|
148
|
-
const color =
|
148
|
+
const color = this.Skia.Color(cl);
|
149
149
|
const input = this.getOptionalChildInstance(0);
|
150
150
|
let factory;
|
151
151
|
if (inner) {
|
@@ -19,7 +19,6 @@ import type {
|
|
19
19
|
TwoPointConicalGradientProps,
|
20
20
|
} from "../../types";
|
21
21
|
import { DeclarationType, NodeType } from "../../types";
|
22
|
-
import { processColor } from "../datatypes/Color";
|
23
22
|
import {
|
24
23
|
enumKey,
|
25
24
|
fitRects,
|
@@ -99,7 +98,7 @@ export class ColorNode extends ShaderDeclaration<ColorProps> {
|
|
99
98
|
|
100
99
|
materialize() {
|
101
100
|
const { color } = this.props;
|
102
|
-
return this.Skia.Shader.MakeColor(
|
101
|
+
return this.Skia.Shader.MakeColor(this.Skia.Color(color));
|
103
102
|
}
|
104
103
|
}
|
105
104
|
|
package/src/renderer/Canvas.tsx
CHANGED
@@ -4,7 +4,6 @@ import React, {
|
|
4
4
|
useMemo,
|
5
5
|
forwardRef,
|
6
6
|
useRef,
|
7
|
-
useState,
|
8
7
|
} from "react";
|
9
8
|
import type {
|
10
9
|
RefObject,
|
@@ -15,7 +14,6 @@ import type {
|
|
15
14
|
} from "react";
|
16
15
|
import type { OpaqueRoot } from "react-reconciler";
|
17
16
|
import ReactReconciler from "react-reconciler";
|
18
|
-
import { Platform } from "react-native";
|
19
17
|
|
20
18
|
import { SkiaDomView } from "../views";
|
21
19
|
import type { TouchHandler } from "../views";
|
@@ -26,7 +24,6 @@ import { debug as hostDebug, skHostConfig } from "./HostConfig";
|
|
26
24
|
// import { debugTree } from "./nodes";
|
27
25
|
import { Container } from "./Container";
|
28
26
|
import { DependencyManager } from "./DependencyManager";
|
29
|
-
import { CanvasProvider } from "./useCanvas";
|
30
27
|
|
31
28
|
export const skiaReconciler = ReactReconciler(skHostConfig);
|
32
29
|
|
@@ -65,11 +62,8 @@ export const Canvas = forwardRef<SkiaDomView, CanvasProps>(
|
|
65
62
|
) => {
|
66
63
|
const innerRef = useCanvasRef();
|
67
64
|
const ref = useCombinedRefs(forwardedRef, innerRef);
|
68
|
-
const [, setTick] = useState(0);
|
69
65
|
const redraw = useCallback(() => {
|
70
|
-
|
71
|
-
? setTick((tick) => tick + 1)
|
72
|
-
: innerRef.current?.redraw();
|
66
|
+
innerRef.current?.redraw();
|
73
67
|
}, [innerRef]);
|
74
68
|
|
75
69
|
const registerValues = useCallback(
|
@@ -107,11 +101,7 @@ export const Canvas = forwardRef<SkiaDomView, CanvasProps>(
|
|
107
101
|
|
108
102
|
// Render effect
|
109
103
|
useEffect(() => {
|
110
|
-
render(
|
111
|
-
<CanvasProvider value={{ Skia }}>{children}</CanvasProvider>,
|
112
|
-
root,
|
113
|
-
container
|
114
|
-
);
|
104
|
+
render(children, root, container);
|
115
105
|
}, [children, root, redraw, container]);
|
116
106
|
|
117
107
|
useEffect(() => {
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import type { RefObject } from "react";
|
2
2
|
|
3
3
|
import type { DrawingInfo, SkiaView } from "../views";
|
4
|
-
import type {
|
4
|
+
import type { Skia, Vector } from "../skia/types";
|
5
|
+
import type { DrawingContext as DOMDrawingContext } from "../dom/types";
|
5
6
|
|
6
|
-
export interface DrawingContext
|
7
|
-
|
8
|
-
|
9
|
-
opacity: number;
|
7
|
+
export interface DrawingContext
|
8
|
+
extends Omit<DrawingInfo, "touches">,
|
9
|
+
DOMDrawingContext {
|
10
10
|
center: Vector;
|
11
11
|
ref: RefObject<SkiaView>;
|
12
12
|
Skia: Skia;
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
|
-
import React
|
3
|
-
|
4
|
-
import { BlendMode } from "../../skia/types";
|
5
|
-
import { useSkiaPrivate } from "../useCanvas";
|
2
|
+
import React from "react";
|
6
3
|
|
7
4
|
import { Group } from "./Group";
|
5
|
+
import { LumaColorFilter } from "./colorFilters/LumaColorFilter";
|
6
|
+
import { Paint } from "./Paint";
|
8
7
|
|
9
8
|
interface MaskProps {
|
10
9
|
mode: "luminance" | "alpha";
|
@@ -14,25 +13,17 @@ interface MaskProps {
|
|
14
13
|
}
|
15
14
|
|
16
15
|
export const Mask = ({ children, mask, mode, clip }: MaskProps) => {
|
17
|
-
const Skia = useSkiaPrivate();
|
18
|
-
const maskPaint = useMemo(() => {
|
19
|
-
const paint = Skia.Paint();
|
20
|
-
paint.setBlendMode(BlendMode.Src);
|
21
|
-
if (mode === "luminance") {
|
22
|
-
paint.setColorFilter(Skia.ColorFilter.MakeLumaColorFilter());
|
23
|
-
}
|
24
|
-
return paint;
|
25
|
-
}, [Skia, mode]);
|
26
|
-
const clippingPaint = useMemo(() => {
|
27
|
-
const paint = Skia.Paint();
|
28
|
-
paint.setBlendMode(BlendMode.DstIn);
|
29
|
-
return paint;
|
30
|
-
}, [Skia]);
|
31
16
|
return (
|
32
17
|
<Group layer>
|
33
|
-
<Group
|
18
|
+
<Group
|
19
|
+
layer={
|
20
|
+
<Paint blendMode="src">
|
21
|
+
{mode === "luminance" && <LumaColorFilter />}
|
22
|
+
</Paint>
|
23
|
+
}
|
24
|
+
>
|
34
25
|
{mask}
|
35
|
-
{clip && <Group layer={
|
26
|
+
{clip && <Group layer={<Paint blendMode="dstIn" />}>{children}</Group>}
|
36
27
|
</Group>
|
37
28
|
<Group blendMode="srcIn">{children}</Group>
|
38
29
|
</Group>
|
package/src/renderer/index.ts
CHANGED
@@ -29,6 +29,11 @@ export const isPaint = (obj: SkJSIInstance<string> | null): obj is SkPaint =>
|
|
29
29
|
obj !== null && obj.__typename__ === "Paint";
|
30
30
|
|
31
31
|
export interface SkPaint extends SkJSIInstance<"Paint"> {
|
32
|
+
/**
|
33
|
+
* Retrieves alpha from the color used when stroking and filling.
|
34
|
+
*/
|
35
|
+
getAlphaf(): number;
|
36
|
+
|
32
37
|
/**
|
33
38
|
* Returns a copy of this paint.
|
34
39
|
*/
|
package/src/web/LoadSkiaWeb.tsx
CHANGED
@@ -1,27 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.rgbaColor = exports.processColor = exports.RED = exports.GREEN = exports.BLUE = exports.ALPHA = void 0;
|
7
|
-
const RED = 0;
|
8
|
-
exports.RED = RED;
|
9
|
-
const GREEN = 1;
|
10
|
-
exports.GREEN = GREEN;
|
11
|
-
const BLUE = 2;
|
12
|
-
exports.BLUE = BLUE;
|
13
|
-
const ALPHA = 3;
|
14
|
-
exports.ALPHA = ALPHA;
|
15
|
-
|
16
|
-
const rgbaColor = (r, g, b, a) => new Float32Array([r, g, b, a]);
|
17
|
-
|
18
|
-
exports.rgbaColor = rgbaColor;
|
19
|
-
|
20
|
-
const processColor = (Skia, cl, currentOpacity) => {
|
21
|
-
const color = Skia.Color(cl);
|
22
|
-
color[ALPHA] *= currentOpacity;
|
23
|
-
return color;
|
24
|
-
};
|
25
|
-
|
26
|
-
exports.processColor = processColor;
|
27
|
-
//# sourceMappingURL=Color.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["RED","GREEN","BLUE","ALPHA","rgbaColor","r","g","b","a","Float32Array","processColor","Skia","cl","currentOpacity","color","Color"],"sources":["Color.ts"],"sourcesContent":["import type { Color, Skia } from \"../../../skia/types\";\n\nexport const RED = 0;\nexport const GREEN = 1;\nexport const BLUE = 2;\nexport const ALPHA = 3;\n\nexport const rgbaColor = (r: number, g: number, b: number, a: number) =>\n new Float32Array([r, g, b, a]);\n\nexport const processColor = (Skia: Skia, cl: Color, currentOpacity: number) => {\n const color = Skia.Color(cl);\n color[ALPHA] *= currentOpacity;\n return color;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,GAAG,GAAG,CAAZ;;AACA,MAAMC,KAAK,GAAG,CAAd;;AACA,MAAMC,IAAI,GAAG,CAAb;;AACA,MAAMC,KAAK,GAAG,CAAd;;;AAEA,MAAMC,SAAS,GAAG,CAACC,CAAD,EAAYC,CAAZ,EAAuBC,CAAvB,EAAkCC,CAAlC,KACvB,IAAIC,YAAJ,CAAiB,CAACJ,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUC,CAAV,CAAjB,CADK;;;;AAGA,MAAME,YAAY,GAAG,CAACC,IAAD,EAAaC,EAAb,EAAwBC,cAAxB,KAAmD;EAC7E,MAAMC,KAAK,GAAGH,IAAI,CAACI,KAAL,CAAWH,EAAX,CAAd;EACAE,KAAK,CAACX,KAAD,CAAL,IAAgBU,cAAhB;EACA,OAAOC,KAAP;AACD,CAJM"}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useSkiaPrivate = exports.CanvasProvider = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
9
|
-
|
10
|
-
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); }
|
11
|
-
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
13
|
-
|
14
|
-
const CanvasContext = /*#__PURE__*/_react.default.createContext(null);
|
15
|
-
|
16
|
-
const CanvasProvider = CanvasContext.Provider; // This private function will be removed once we remove the useCanvas hook and
|
17
|
-
// implement the Mask component as a node (will be faster too)
|
18
|
-
|
19
|
-
exports.CanvasProvider = CanvasProvider;
|
20
|
-
|
21
|
-
const useSkiaPrivate = () => {
|
22
|
-
const ctx = (0, _react.useContext)(CanvasContext);
|
23
|
-
|
24
|
-
if (!ctx) {
|
25
|
-
throw new Error("Skia Canvas context is not available");
|
26
|
-
}
|
27
|
-
|
28
|
-
return ctx.Skia;
|
29
|
-
};
|
30
|
-
|
31
|
-
exports.useSkiaPrivate = useSkiaPrivate;
|
32
|
-
//# sourceMappingURL=useCanvas.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["CanvasContext","React","createContext","CanvasProvider","Provider","useSkiaPrivate","ctx","useContext","Error","Skia"],"sources":["useCanvas.ts"],"sourcesContent":["import React, { useContext } from \"react\";\n\nimport type { Skia } from \"../skia/types\";\n\ninterface CanvasContext {\n Skia: Skia;\n}\n\nconst CanvasContext = React.createContext<CanvasContext | null>(null);\n\nexport const CanvasProvider = CanvasContext.Provider;\n\n// This private function will be removed once we remove the useCanvas hook and\n// implement the Mask component as a node (will be faster too)\nexport const useSkiaPrivate = () => {\n const ctx = useContext(CanvasContext);\n if (!ctx) {\n throw new Error(\"Skia Canvas context is not available\");\n }\n return ctx.Skia;\n};\n"],"mappings":";;;;;;;AAAA;;;;;;AAQA,MAAMA,aAAa,gBAAGC,cAAA,CAAMC,aAAN,CAA0C,IAA1C,CAAtB;;AAEO,MAAMC,cAAc,GAAGH,aAAa,CAACI,QAArC,C,CAEP;AACA;;;;AACO,MAAMC,cAAc,GAAG,MAAM;EAClC,MAAMC,GAAG,GAAG,IAAAC,iBAAA,EAAWP,aAAX,CAAZ;;EACA,IAAI,CAACM,GAAL,EAAU;IACR,MAAM,IAAIE,KAAJ,CAAU,sCAAV,CAAN;EACD;;EACD,OAAOF,GAAG,CAACG,IAAX;AACD,CANM"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
export const RED = 0;
|
2
|
-
export const GREEN = 1;
|
3
|
-
export const BLUE = 2;
|
4
|
-
export const ALPHA = 3;
|
5
|
-
export const rgbaColor = (r, g, b, a) => new Float32Array([r, g, b, a]);
|
6
|
-
export const processColor = (Skia, cl, currentOpacity) => {
|
7
|
-
const color = Skia.Color(cl);
|
8
|
-
color[ALPHA] *= currentOpacity;
|
9
|
-
return color;
|
10
|
-
};
|
11
|
-
//# sourceMappingURL=Color.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["RED","GREEN","BLUE","ALPHA","rgbaColor","r","g","b","a","Float32Array","processColor","Skia","cl","currentOpacity","color","Color"],"sources":["Color.ts"],"sourcesContent":["import type { Color, Skia } from \"../../../skia/types\";\n\nexport const RED = 0;\nexport const GREEN = 1;\nexport const BLUE = 2;\nexport const ALPHA = 3;\n\nexport const rgbaColor = (r: number, g: number, b: number, a: number) =>\n new Float32Array([r, g, b, a]);\n\nexport const processColor = (Skia: Skia, cl: Color, currentOpacity: number) => {\n const color = Skia.Color(cl);\n color[ALPHA] *= currentOpacity;\n return color;\n};\n"],"mappings":"AAEA,OAAO,MAAMA,GAAG,GAAG,CAAZ;AACP,OAAO,MAAMC,KAAK,GAAG,CAAd;AACP,OAAO,MAAMC,IAAI,GAAG,CAAb;AACP,OAAO,MAAMC,KAAK,GAAG,CAAd;AAEP,OAAO,MAAMC,SAAS,GAAG,CAACC,CAAD,EAAYC,CAAZ,EAAuBC,CAAvB,EAAkCC,CAAlC,KACvB,IAAIC,YAAJ,CAAiB,CAACJ,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUC,CAAV,CAAjB,CADK;AAGP,OAAO,MAAME,YAAY,GAAG,CAACC,IAAD,EAAaC,EAAb,EAAwBC,cAAxB,KAAmD;EAC7E,MAAMC,KAAK,GAAGH,IAAI,CAACI,KAAL,CAAWH,EAAX,CAAd;EACAE,KAAK,CAACX,KAAD,CAAL,IAAgBU,cAAhB;EACA,OAAOC,KAAP;AACD,CAJM"}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import React, { useContext } from "react";
|
2
|
-
const CanvasContext = /*#__PURE__*/React.createContext(null);
|
3
|
-
export const CanvasProvider = CanvasContext.Provider; // This private function will be removed once we remove the useCanvas hook and
|
4
|
-
// implement the Mask component as a node (will be faster too)
|
5
|
-
|
6
|
-
export const useSkiaPrivate = () => {
|
7
|
-
const ctx = useContext(CanvasContext);
|
8
|
-
|
9
|
-
if (!ctx) {
|
10
|
-
throw new Error("Skia Canvas context is not available");
|
11
|
-
}
|
12
|
-
|
13
|
-
return ctx.Skia;
|
14
|
-
};
|
15
|
-
//# sourceMappingURL=useCanvas.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["React","useContext","CanvasContext","createContext","CanvasProvider","Provider","useSkiaPrivate","ctx","Error","Skia"],"sources":["useCanvas.ts"],"sourcesContent":["import React, { useContext } from \"react\";\n\nimport type { Skia } from \"../skia/types\";\n\ninterface CanvasContext {\n Skia: Skia;\n}\n\nconst CanvasContext = React.createContext<CanvasContext | null>(null);\n\nexport const CanvasProvider = CanvasContext.Provider;\n\n// This private function will be removed once we remove the useCanvas hook and\n// implement the Mask component as a node (will be faster too)\nexport const useSkiaPrivate = () => {\n const ctx = useContext(CanvasContext);\n if (!ctx) {\n throw new Error(\"Skia Canvas context is not available\");\n }\n return ctx.Skia;\n};\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AAQA,MAAMC,aAAa,gBAAGF,KAAK,CAACG,aAAN,CAA0C,IAA1C,CAAtB;AAEA,OAAO,MAAMC,cAAc,GAAGF,aAAa,CAACG,QAArC,C,CAEP;AACA;;AACA,OAAO,MAAMC,cAAc,GAAG,MAAM;EAClC,MAAMC,GAAG,GAAGN,UAAU,CAACC,aAAD,CAAtB;;EACA,IAAI,CAACK,GAAL,EAAU;IACR,MAAM,IAAIC,KAAJ,CAAU,sCAAV,CAAN;EACD;;EACD,OAAOD,GAAG,CAACE,IAAX;AACD,CANM"}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import type { Color, Skia } from "../../../skia/types";
|
2
|
-
export declare const RED = 0;
|
3
|
-
export declare const GREEN = 1;
|
4
|
-
export declare const BLUE = 2;
|
5
|
-
export declare const ALPHA = 3;
|
6
|
-
export declare const rgbaColor: (r: number, g: number, b: number, a: number) => Float32Array;
|
7
|
-
export declare const processColor: (Skia: Skia, cl: Color, currentOpacity: number) => Float32Array;
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import type { Skia } from "../skia/types";
|
3
|
-
interface CanvasContext {
|
4
|
-
Skia: Skia;
|
5
|
-
}
|
6
|
-
declare const CanvasContext: React.Context<CanvasContext | null>;
|
7
|
-
export declare const CanvasProvider: React.Provider<CanvasContext | null>;
|
8
|
-
export declare const useSkiaPrivate: () => Skia;
|
9
|
-
export {};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import type { Color, Skia } from "../../../skia/types";
|
2
|
-
|
3
|
-
export const RED = 0;
|
4
|
-
export const GREEN = 1;
|
5
|
-
export const BLUE = 2;
|
6
|
-
export const ALPHA = 3;
|
7
|
-
|
8
|
-
export const rgbaColor = (r: number, g: number, b: number, a: number) =>
|
9
|
-
new Float32Array([r, g, b, a]);
|
10
|
-
|
11
|
-
export const processColor = (Skia: Skia, cl: Color, currentOpacity: number) => {
|
12
|
-
const color = Skia.Color(cl);
|
13
|
-
color[ALPHA] *= currentOpacity;
|
14
|
-
return color;
|
15
|
-
};
|