<script>
//getting the canvas context
canvas = getElementById("#canvas");
context = canvas.getCanvasContext("2d");
imageData = context.createImageData(100,100);
//now I call the function put in my C++ NodeJS addon
myFunctionThatFillCanvasWidthPixel(imageData.data); // NB : imageData.data is shown by the debugger as a Uint8ClampedArray
context.putImageData(imageData,0,0);
</script>
<Handle>Value
myFunctionThatFillCanvasWithPixel(const Arguments & args) {
Local<Object> obj = args[0]->ToObject();
unit * pixels = obj->SomeMagick() // I don't know what to do
// Nothing seems to work
for(...) {
pixels[i] = 150; // or whatever value
}
return Undefined() //or whatever that could help me to draw in the canvas
}
--
You received this message because you are subscribed to the Google Groups "appjs-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appjs-dev+...@googlegroups.com.
To post to this group, send email to appj...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hi Cyril,
Maybe you could look into native client for straight chrome. I know it is possible to write games in C++ and have it compiled into the native client. I think it is extremely locked down so no direct access to the users disk but maybe it will give you what you want which seems to be C++ access to a webpage.
I know there is webgl and I have seen various demos of quite cool stuff with javascript and canvas but it might involve a lot of optimisation work in order to get it to run well -- that is a trade off against researching something like native client and seeing if that works well, since that is also a time investment. It might be possible to change your algorithm to reduce the number of loops or to access canvas in a lighter way, but that can be a lot of effort. I know there is something like OpenCL that can also run in the browser .
It might be possible to create your own plugin (so something like flash) that is displayed in a particular part of the webpage, if you are using old internet explorer you can even embed an ActiveX control directly in the page! However these methods are not popular and everyone is trying to move away from them towards html5 instead.
/Simon