I tried du manipulate single pixel on the canvas but its not working as I expect it to be. Maybe you could help my with a workaround...
var pixelImageDataImplementation
/* this totally sucks... only half the frames are displayed, causing the pixel to blink */
= {
setup: function (kapiInst, actorInst, params) {
},
draw: function (ctx, kapiInst, actorInst){
var canvas=ctx.canvas;
var canvasWidth = canvas.width;
var canvasHeight = canvas.height;
var canvasData = ctx.getImageData(0, 0, canvasWidth, canvasHeight);
function drawPixel (x, y, w, r, g, b, a, canvasData, ctx) {
var index = (x + y * canvasWidth) * 4;
canvasData.data[index + 0] = r;
canvasData.data[index + 1] = g;
canvasData.data[index + 2] = b;
canvasData.data[index + 3] = a;
ctx.putImageData(canvasData, 0, 0);
}
var color=rgbStringToRgbArray(this.color);
drawPixel(this.x, this.y, canvasWidth,color[0],color[1],color[2],255, canvasData , ctx);
return this;
},
teardown: function (actorName, kapiInst) {
}
}
which worked so far, but causes the pixel to blink..
another try was to draw two 2 pixel long lines and only display the crossing section of one pixel with
But if th crossing section is just a pixel... it isn't displayed. Do you, or anyone else, have any idea how to animate single pixel, or is it just plain stupid to even try?^^