|
30 | 30 |
|
31 | 31 | //绘制图片 |
32 | 32 | Canvas.prototype.drawImg = function(){ |
33 | | - var _this = this; |
34 | | - var img = new Image(); |
35 | | - img.src = '../img/rhino.jpg'; |
| 33 | + var _this = this; |
| 34 | + var img = new Image(); |
| 35 | + img.src = '../img/rhino.jpg'; |
36 | 36 | img.onload = function(){ |
37 | | - //_this.ctx.drawImage(img,0,0); |
38 | | - _this.ctx.transform(1,1,0,1,0,0); |
39 | | - _this.ctx.drawImage(img,50,50,100,100); |
40 | | - //_this.ctx.drawImage(img,10,10,100,100,10,10,100,100); |
41 | | - //_this.ctx.drawImage(img,10,10,100,100,150,150,1000,1000); |
42 | | - |
| 37 | + //_this.ctx.drawImage(img,0,0); |
| 38 | + _this.ctx.transform(1,1,0,1,0,0); |
| 39 | + _this.ctx.drawImage(img,50,50,100,100); |
| 40 | + //_this.ctx.drawImage(img,10,10,100,100,10,10,100,100); |
| 41 | + //_this.ctx.drawImage(img,10,10,100,100,150,150,1000,1000); |
43 | 42 | } |
44 | | - //参数值 |
45 | | - //参数值 描述 |
46 | | - //img 规定要使用的图像、画布或视频。 |
47 | | - //sx 可选。开始剪切的 x 坐标位置。 |
48 | | - //sy 可选。开始剪切的 y 坐标位置。 |
49 | | - //swidth 可选。被剪切图像的宽度。 |
50 | | - //sheight 可选。被剪切图像的高度。 |
51 | | - //x 在画布上放置图像的 x 坐标位置。 |
52 | | - //y 在画布上放置图像的 y 坐标位置。 |
53 | | - //width 可选。要使用的图像的宽度。(伸展或缩小图像) |
54 | | - //height 可选。要使用的图像的高度。(伸展或缩小图像) |
55 | | - |
56 | 43 | } |
57 | 44 |
|
58 | 45 | /** |
|
0 commit comments