News for hackers. Stuff that matters.
Re:C64 Keyboard Prototype by egeozcan on Thursday May 03, 2018 @02:29PM (#16988457)

    var canvas = document.getElementById('canvas');
    var ctx = canvas.getContext('2d');
    
    ctx.fillStyle = `rgb(${r}, ${g}, ${b})`;
    ctx.fillRect(x, y, 1, 1);
I say it's pretty close.
Re:C64 Keyboard Prototype by codeflo on Thursday May 03, 2018 @03:49PM (#16989258)
It's pretty amazing to me that in 2018, the way we pass colors to a modern graphics API is to build a string with comma separated list of the individual components encoded in decimal.

And then people wonder why computers feel slower than they did 15 years ago.

Re:C64 Keyboard Prototype by egeozcan on Friday May 04, 2018 @05:56AM (#16993366)
Legacy APIs for DOM are hard to get rid of, which the Canvas API is based on. There is some progress though: https://developers.google.com/web/updates/2018/03/cssom
Re:C64 Keyboard Prototype by sp332 on Thursday May 03, 2018 @03:48PM (#16989234)
You can save this as an HTML file:

  <canvas id="canvas" width="400" height="400"></canvas>

  <script>
  var canvas = document.getElementById('canvas');
  var ctx = canvas.getContext('2d');
  var width = canvas.width;
  var height = canvas.height;
  var imagedata = ctx.createImageData(width, height);

  function draw(r, g, b, x, y){
    var pixelindex = (y * width + x) * 4;
    imagedata.data[pixelindex] = r;
    imagedata.data[pixelindex+1] = g;
    imagedata.data[pixelindex+2] = b;
    imagedata.data[pixelindex+3] = 255; //alpha
    ctx.putImageData(imagedata, 0, 0);
  }

  </script>
This gives you a 400x400 space to draw on. Open the console and call draw().

  draw(0,0,0,15,15);
Re:C64 Keyboard Prototype by qualitytime on Thursday May 03, 2018 @03:07PM (#16988864)
LOL, not even close.