forked from glaciall/jsBitmap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
23 lines (20 loc) · 751 Bytes
/
test.js
File metadata and controls
23 lines (20 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////
////// 测试代码
//////
var time = new Date().getTime();
var bitmap = new BitMap();
bitmap.create(300, 300, 0x000000);
for (var i = 0; i < 300; i++) bitmap.setPixel(i, i, 0xff0000);
for (var i = 0; i < 300; i++) bitmap.setPixel(300 - i, i, 0xff0000);
// 需要基于浏览器测试
var img = new Image();
img.src = bitmap.toBase64();
img.onload = function()
{
time = new Date().getTime() - time;
alert('Spend: ' + time + 'ms');
}
document.body.appendChild(img);