pingjiang / cakejs

Automatically exported from code.google.com/p/cakejs
0 stars 0 forks source link

not showing paterns #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
i use the exact same code in the reference
which is,

---
Pattern
Pattern is a possibly repeating image that can be used as a strokeStyle or 
fillStyle. var image = new Image() image.src = 'foo.jpg' var pattern = new 
Pattern(image, 'no-repeat') var rect = new Rectangle(200, 200, {fill: true, 
fillStyle: pattern}

---
but it does not show the image. Instead, it fills the rect with black color

Original issue reported on code.google.com by mserdars...@gmail.com on 2 Mar 2010 at 8:21

GoogleCodeExporter commented 9 years ago
i was using chrome because of it is very faster than firefox for canvas

but i found that for this easy code, chrome crashes but firefox shows it well

var img = new Image();  
img.onload = function()
{  
    var pat = new Pattern( img , 'repeat' );
    var rect = new Rectangle( 300 , 400 );
    rect.fill = pat;
    canvas.append( rect );
}  
img.src = 'grass.png'; 

i've searched a little but could not find the source of the error
but i hope this post may help you

Original comment by mserdars...@gmail.com on 3 Mar 2010 at 10:31