2 Replies Latest reply: Dec 1, 2008 7:38 PM by 843851 RSS

    CreateImage in OCAP

    843851
      I am working on adding double buffering on an OCAP box. All the online examples of this in AWT that I have seen use something along the lines of:
      Image buffer = (new Panel()).createImage(width, height);
      Graphics offscreen = buffer.getGraphics();
      ... draw stuff to offscreen ...
      onscreen.drawImage(buffer, x, y, null);
      The issue I'm having is that Panel isn't an implemented type in OCAP. How can I do this in OCAP?

      Edited by: DavidKerk on Nov 7, 2008 9:08 PM
        • 1. Re: CreateImage in OCAP
          843851
          This has to be done using an HScene object. Construct one using HSceneFactory.
          • 2. Re: CreateImage in OCAP
            843851
            org.dvb.ui.DVBBufferedImage is what you want. About the other reply on this thread - I don't know of a createImage method tied to HScene.

            Anyway, if you're doing double-buffering you might be interested in the double-buffered animation framework in the HD cookbook project. Despite the Blu-ray association, it absolutely works with OCAP. In fact, the first version of the GRIN framework (out of which came the now-separable animation framework) was first run on a Canal+ MHP STB, so that code has been around the block, GEM-compatibility-wise.

            Anyway, if an animation framework would be helpful, check out https://hdcookbook.dev.java.net, particularly https://hdcookbook.dev.java.net/animator.html .

            Cheers,

            Bill