Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8092041

Write Only Image / Accumulation Buffer

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:

      Description

      I want the ability to draw a node (or graph of nodes) into a buffer. This can currently be done by calling paint on the underlying SGNode with a BufferedImage's graphics context. I'd like a real API for this that can be easily hardware accelerated.

      requirements:
      * paints a node into an image. can paint a graph of nodes by nesting nodes inside of a group
      * not required to paint a whole scene into an image
      * not required to paint nodes which are already in a scene. can be restricted only to headless nodes
      * can draw into the image multiple times, compositing against current contents
      * can set a blend mode to use when compositing against current contents
      * can be cleared
      * does not allow direct access to the pixels (no getPixel(x,y) function), this allows for better hw acceleration since all operations can be done in the card with no texture readbacks.
      * images should be independent so we can swap them in and out of ImageViews (for use with creating live trails and other time based effects)

      API proposal:

      javafx.scene.image.WriteOnlyImage extends Image {
      public-init var width:Integer;
      public-init var height:Integer;
      // make fully transparent. erase all pixels.
      public function clear():Void;
      // draw node into buffer
      public function draw(node:Node):Void;
      // draw node using blend mode
      public function draw(node:Node, mode:BlendMode):Void;
      }

      example usage:

      var nodes = Group { content: [ Rectangle { }, ImageView{image:Image{}}, Circle{} ] };
      var buffer = WriteOnlyImage { width: 100 height: 100 };
      buffer.draw(nodes);
      var view = ImageView { image: buffer };

      Stage {
      scene: Scene {
      content: view
      }
      }

        Attachments

          Activity

            People

            • Assignee:
              kcr Kevin Rushforth
              Reporter:
              jmarinacsunw Joshua Marinacci (Inactive)
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: