Package javax.media.j3d

Examples of javax.media.j3d.ImageComponent2D

As of Java 3D 1.5, an ImageComponent2D accepts an NioImageBuffer object as an alternative to a RenderedImage.


      String imagePath = this.textureImagesCache.get(key);
      if (imagePath == null) {
        if (texture.getUserData() instanceof URL && transparency == 1) {
          imagePath = texture.getUserData().toString();
        } else {
          ImageComponent2D imageComponent = (ImageComponent2D)texture.getImage(0);
          RenderedImage image = imageComponent.getRenderedImage();
          if (transparency < 1) {
            // Compute a partially transparent image
            BufferedImage transparentImage = new BufferedImage(image.getWidth(),
                image.getHeight(), BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2D = (Graphics2D)transparentImage.getGraphics();
View Full Code Here


    Screen3D screen3D = offScreenCanvas.getScreen3D();
    screen3D.setSize(width, height);
    screen3D.setPhysicalScreenWidth(2f);
    screen3D.setPhysicalScreenHeight(2f / width * height);
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    ImageComponent2D imageComponent2D = new ImageComponent2D(ImageComponent2D.FORMAT_RGB, image);
    imageComponent2D.setCapability(ImageComponent2D.ALLOW_IMAGE_READ);
    offScreenCanvas.setOffScreenBuffer(imageComponent2D);
    return offScreenCanvas;
  }
View Full Code Here

        }
      }
     
      for (Map.Entry<Texture, File> textureEntry : this.textures.entrySet()) {
        Texture texture = textureEntry.getKey();
        ImageComponent2D imageComponent = (ImageComponent2D)texture.getImage(0);
        RenderedImage image = imageComponent.getRenderedImage();
        ImageIO.write(image, "png", textureEntry.getValue());       
      }
    } finally {
      if (writer != null) {
        writer.close();
View Full Code Here

    //Load the image for the texture.
    TextureLoader textureLoad = new TextureLoader("./eas/miscellaneous/java3D/myTexture.jpg",null);

    //Generate a (scaled) image of the texture. Height and width must be
    //powers of 2.
    ImageComponent2D textureIm = textureLoad.getScaledImage(64,128);

    //Generate the texture.
    Texture2D aTexture = new Texture2D(Texture2D.BASE_LEVEL,Texture2D.RGB,
                                            textureIm.getWidth(),
                                            textureIm.getHeight());
    aTexture.setImage(0,textureIm);

    //An Appearance which will use the texture.
    Appearance textureApp = new Appearance();
    textureApp.setTexture(aTexture);
View Full Code Here

            _offScreenCanvas.setOffScreenLocation(location);

            BufferedImage image = new BufferedImage(_frameWidth, _frameHeight,
                    BufferedImage.TYPE_INT_ARGB);

            ImageComponent2D buffer = new ImageComponent2D(
                    ImageComponent.FORMAT_RGBA, image);

            _offScreenCanvas.setOffScreenBuffer(buffer);
            _offScreenCanvas.renderOffScreenBuffer();
            _offScreenCanvas.waitForOffScreenRendering();
View Full Code Here

           
          // chacen
          //saveImage(screen, "screen");
         
          // screen in die textur umwandeln und anzeigen
          ImageComponent2D texImage = new ImageComponent2D(
                  ImageComponent.FORMAT_RGBA4, screen);

          tex = new Texture2D(Texture.BASE_LEVEL, Texture.RGB, 256, 256);
          tex.setImage(0, texImage);
         
View Full Code Here

/* 261 */     offscreenGraphics.setFont(font);
/* 262 */     Color myTextColor = new Color(color.x, color.y, color.z, 1.0F);
/* 263 */     offscreenGraphics.setColor(myTextColor);
/* 264 */     offscreenGraphics.drawString(text, 0, height - descent);
/*     */
/* 266 */     ImageComponent imageComponent = new ImageComponent2D(2, bImage);
/*     */
/* 270 */     imageComponent.setCapability(0);
/*     */
/* 272 */     return imageComponent;
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   public void writeConstructorParams(DataOutput out) throws IOException
/*     */   {
/*  70 */     super.writeConstructorParams(out);
/*  71 */     ImageComponent2D ic = (ImageComponent2D)this.node;
/*     */
/*  77 */     if (ic.isByReference()) {
/*  78 */       ImageComponent2D noByRef = new ImageComponent2D(ic.getFormat(), ic.getRenderedImage(), false, ic.isYUp());
/*     */
/*  80 */       this.bufferedImage = noByRef.getImage(); } else {
/*  81 */       this.bufferedImage = ic.getImage();
/*     */     }
/*  83 */     writeBufferedImage(out, this.bufferedImage);
/*     */   }
View Full Code Here

/*  96 */     return super.createNode(j3dClass, new Class[] { Integer.TYPE, this.bufferedImage.getClass(), Boolean.TYPE, Boolean.TYPE }, new Object[] { new Integer(this.format), this.bufferedImage, new Boolean(this.byReference), new Boolean(this.yUp) });
/*     */   }
/*     */
/*     */   protected SceneGraphObject createNode()
/*     */   {
/* 107 */     return new ImageComponent2D(this.format, this.bufferedImage, this.byReference, this.yUp);
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   public ImageComponent2D getImage()
/*     */   {
/* 522 */     if (this.imageComponent == null) {
/* 523 */       this.imageComponent = new ImageComponent2D(this.imageComponentFormat, this.bufferedImage, this.byRef, this.yUp);
/*     */     }
/* 525 */     return this.imageComponent;
/*     */   }
View Full Code Here

TOP

Related Classes of javax.media.j3d.ImageComponent2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.