Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaScript中的画布块状字体呈现_Javascript_Canvas_Html5 Canvas_Antialiasing - Fatal编程技术网

JavaScript中的画布块状字体呈现

JavaScript中的画布块状字体呈现,javascript,canvas,html5-canvas,antialiasing,Javascript,Canvas,Html5 Canvas,Antialiasing,我想在大画布上画块状字体(类似Atari)。我已经制作了一个画布,它从一个40×40像素的小画布复制渲染场景。但是看起来字体被小画布平滑了我如何禁用它?找到它,需要使用ctx.fillText而不是ctx.strokeText你在找它吗 ctx.imageSmoothingEnabled = true; // Blurs pixels when enlarging and blend pixels when zooming out. ctx.imageSmoothingEnabled = fa

我想在大画布上画块状字体(类似Atari)。我已经制作了一个画布,它从一个40×40像素的小画布复制渲染场景。但是看起来字体被小画布平滑了我如何禁用它?

找到它,需要使用
ctx.fillText
而不是
ctx.strokeText

你在找它吗

ctx.imageSmoothingEnabled = true; // Blurs pixels when enlarging and blend pixels when zooming out.

ctx.imageSmoothingEnabled = false; // zoomed in pixels remain square with hard edges 
                                   // like in 8 bit games.
                                   // uses nearest pixel when zoomed out. 
在图像平滑的情况下,某些设备具有更好的性能。关闭此标志似乎不会造成性能损失