Re: All given colors to picture, so that neighbor color total difference is minimum

Aman Livinginviljandicity <[email protected]> Sat, 21 Nov 2020 09:41:15 -0800 (PST)
Newsgroups alt.comp.lang.javascript
Message-ID <[email protected]>
Here is my startpoint code for those, who would like to help me with programming it.

<html>
<body>
<canvas id="canvas" width="2000" height="1100"></canvas>

<script>

function draw() {
  var ctx = document.getElementById('canvas').getContext('2d');
  var a=new Array();
  for (var i = 0; i < 256; i=i+2) {
    for (var j = 0; j < 256; j=j+2) {
       for (var k = 0; k < 256; k=k+1) {
          a.push('rgb(' + i + ', ' + j + ', '+k+')');
      }
    }
  }
  var c1=0;

  for (var i = 0; i < 2000; i++) {
    for (var j = 0; j < 1100; j++) {
       
       ctx.fillStyle=a[c1];
       ctx.fillRect(i,j,1,1);
       c1++;
    }
  } 
}

draw();

</script>
</body>
</html>

Khristjan Robam
Phone number: 372 57865442
E-mail: he12457 hotmail com