Example usage for javax.media.j3d ImageComponent FORMAT_RGB8

List of usage examples for javax.media.j3d ImageComponent FORMAT_RGB8

Introduction

In this page you can find the example usage for javax.media.j3d ImageComponent FORMAT_RGB8.

Prototype

int FORMAT_RGB8

To view the source code for javax.media.j3d ImageComponent FORMAT_RGB8.

Click Source Link

Document

Specifies that each pixel contains 3 8-bit channels: one each for red, green, blue.

Usage

From source file:SwingTest.java

/**
 * Initialize an offscreen Canvas3D./*from  www  .ja  v  a 2 s  . c  o  m*/
 */
protected Canvas3D createOffscreenCanvas3D() {
    offScreenCanvas3D = createCanvas3D(true);
    offScreenCanvas3D.getScreen3D().setSize(offScreenWidth, offScreenHeight);
    offScreenCanvas3D.getScreen3D().setPhysicalScreenHeight(0.0254 / 90 * offScreenHeight);
    offScreenCanvas3D.getScreen3D().setPhysicalScreenWidth(0.0254 / 90 * offScreenWidth);

    RenderedImage renderedImage = new BufferedImage(offScreenWidth, offScreenHeight,
            BufferedImage.TYPE_3BYTE_BGR);
    imageComponent = new ImageComponent2D(ImageComponent.FORMAT_RGB8, renderedImage);
    imageComponent.setCapability(ImageComponent2D.ALLOW_IMAGE_READ);
    offScreenCanvas3D.setOffScreenBuffer(imageComponent);

    return offScreenCanvas3D;
}