0

Let's say i have a image enter image description here

i want to fill this with enter image description here with 25 degree.

i rotate the image in php GD which gave me enter image description here

then when i create a new pattern and apply. i got the enter image description here

below is the code

Html

<h1>sleeve long normal</h1>
 <canvas id="sleevelongnormal" width=436 height=567></canvas>

js

 function doD(var1,var2,var3) //var1=convas var2=img1 var3=img aka design
         {
            // alert(var3);
             t = document.getElementById(''+var1+'');
             ctxt = t.getContext('2d');


              var img1 = new Image();
              var img = new Image();
              img.onload = function () {

              img1.onload = function () {
                  //start();

                   ctxt.drawImage(img1, 0, 0);

                ctxt.globalCompositeOperation = "source-atop";

                var pattern = ctxt.createPattern(img, 'repeat');

                ctxt.rect(0, 0, sourceCanvas.width, sourceCanvas.height);
                ctxt.fillStyle = pattern;

                //var rotation = 90;
                //ctxt.rotate(rotation * Math.PI/180);
                ctxt.fill();

                ctxt.globalAlpha = .10;
                ctxt.drawImage(img1, 0, 0);
                ctxt.drawImage(img1, 0, 0);
                ctxt.drawImage(img1, 0, 0);

                  }
              img1.src = var2;
          }
          img.src = var3;

             //alert(t);
         }

i want to achieve more or less like this enter image description here

MD TAHMID HOSSAIN
  • 1,581
  • 7
  • 29
  • 54

0 Answers0