本文整理汇总了TypeScript中core/util/canvas.Context2d.beginPath方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Context2d.beginPath方法的具体用法?TypeScript Context2d.beginPath怎么用?TypeScript Context2d.beginPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/util/canvas.Context2d
的用法示例。
在下文中一共展示了Context2d.beginPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _render
_render(ctx: Context2d, indices, {sx0, sy0, sx1, sy1}) {
if (this.visuals.line.doit) {
for (const i of indices) {
if (isNaN(sx0[i]+sy0[i]+sx1[i]+sy1[i])) {
continue;
}
ctx.beginPath();
ctx.moveTo(sx0[i], sy0[i]);
ctx.lineTo(sx1[i], sy1[i]);
this.visuals.line.set_vectorize(ctx, i);
ctx.stroke();
}
}
}
示例2: _render
protected _render(ctx: Context2d, indices: number[],
{sx0, sy0, sx1, sy1, scx0, scy0, scx1, scy1}: BezierData): void {
if (this.visuals.line.doit) {
for (const i of indices) {
if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i] + scx0[i] + scy0[i] + scx1[i] + scy1[i]))
continue
ctx.beginPath()
ctx.moveTo(sx0[i], sy0[i])
ctx.bezierCurveTo(scx0[i], scy0[i], scx1[i], scy1[i], sx1[i], sy1[i])
this.visuals.line.set_vectorize(ctx, i)
ctx.stroke()
}
}
}
示例3: _render
protected _render(ctx: Context2d, indices: number[],
{sx, sy, sradius, _start_angle, _end_angle}: ArcData): void {
if (this.visuals.line.doit) {
const direction = this.model.properties.direction.value()
for (const i of indices) {
if (isNaN(sx[i] + sy[i] + sradius[i] + _start_angle[i] + _end_angle[i]))
continue
ctx.beginPath()
ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction)
this.visuals.line.set_vectorize(ctx, i)
ctx.stroke()
}
}
}
示例4: _inner_loop
protected _inner_loop(ctx: Context2d, sx: Arrayable<Arrayable<Arrayable<number>>>, sy: Arrayable<Arrayable<Arrayable<number>>>): void {
ctx.beginPath()
for (let j = 0, endj = sx.length; j < endj; j++) {
for (let k = 0, endk = sx[j].length; k < endk; k++) {
const _sx = sx[j][k]
const _sy = sy[j][k]
for (let l = 0, endl = _sx.length; l < endl; l++) {
if (l == 0) {
ctx.moveTo(_sx[l], _sy[l])
continue
} else
ctx.lineTo(_sx[l], _sy[l])
}
ctx.closePath()
}
}
}
示例5: _render
_render(ctx: Context2d, indices, {sleft, sright, stop, sbottom}) {
for (const i of indices) {
if (isNaN(sleft[i]+stop[i]+sright[i]+sbottom[i])) {
continue;
}
if (this.visuals.fill.doit) {
this.visuals.fill.set_vectorize(ctx, i);
ctx.fillRect(sleft[i], stop[i], sright[i]-sleft[i], sbottom[i]-stop[i]);
}
if (this.visuals.line.doit) {
ctx.beginPath();
ctx.rect(sleft[i], stop[i], sright[i]-sleft[i], sbottom[i]-stop[i]);
this.visuals.line.set_vectorize(ctx, i);
ctx.stroke();
}
}
}
示例6: _render
protected _render(ctx: Context2d, indices: number[],
{sleft, sright, stop, sbottom}: BoxData): void {
for (const i of indices) {
if (isNaN(sleft[i] + stop[i] + sright[i] + sbottom[i]))
continue
if (this.visuals.fill.doit) {
this.visuals.fill.set_vectorize(ctx, i)
ctx.fillRect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i])
}
if (this.visuals.line.doit) {
ctx.beginPath()
ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i])
this.visuals.line.set_vectorize(ctx, i)
ctx.stroke()
}
}
}
示例7: _render
protected _render(ctx: Context2d, indices: number[], {sx, sy, sradius}: CircleData): void {
for (const i of indices) {
if (isNaN(sx[i] + sy[i] + sradius[i]))
continue
ctx.beginPath()
ctx.arc(sx[i], sy[i], sradius[i], 0, 2*Math.PI, false)
if (this.visuals.fill.doit) {
this.visuals.fill.set_vectorize(ctx, i)
ctx.fill()
}
if (this.visuals.line.doit) {
this.visuals.line.set_vectorize(ctx, i)
ctx.stroke()
}
}
}
示例8: _render
protected _render(ctx: Context2d, indices: number[], {sx, sy, sw, sh}: EllipseData): void {
for (const i of indices) {
if (isNaN(sx[i] + sy[i] + sw[i] + sh[i] + this._angle[i]))
continue
ctx.beginPath()
ctx.ellipse(sx[i], sy[i], sw[i]/2.0, sh[i]/2.0, this._angle[i], 0, 2 * Math.PI)
if (this.visuals.fill.doit) {
this.visuals.fill.set_vectorize(ctx, i)
ctx.fill()
}
if (this.visuals.line.doit) {
this.visuals.line.set_vectorize(ctx, i)
ctx.stroke()
}
}
}
示例9: _render
_render(ctx: Context2d, indices, {sx, sy, sradius}) {
for (const i of indices) {
if (isNaN(sx[i]+sy[i]+sradius[i])) {
continue;
}
ctx.beginPath();
ctx.arc(sx[i], sy[i], sradius[i], 0, 2*Math.PI, false);
if (this.visuals.fill.doit) {
this.visuals.fill.set_vectorize(ctx, i);
ctx.fill();
}
if (this.visuals.line.doit) {
this.visuals.line.set_vectorize(ctx, i);
ctx.stroke();
}
}
}
示例10: _draw_rule
protected _draw_rule(ctx: Context2d, _extents: Extents): void {
if (!this.visuals.axis_line.doit)
return
const [xs, ys] = this.model.rule_coords
const [sxs, sys] = this.plot_view.map_to_screen(xs, ys, this.model.x_range_name, this.model.y_range_name)
const [nx, ny] = this.model.normals
const [xoff, yoff] = this.model.offsets
this.visuals.axis_line.set_value(ctx)
ctx.beginPath()
ctx.moveTo(Math.round(sxs[0] + nx*xoff), Math.round(sys[0] + ny*yoff))
for (let i = 1; i < sxs.length; i++) {
const sx = Math.round(sxs[i] + nx*xoff)
const sy = Math.round(sys[i] + ny*yoff)
ctx.lineTo(sx, sy)
}
ctx.stroke()
}