当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript CanvasContext.fillText方法代码示例

本文整理汇总了TypeScript中tabris.CanvasContext.fillText方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CanvasContext.fillText方法的具体用法?TypeScript CanvasContext.fillText怎么用?TypeScript CanvasContext.fillText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tabris.CanvasContext的用法示例。


在下文中一共展示了CanvasContext.fillText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: drawHourLabel

 private drawHourLabel(ctx: CanvasContext, hour: number) {
   ctx.textAlign = "center";
   ctx.textBaseline = "top";
   let hourNumber = new Date(hour).getHours();
   let hourString = (hourNumber < 10) ? "0" + hourNumber + ":00" : hourNumber + ":00";
   ctx.fillText(hourString, this.getX(hour), this.getY(this.scale.minY) + 1);
 }
开发者ID:Homoola,项目名称:tabris-js,代码行数:7,代码来源:weatherGraph.ts

示例2: drawTemperatureScale

 private drawTemperatureScale(ctx: CanvasContext) {
   let degreeHeight = this.getY(this.scale.minY) - this.getY(this.scale.minY + 1);
   let degreeStep = (degreeHeight > minVerticalDistance) ? 1 : (2 * degreeHeight > minVerticalDistance) ? 2 : 5;
   let minHeight = Math.ceil(this.scale.minY / degreeStep) * degreeStep;
   ctx.strokeStyle = uiLineColor;
   ctx.lineWidth = uiLineWidth;
   for (let height = minHeight; height < this.scale.maxY; height += degreeStep) {
     // horizontal line
     ctx.beginPath();
     ctx.moveTo(this.getX(this.scale.minX), this.getY(height));
     ctx.lineTo(this.getX(this.scale.maxX), this.getY(height));
     ctx.stroke();
     // text label
     ctx.fillStyle = uiTextColor;
     ctx.font = uiFont;
     ctx.textAlign = "right";
     ctx.textBaseline = "middle";
     ctx.fillText(height + "°C", this.getX(this.scale.minX) - 2, this.getY(height));
   }
 }
开发者ID:Homoola,项目名称:tabris-js,代码行数:20,代码来源:weatherGraph.ts

示例3: drawDayLabel

 private drawDayLabel(ctx: CanvasContext, day: number) {
   ctx.textAlign = "left";
   ctx.textBaseline = "bottom";
   let dayName = daysNames[new Date(day).getDay()];
   ctx.fillText(dayName, this.getX(day) + 3, this.getY(this.scale.maxY) + 1);
 }
开发者ID:Homoola,项目名称:tabris-js,代码行数:6,代码来源:weatherGraph.ts

示例4:

let num: number = 42;
let bool: boolean = false;
let voidReturnValue: void;
let imageData: ImageData;
let text: string = '';

voidReturnValue = ctx.arc(num, num, num, num, num, bool);
voidReturnValue = ctx.beginPath();
voidReturnValue = ctx.bezierCurveTo(num, num, num, num, num, num);
voidReturnValue = ctx.clearRect(num, num, num, num);
voidReturnValue = ctx.closePath();
imageData = ctx.createImageData(num, num);
imageData = ctx.createImageData(imageData);
voidReturnValue = ctx.fill();
voidReturnValue = ctx.fillRect(num, num, num, num);
voidReturnValue = ctx.fillText(text, num, num);
imageData = ctx.getImageData(num, num, num, num);
voidReturnValue = ctx.lineTo(num, num);
voidReturnValue = ctx.moveTo(num, num);
voidReturnValue = ctx.putImageData(imageData, num, num);
voidReturnValue = ctx.quadraticCurveTo(num, num, num, num);
voidReturnValue = ctx.rect(num, num, num, num);
voidReturnValue = ctx.restore();
voidReturnValue = ctx.rotate(num);
voidReturnValue = ctx.save();
voidReturnValue = ctx.scale(num, num);
voidReturnValue = ctx.setTransform(num, num, num, num, num, num);
voidReturnValue = ctx.stroke();
voidReturnValue = ctx.strokeRect(num, num, num, num);
voidReturnValue = ctx.strokeText(text, num, num);
voidReturnValue = ctx.transform(num, num, num, num, num, num);
开发者ID:eclipsesource,项目名称:tabris-js,代码行数:31,代码来源:CanvasContext.test.ts


注:本文中的tabris.CanvasContext.fillText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。