Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #12103
| From | Peter <peterxpercival@hotmail.com> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Can someone help ? |
| Date | 2021-02-08 22:43 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <rvsepr$17mg$1@gioia.aioe.org> (permalink) |
| References | <26347df0-c5f9-41e8-a51c-a5192dc7ac32n@googlegroups.com> <rvmup2$17s0$1@gioia.aioe.org> <798d69c6-1bd7-4cf0-a499-f46c36dd3396n@googlegroups.com> <f63cdc30-006c-458a-a48f-732fd3244642n@googlegroups.com> <b0b9bcd7-aa75-44e8-b5dc-9be0617906e3n@googlegroups.com> |
Robam Kriztjan wrote:
> This is something better now:
It is not so much better that https://validator.w3.org/nu/#textarea
reports no errors. Were I you (what an alarming idea) I would fix the
errors (there are three) and the warning too. (When I was a programmer
I always fixed warnings unless there was a very, very, very good reason
not to; and then I would put a comment in the code justifying (let's
hope) my decision not to fix them.)
I recognize that syntactically correct code can still fail to do what
you want of it. If you want help you will need to say precisely what
specification your code is required to fulfil. But note that no one is
obliged to help you, and (this is important) if you behave like an utter
twat even people who are naturally predisposed to help may be unwilling
to do so.
> <html>
> <body>
> <canvas id="canvas" width="346" height="378"></canvas>
> <p></p>
>
> <div style="display:none;">
> <img id="img1"
> src="img.jpg"
> width="346" height="378">
> </div>
>
>
> <script>
> var canvas = document.getElementById('canvas');
> var ctx = canvas.getContext('2d');
> var img = document.getElementById('img1');
>
> 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 < array1.length; i++) {
> array1[i]=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];
>
>
> var r01 = Math.random() < 0.5 ? -1 : 1;
> var r02 = Math.random() < 0.5 ? -1 : 1;
> var r03 = Math.random() < 0.5 ? -1 : 1;
> var r04 = Math.random() < 0.5 ? -1 : 1;
>
> r1=(a1+r01*Math.round(Math.random()*15))%255;
> r2=(a2+r02*Math.round(Math.random()*15))%255;
> r3=(a3+r03*Math.round(Math.random()*15))%255;
> r4=(a4+r04*Math.round(Math.random()*15))%255;
>
>
> 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;
> }
> }
>
> imgData.data[i]=r1;
> imgData.data[i+1]=r2;
> imgData.data[i+2]=r3;
> imgData.data[i+3]=r4;
> }
>
> ctx.putImageData(imgData, 0, 0);
> });
>
>
> </script>
> </body>
> </html>
>
>
> But not what I exactly mean.
>
>
>
>
> 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
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