本文整理匯總了TypeScript中core/util/canvas.Context2d.clearRect方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Context2d.clearRect方法的具體用法?TypeScript Context2d.clearRect怎麽用?TypeScript Context2d.clearRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core/util/canvas.Context2d
的用法示例。
在下文中一共展示了Context2d.clearRect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: _paint_empty
// this overrides the standard _paint_empty to make the inner canvas transparent
protected _paint_empty(ctx: Context2d, frame_box: FrameBox): void {
const ow = this.layout._width.value
const oh = this.layout._height.value
const [left, top, iw, ih] = frame_box
ctx.clearRect(0, 0, ow, oh)
ctx.beginPath()
ctx.moveTo(0, 0)
ctx.lineTo(0, oh)
ctx.lineTo(ow, oh)
ctx.lineTo(ow, 0)
ctx.lineTo(0, 0)
ctx.moveTo(left, top)
ctx.lineTo(left+iw, top)
ctx.lineTo(left+iw, top+ih)
ctx.lineTo(left, top+ih)
ctx.lineTo(left, top)
ctx.closePath()
if (this.model.border_fill_color != null) {
ctx.fillStyle = this.model.border_fill_color
ctx.fill()
}
}
示例2: _paint_empty
protected _paint_empty(ctx: Context2d, frame_box: FrameBox): void {
const [cx, cy, cw, ch] = [0, 0, this.canvas_view.model._width.value, this.canvas_view.model._height.value]
const [fx, fy, fw, fh] = frame_box
ctx.clearRect(cx, cy, cw, ch)
if (this.visuals.border_fill.doit) {
this.visuals.border_fill.set_value(ctx)
ctx.fillRect(cx, cy, cw, ch)
ctx.clearRect(fx, fy, fw, fh)
}
if (this.visuals.background_fill.doit) {
this.visuals.background_fill.set_value(ctx)
ctx.fillRect(fx, fy, fw, fh)
}
}
示例3: _paint_empty
// this overrides the standard _paint_empty to make the inner canvas transparent
_paint_empty(ctx: Context2d, frame_box) {
const ow = this.canvas._width.value;
const oh = this.canvas._height.value;
const [left, top, iw, ih] = frame_box;
ctx.clearRect(0, 0, ow, oh);
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(0, oh);
ctx.lineTo(ow, oh);
ctx.lineTo(ow, 0);
ctx.lineTo(0, 0);
ctx.moveTo(left, top);
ctx.lineTo(left+iw, top);
ctx.lineTo(left+iw, top+ih);
ctx.lineTo(left, top+ih);
ctx.lineTo(left, top);
ctx.closePath();
ctx.fillStyle = this.model.plot.border_fill_color;
return ctx.fill();
}