Skip to content

Commit 642dea7

Browse files
committed
Do not load unless getImageData is available (excanvas); report supported blend modes
1 parent 4a8ea0e commit 642dea7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

context_blender.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if (window.CanvasRenderingContext2D){
1+
if (window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype.getImageData){
22
var defaultOffsets = {
33
destX : 0,
44
destY : 0,
@@ -122,4 +122,8 @@ if (window.CanvasRenderingContext2D){
122122
}
123123
destContext.putImageData(dstD,offsets.destX,offsets.destY);
124124
};
125+
// For querying of functionality from other libraries
126+
var modes = CanvasRenderingContext2D.prototype.blendOnto.supportedBlendModes = 'normal src-over screen multiply difference src-in plus add'.split(' ');
127+
var supports = CanvasRenderingContext2D.prototype.blendOnto.supports = {};
128+
for (var i=0,len=modes.length;i<len;++i) supports[modes[i]] = true;
125129
}

0 commit comments

Comments
 (0)