Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > alt.comp.lang.javascript > #20

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

Newsgroups alt.comp.lang.javascript
Date 2020-11-21 09:41 -0800
References <7d9bb0bf-0d27-4786-b7ae-665f35b8abbcn@googlegroups.com>
Message-ID <0c602bfa-360f-4c7c-976c-05bdcab79257n@googlegroups.com> (permalink)
Subject Re: All given colors to picture, so that neighbor color total difference is minimum
From Aman Livinginviljandicity <he12457@hotmail.com>

Show all headers | View raw


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

Back to alt.comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

All given colors to picture, so that neighbor color total difference is minimum Aman Livinginviljandicity <he12457@hotmail.com> - 2020-11-21 09:39 -0800
  Re: All given colors to picture, so that neighbor color total difference is minimum Aman Livinginviljandicity <he12457@hotmail.com> - 2020-11-21 09:41 -0800
    Re: All given colors to picture, so that neighbor color total difference is minimum Aman Livinginviljandicity <he12457@hotmail.com> - 2020-11-21 09:58 -0800
      Re: All given colors to picture, so that neighbor color total difference is minimum Aman Livinginviljandicity <he12457@hotmail.com> - 2020-11-21 10:17 -0800

csiph-web