KingPsychopath / explorercanvas

Automatically exported from code.google.com/p/explorercanvas
Apache License 2.0
0 stars 0 forks source link

Canvas fillStyle in IE #107

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I could not find any solution for fillStyle problem on IE7 & IE8. excanvas.js 
init and everything else works fine until im trying to use fillStyle as pattern 
with image. Here`s code: 

    var imageObj = new Image();
    imageObj.src = "/img/news-image-4.jpg";
    imageObj.onload = function() {
       var pattern = context.createPattern(imageObj, "no-repeat");
       context.fillStyle = pattern;
       context.fill();          
    }; 

Error message from IE: 'undefined' is null or not an object.

It gets error from these lines in excanvas.js file

    var stops = fillStyle.colors_;  
    stops.sort(function(cs1, cs2) {
        return cs1.offset - cs2.offset;
    });

Any solution?
Thanks a lot.

Original issue reported on code.google.com by reinis.g...@gmail.com on 10 Jun 2011 at 10:24

GoogleCodeExporter commented 9 years ago
I have the same error, so I've made a workaround to temporarily solve the 
problem.

I changed the createPattern function and the CanvasPattern_ class and putted 
one new if/else statement on the stroke method (which is used in fill method) 
starting on line 733.

The new code is attached.

This is just a workaround to solve my specific problem. The code don't respect 
any possible standardization and I did'nt checked all the possibilities of use.

But it may help to find the final solution.

And, finally, my english sucks! =P

Original comment by neo...@gmail.com on 25 Aug 2011 at 5:54

Attachments: