Example usage for javax.media.j3d ImageComponent ALLOW_SIZE_READ

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

Introduction

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

Prototype

int ALLOW_SIZE_READ

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

Click Source Link

Document

Specifies that this ImageComponent object allows reading its size component information (width, height, and depth).

Usage

From source file:RasterTest.java

public RasterTest() {
    // create the image to be rendered using a Raster
    BufferedImage bufferedImage = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB);
    ImageComponent2D imageComponent2D = new ImageComponent2D(ImageComponent2D.FORMAT_RGB, bufferedImage);
    imageComponent2D.setCapability(ImageComponent.ALLOW_IMAGE_READ);
    imageComponent2D.setCapability(ImageComponent.ALLOW_SIZE_READ);

    // create the depth component to store the 3D depth values
    DepthComponentInt depthComponent = new DepthComponentInt(m_kWidth, m_kHeight);
    depthComponent.setCapability(DepthComponent.ALLOW_DATA_READ);

    // create the Raster for the image
    m_RenderRaster = new Raster(new Point3f(0.0f, 0.0f, 0.0f), Raster.RASTER_COLOR, 0, 0,
            bufferedImage.getWidth(), bufferedImage.getHeight(), imageComponent2D, null);

    m_RenderRaster.setCapability(Raster.ALLOW_IMAGE_WRITE);
    m_RenderRaster.setCapability(Raster.ALLOW_SIZE_READ);

    // create the Raster for the depth components
    m_DepthRaster = new Raster(new Point3f(0.0f, 0.0f, 0.0f), Raster.RASTER_DEPTH, 0, 0, m_kWidth, m_kHeight,
            null, depthComponent);/*  w w  w  .java2  s .  c  om*/

    initJava3d();
}

From source file:HiResCoordTest.java

private Shape3D createLabel(String szText, float x, float y, float z) {
    BufferedImage bufferedImage = new BufferedImage(50, 20, BufferedImage.TYPE_INT_RGB);
    Graphics g = bufferedImage.getGraphics();
    g.setColor(Color.white);//from   w w w . j ava  2 s  . c  o  m
    g.drawString(szText, 10, 10);

    ImageComponent2D imageComponent2D = new ImageComponent2D(ImageComponent2D.FORMAT_RGB, bufferedImage);
    imageComponent2D.setCapability(ImageComponent.ALLOW_IMAGE_READ);
    imageComponent2D.setCapability(ImageComponent.ALLOW_SIZE_READ);

    // create the Raster for the image
    javax.media.j3d.Raster renderRaster = new javax.media.j3d.Raster(new Point3f(x, y, z),
            javax.media.j3d.Raster.RASTER_COLOR, 0, 0, bufferedImage.getWidth(), bufferedImage.getHeight(),
            imageComponent2D, null);

    return new Shape3D(renderRaster);
}