/** * Constructs a Background node with the specified image. If this * image is non-null, it is rendered to the window prior to * drawing any objects in the scene. If the image is smaller * than the window, * then that portion of the window not covered by the image is * filled with the background color. * * @param image pixel array object used as the background image * * @exception IllegalArgumentException if the image class of the specified * ImageComponent2D is ImageClass.NIO_IMAGE_BUFFER. */ public Background(ImageComponent2D image) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); if((image != null) && (image.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) { throw new IllegalArgumentException(J3dI18N.getString("Background14")); } ((BackgroundRetained)this.retained).setImage(image); }
/** * Sets the pixel array used to copy pixels to/from a Canvas3D. * This is used when the type is RASTER_COLOR or RASTER_COLOR_DEPTH. * @param image the ImageComponent2D object containing the * color data */ final void setImage(ImageComponent2D img) { if((img != null) && (img.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) { throw new IllegalArgumentException(J3dI18N.getString("Background14")); } TextureRetained oldTex = this.texture; if (source.isLive()) { if (this.texture != null) { this.texture.clearLive(refCount); } } // Issue 370: only hold the geomLock while calling initImage // (cannot hold it while sending a message). geomLock.getLock(); initImage(img); geomLock.unLock(); if (source.isLive()) { if (texture != null) { texture.setLive(inBackgroundGroup, refCount); } sendChangedMessage((J3dThread.UPDATE_RENDER|J3dThread.UPDATE_RENDERING_ATTRIBUTES), oldTex, this.texture); } }
if (image != null){ ImageComponent2DRetained imageRetained = (ImageComponent2DRetained)image.retained; if (image.getImageClass() != ImageComponent.ImageClass.BUFFERED_IMAGE) { throw new IllegalArgumentException(J3dI18N.getString("GraphicsContext3D33"));
(image.getImageClass() == ImageComponent.ImageClass.NIO_IMAGE_BUFFER)) { throw new IllegalArgumentException(J3dI18N.getString("Background14"));