@@ 557-604 (lines=48) @@ | ||
554 | @example |
|
555 | myimage.drawTile(mycanvas,10,10,0,0,50,50,1,0,1,1); |
|
556 | */ |
|
557 | this.drawPart = function(dst,x,y,partx,party,partw,parth,alpha, rot,zx,zy){ |
|
558 | if(partx<0) { |
|
559 | x-=partx/(this.midhandled==true?2:1); |
|
560 | partw+=partx; |
|
561 | partx=0; |
|
562 | } else { |
|
563 | if (this.midhandled==false) { |
|
564 | partw = Math.min(partw,this.img.width-partx); |
|
565 | } |
|
566 | } |
|
567 | if(party<0) { |
|
568 | y-=party/(this.midhandled==true?2:1); |
|
569 | parth+=party; |
|
570 | party=0; |
|
571 | } else { |
|
572 | if (this.midhandled==false) { |
|
573 | parth = Math.min(parth,this.img.height-party); |
|
574 | } |
|
575 | } |
|
576 | if(partw<=0 || parth<=0){ |
|
577 | return; |
|
578 | } |
|
579 | var tmp=dst.contex.globalAlpha; |
|
580 | if(typeof(alpha)=='undefined') alpha=1; |
|
581 | dst.contex.globalAlpha=alpha; |
|
582 | if(arguments.length==7 || arguments.length==8){ |
|
583 | dst.contex.translate(x,y); |
|
584 | if(this.midhandled==true) dst.contex.translate(-partw/2,-parth/2); else dst.contex.translate(-this.handlex,-this.handley); |
|
585 | dst.contex.drawImage(this.img,partx,party,partw,parth,null,null,partw,parth); |
|
586 | dst.contex.setTransform(1, 0, 0, 1, 0, 0); |
|
587 | } |
|
588 | else if(arguments.length==9){ |
|
589 | dst.contex.translate(x,y); |
|
590 | dst.contex.rotate(rot*Math.PI/180); |
|
591 | if(this.midhandled==true) dst.contex.translate(-partw/2,-parth/2); else dst.contex.translate(-this.handlex,-this.handley); |
|
592 | dst.contex.drawImage(this.img,partx,party,partw,parth,null,null,partw,parth); |
|
593 | dst.contex.setTransform(1, 0, 0, 1, 0, 0); |
|
594 | } |
|
595 | else{ |
|
596 | dst.contex.translate(x,y); |
|
597 | dst.contex.rotate(rot*Math.PI/180); |
|
598 | dst.contex.scale(zx,zy); |
|
599 | if(this.midhandled==true) dst.contex.translate(-partw/2,-parth/2); else dst.contex.translate(-this.handlex,-this.handley); |
|
600 | dst.contex.drawImage(this.img,partx,party,partw,parth,null,null,partw,parth); |
|
601 | dst.contex.setTransform(1, 0, 0, 1, 0, 0); |
|
602 | } |
|
603 | dst.contex.globalAlpha=tmp; |
|
604 | } |
|
605 | ||
606 | ||
607 | ||
@@ 332-379 (lines=48) @@ | ||
329 | @example |
|
330 | mycanvas.drawTile(mycanvas,10,10,0,0,50,50,1,0,1,1); |
|
331 | */ |
|
332 | this.drawPart = function(dst,x,y,partx,party,partw,parth,alpha, rot,zx,zy){ |
|
333 | if(partx<0) { |
|
334 | x-=partx/(this.midhandled==true?2:1); |
|
335 | partw+=partx; |
|
336 | partx=0; |
|
337 | } else { |
|
338 | if (this.midhandled==false) { |
|
339 | partw = Math.min(partw,this.width-partx); |
|
340 | } |
|
341 | } |
|
342 | if(party<0) { |
|
343 | y-=party/(this.midhandled==true?2:1); |
|
344 | parth+=party; |
|
345 | party=0; |
|
346 | } else { |
|
347 | if (this.midhandled==false) { |
|
348 | parth = Math.min(parth,this.height-party); |
|
349 | } |
|
350 | } |
|
351 | if(partw<=0 || parth<=0){ |
|
352 | return; |
|
353 | } |
|
354 | var tmp=dst.contex.globalAlpha; |
|
355 | if(typeof(alpha)=='undefined') alpha=1; |
|
356 | dst.contex.globalAlpha=alpha; |
|
357 | if(arguments.length==7 || arguments.length==8){ |
|
358 | dst.contex.translate(x,y); |
|
359 | if(this.midhandled==true) dst.contex.translate(-partw/2,-parth/2); else dst.contex.translate(-this.handlex,-this.handley); |
|
360 | dst.contex.drawImage(this.canvas,partx,party,partw,parth,0,0,partw,parth); |
|
361 | dst.contex.setTransform(1, 0, 0, 1, 0, 0); |
|
362 | } |
|
363 | else if(arguments.length==9){ |
|
364 | dst.contex.translate(x,y); |
|
365 | dst.contex.rotate(rot*Math.PI/180); |
|
366 | if(this.midhandled==true) dst.contex.translate(-partw/2,-parth/2); else dst.contex.translate(-this.handlex,-this.handley); |
|
367 | dst.contex.drawImage(this.canvas,partx,party,partw,parth,0,0,partw,parth); |
|
368 | dst.contex.setTransform(1, 0, 0, 1, 0, 0); |
|
369 | } |
|
370 | else{ |
|
371 | dst.contex.translate(x,y); |
|
372 | dst.contex.rotate(rot*Math.PI/180); |
|
373 | dst.contex.scale(zx,zy); |
|
374 | if(this.midhandled==true) dst.contex.translate(-partw/2,-parth/2); else dst.contex.translate(-this.handlex,-this.handley); |
|
375 | dst.contex.drawImage(this.canvas,partx,party,partw,parth,0,0,partw,parth); |
|
376 | dst.contex.setTransform(1, 0, 0, 1, 0, 0); |
|
377 | } |
|
378 | dst.contex.globalAlpha=tmp; |
|
379 | } |
|
380 | ||
381 | /** |
|
382 | <b>Set the handle coord of this canvas to the center.</b><br> |