Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #12080

Re: Can someone help ?

From Peter <peterxpercival@hotmail.com>
Newsgroups comp.programming
Subject Re: Can someone help ?
Date 2021-02-06 20:38 +0000
Organization Aioe.org NNTP Server
Message-ID <rvmup2$17s0$1@gioia.aioe.org> (permalink)
References <26347df0-c5f9-41e8-a51c-a5192dc7ac32n@googlegroups.com>

Show all headers | View raw


Kristjan Robam wrote:

Ask https://validator.w3.org/nu/#textarea.

> <html>
> <body>
> <canvas id="canvas" width="800" height="500"></canvas>
> <p></p>
> 
> <div style="display:none;">
> <img id="y"
> src="y.jpg"
> width="800" height="500">
> </div>
> 
> 
> <script>
> const canvas = document.getElementById('canvas');
> const ctx = canvas.getContext('2d');
> const img = document.getElementById('y');
> 
> img.addEventListener('load', e => {
> ctx.drawImage(img, 0, 0);
> var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
> 
> var array1=new Array(4*canvas.width*canvas.height);
> 
> for (var i = 0; i < 4*canvas.width*canvas.height; i++) {
> array1.push(0);
> }
> 
> 
> var r1=Math.round(Math.random()*255);
> var r2=Math.round(Math.random()*255);
> var r3=Math.round(Math.random()*255);
> var r4=Math.round(Math.random()*255);
> 
> for (var i = 0; i < imgData.data.length; i += 4) {
> if(array1[i]==1) continue;
> var a1=imgData.data[i];
> var a2=imgData.data[i+1];
> var a3=imgData.data[i+2];
> var a4=imgData.data[i+3];
> 
> 
> r1=Math.round(Math.random()*255);
> r2=Math.round(Math.random()*255);
> r3=Math.round(Math.random()*255);
> r4=Math.round(Math.random()*1);
> 
> 
> for (var j = i+4; j < imgData.data.length; j += 4) {
> if(array1[j]==1) continue;
> if(a1==imgData.data[j]&&a2==imgData.data[j+1]&&a3==imgData.data[j+2]&&a4==imgData.data[j+3]) {
> imgData.data[j]=r1;
> imgData.data[j+1]=r2;
> imgData.data[j+2]=r3;
> imgData.data[j+3]=r4;
> array1[j]=1;
> console.log(1);
> }
> }
> imgData.data[i]=r1;
> imgData.data[i+1]=r2;
> imgData.data[i+2]=r3;
> imgData.data[i+3]=r4;
> console.log(1);
> }
> 
> ctx.putImageData(imgData, 0, 0);
> });
> 
> 
> </script>
> </body>
> </html>
> 
> The code has some error in it.
> The points of same color will need to get the same random color.
> 
> 
> 
> 
> A I
> 
> E-mail: ya12983 mail co m
> Telephone number: (372) 6861327
> 


-- 
When, once, reference was made to a statesman almost universally
recognized as one of the villains of this century, in order to
induce him to a negative judgment, he replied: "My situation is
so different from his, that it is not for me to pass judgment".
Ernst Specker on Paul Bernays

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Can someone help ? Kristjan Robam <he12457@hotmail.com> - 2021-02-06 07:44 -0800
  Re: Can someone help ? Peter <peterxpercival@hotmail.com> - 2021-02-06 20:38 +0000
    Re: Can someone help ? Robam Kriztjan <he12457@hotmail.com> - 2021-02-08 00:53 -0800
      Re: Can someone help ? Robam Kriztjan <he12457@hotmail.com> - 2021-02-08 01:40 -0800
        Re: Can someone help ? Robam Kriztjan <he12457@hotmail.com> - 2021-02-08 01:54 -0800
          Re: Can someone help ? Peter <peterxpercival@hotmail.com> - 2021-02-08 22:43 +0000
            Re: Can someone help ? Richard Heathfield <rjh@cpax.org.uk> - 2021-02-09 08:14 +0000
              Re: Can someone help ? I A <he12457@hotmail.com> - 2021-02-09 14:07 -0800
                Re: Can someone help ? I A <he12457@hotmail.com> - 2021-02-09 14:44 -0800
                Re: Can someone help ? Peter <peterxpercival@hotmail.com> - 2021-02-10 16:59 +0000
                Re: Can someone help ? I A <he12457@hotmail.com> - 2021-02-10 09:11 -0800
                Re: Can someone help ? David Brown <david.brown@hesbynett.no> - 2021-02-11 12:59 +0100
              Re: Can someone help ? Peter <peterxpercival@hotmail.com> - 2021-02-10 20:05 +0000

csiph-web