Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28382

    I’ve been snowed under with other work but I’ve now been able to look at this again and have some more info on how this can be achieved.

    The major problem is that we can create the canvas content and capture it’s output from a non-browser environment. I’ve discovered the rather lovely envjs library that creates a browser DOM in pure javascript – you can even target different browser implementations. In conjunction with Rhino, it allows you to run browser javascript on the server.

    All we need to do now is emulate the canvas context object as a Java object that creates images – I’m tracking down a library as we speak. This means that the following should work;

    a) Design a rich HTML page with PD4ML tags within it and Canvas graphics
    b) Create a Rhino instance and add to it the envjs and a Canvas context emulator
    c) Run the HTML page through Rhino using an HTML parser and capture the resulting cavas images localy
    d) Run the HTML through PD4ML using the new canvas hook which returns the appropriate image from step c)

    Sounds like a lot, but actually I think this is pretty straightforward from a servlet point of view
    Anyone done this yet?

    Steve

    in reply to: HTML5 Canvas – Anyone working on such a thing for PD4ML?
    #28380

    Excellent, that’s fine by me – when it arrives I’ll put some effort into implementing a tag replacer and let you know how it goes.

    Cheers
    Steve

    in reply to: HTML5 Canvas – Anyone working on such a thing for PD4ML?
    #28378

    I think the plugin idea might well work. I assume that you would also pass to the caller the embedded JS content.

    I admit it’s not trivial, but I think that most code used to generate graphics within a canvas (or all the stuff I would be interested in at least) wouldn’t actually interact with the browsers DOM – it would be calling getContext and then writing directly to that using JS so wouldn’t require DOM access.

    This mechanism wouldn’t be fool-proof but I think it would be possible to create some “rules” for a JS author that make it easier to parse e.g. Perhaps the <canvas> tag has to have an attribute called pd4ml_create which points to the JS function that actually creates the Canvas image.

    when do you think you might have a version available with the plugin?

    Thanks
    Steve

Viewing 3 posts - 1 through 3 (of 3 total)