Browse Source

Added more putImageData() tests

v1.x
Tj Holowaychuk 14 years ago
parent
commit
2449ddb1fc
  1. 25
      test/public/tests.js

25
test/public/tests.js

@ -1633,6 +1633,31 @@ tests['putImageData() alpha'] = function(ctx){
ctx.fillStyle = 'rgba(0,0,255,0.5)' ctx.fillStyle = 'rgba(0,0,255,0.5)'
ctx.fillRect(100,0,50,100); ctx.fillRect(100,0,50,100);
var data = ctx.getImageData(0,0,120,20);
ctx.putImageData(data,20,120);
};
tests['putImageData() alpha 2'] = function(ctx){
ctx.fillStyle = 'rgba(255,0,0,0.2)'
ctx.fillRect(0,0,50,100);
ctx.fillStyle = 'rgba(0,255,0,0.5)'
ctx.fillRect(50,0,50,100);
ctx.fillStyle = 'rgba(0,0,255,0.75)'
ctx.fillRect(100,0,50,100);
var data = ctx.getImageData(0,0,120,20);
ctx.putImageData(data,20,120);
};
tests['putImageData() globalAlpha'] = function(ctx){
ctx.globalAlpha = 0.5
ctx.fillStyle = '#f00'
ctx.fillRect(0,0,50,100);
ctx.fillStyle = '#0f0'
ctx.fillRect(50,0,50,100);
ctx.fillStyle = '#00f'
ctx.fillRect(100,0,50,100);
var data = ctx.getImageData(0,0,120,20); var data = ctx.getImageData(0,0,120,20);
ctx.putImageData(data,20,120); ctx.putImageData(data,20,120);
}; };
Loading…
Cancel
Save