Does HTMLUnit include a functional [HTML5] canvas 2D implementation able to render image data back to Java Code?

穿精又带淫゛_ 提交于 2019-12-20 06:22:02

问题


Basically, I'd like to be able to retrieve the HTMl[5] canvas image data created from, normal, JavaScript-based in-browser scripting. I'd like to do this in the context of a screen-scraping-type environment, from within [pure] Java code. HTMLUnit appears to fit some of the requirements.

How would I go about retrieving the canvas-rendered image data, and how complete, or not, might HTMLUnit's canvas implementation currently be (version 2.13 at time of writing)?

Two (2) HTMlUnit classes of note, might be:

com.gargoylesoftware.htmlunit.html.HtmlCanvas com.gargoylesoftware.htmlunit.javascript.host.canvas.CanvasRenderingContext2D


回答1:


Well [answering my own question], as far as can see, no, there is not a functioning HTML Canvas implementation, as of HTMLUnit version 2.13 (November 2013).

Interestingly, it might be useful to integrate the following HTML Canvas (2D) open-source solution into HTMLUnit, in order to render canvas-based graphics:

https://github.com/w3canvas/javacanvas

It should also be possible to create a WebGL canvas context by appropriating the WebGL interface/class code from something like the gwtGL project, and implementing a 3D layer atop of an existing OpenGL 2.0 Java library.

Can I haz some points now?



来源:https://stackoverflow.com/questions/19696932/does-htmlunit-include-a-functional-html5-canvas-2d-implementation-able-to-rend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!