@shopify/react-native-skia
Version:
High-performance React Native Graphics using Skia
20 lines (16 loc) • 532 B
text/typescript
import type { DrawingContext, LineProps } from "../../types";
import { NodeType } from "../../types";
import { JsiDrawingNode } from "../DrawingNode";
import type { NodeContext } from "../Node";
export class LineNode extends JsiDrawingNode<LineProps, null> {
constructor(ctx: NodeContext, props: LineProps) {
super(ctx, NodeType.Line, props);
}
deriveProps() {
return null;
}
draw({ canvas, paint }: DrawingContext) {
const { p1, p2 } = this.props;
canvas.drawLine(p1.x, p1.y, p2.x, p2.y, paint);
}
}