mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
22 lines
444 B
JavaScript
22 lines
444 B
JavaScript
/**
|
|
* 产生一个单像素画布
|
|
* @param {*} color 默认颜色
|
|
*/
|
|
function onePixelCanvas(color = '#000000') {
|
|
var canvas = document.createElement('canvas');
|
|
canvas.width = 1;
|
|
canvas.height = 1;
|
|
var ctx = canvas.getContext('2d');
|
|
ctx.fillStyle = color;
|
|
ctx.fillRect(0, 0, 1, 1);
|
|
return canvas;
|
|
}
|
|
|
|
/**
|
|
* 图片工具类
|
|
*/
|
|
const ImageUtils = {
|
|
onePixelCanvas: onePixelCanvas
|
|
};
|
|
|
|
export default ImageUtils; |