本文整理匯總了TypeScript中core/util/canvas.Context2d.getImageSmoothingEnabled方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Context2d.getImageSmoothingEnabled方法的具體用法?TypeScript Context2d.getImageSmoothingEnabled怎麽用?TypeScript Context2d.getImageSmoothingEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core/util/canvas.Context2d
的用法示例。
在下文中一共展示了Context2d.getImageSmoothingEnabled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: _render
protected _render(ctx: Context2d, indices: number[], {image_data, sx, sy, sw, sh}: _ImageData): void {
const old_smoothing = ctx.getImageSmoothingEnabled()
ctx.setImageSmoothingEnabled(false)
ctx.globalAlpha = this.model.global_alpha
for (const i of indices) {
if (image_data[i] == null)
continue
if (isNaN(sx[i] + sy[i] + sw[i] + sh[i]))
continue
const y_offset = sy[i]
ctx.translate(0, y_offset)
ctx.scale(1, -1)
ctx.translate(0, -y_offset)
ctx.drawImage(image_data[i], sx[i]|0, sy[i]|0, sw[i], sh[i])
ctx.translate(0, y_offset)
ctx.scale(1, -1)
ctx.translate(0, -y_offset)
}
ctx.setImageSmoothingEnabled(old_smoothing)
}
示例2: _render
_render(ctx: Context2d, indices, {image_data, sx, sy, sw, sh}) {
const old_smoothing = ctx.getImageSmoothingEnabled();
ctx.setImageSmoothingEnabled(false);
for (const i of indices) {
if ((image_data[i] == null)) {
continue;
}
if (isNaN(sx[i]+sy[i]+sw[i]+sh[i])) {
continue;
}
const y_offset = sy[i];
ctx.translate(0, y_offset);
ctx.scale(1, -1);
ctx.translate(0, -y_offset);
ctx.drawImage(image_data[i], sx[i]|0, sy[i]|0, sw[i], sh[i]);
ctx.translate(0, y_offset);
ctx.scale(1, -1);
ctx.translate(0, -y_offset);
}
return ctx.setImageSmoothingEnabled(old_smoothing);
}