當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Context2d.beginPath方法代碼示例

本文整理匯總了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();
      }
    }
  }
開發者ID:FourtekIT-incubator,項目名稱:bokeh,代碼行數:16,代碼來源:segment.ts

示例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()
      }
    }
  }
開發者ID:Zyell,項目名稱:bokeh,代碼行數:16,代碼來源:bezier.ts

示例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()
      }
    }
  }
開發者ID:Zyell,項目名稱:bokeh,代碼行數:17,代碼來源:arc.ts

示例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()
      }
    }
  }
開發者ID:digitalsatori,項目名稱:Bokeh,代碼行數:18,代碼來源:multi_polygons.ts

示例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();
      }
    }
  }
開發者ID:FourtekIT-incubator,項目名稱:bokeh,代碼行數:19,代碼來源:box.ts

示例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()
      }
    }
  }
開發者ID:gully,項目名稱:bokeh,代碼行數:19,代碼來源:box.ts

示例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()
      }
    }
  }
開發者ID:digitalsatori,項目名稱:Bokeh,代碼行數:19,代碼來源:circle.ts

示例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()
       }
     }
   }
開發者ID:Zyell,項目名稱:bokeh,代碼行數:19,代碼來源:ellipse.ts

示例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();
      }
    }
  }
開發者ID:FourtekIT-incubator,項目名稱:bokeh,代碼行數:20,代碼來源:circle.ts

示例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()
  }
開發者ID:Zyell,項目名稱:bokeh,代碼行數:20,代碼來源:axis.ts


注:本文中的core/util/canvas.Context2d.beginPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。