📄 imagecomponent3d.java
字号:
* @exception IllegalArgumentException if the width and height of each * image in the images array is not equal to the width and height of this * ImageComponent object. */ public void set(BufferedImage[] images) { checkForLiveOrCompiled(); int depth = ((ImageComponent3DRetained)this.retained).getDepth(); if (depth != images.length) throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D1")); for (int i=0; i<depth; i++) { ((ImageComponent3DRetained)this.retained).set(i, images[i]); } } /** * Sets the array of images in this image component to the * specified array of RenderedImage objects. If the data access * mode is not by-reference, then the RenderedImage data is copied * into this object. If the data access mode is by-reference, * then a shallow copy of the array of references to the * RenderedImage objects is made, but the RenderedImage * data is not necessarily copied. * <p> * The image class is set to ImageClass.RENDERED_IMAGE if the data access * mode is by-reference and any of the specified RenderedImages * is <i>not</i> an instance of BufferedImage. In all other cases, * the image class is set to ImageClass.BUFFERED_IMAGE. * * @param images array of RenderedImage objects containing the image. * The size (width and height) of each image must be the same as the * size of the image component, and the length of the images array * must equal the depth of the image component. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalArgumentException if the length of the images array is * not equal to the depth of this ImageComponent object. * * @exception IllegalArgumentException if the width and height of each * image in the images array is not equal to the width and height of this * ImageComponent object. * * @since Java 3D 1.2 */ public void set(RenderedImage[] images) { checkForLiveOrCompiled(); int depth = ((ImageComponent3DRetained)this.retained).getDepth(); if (depth != images.length) throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D1")); for (int i=0; i<depth; i++) { ((ImageComponent3DRetained)this.retained).set(i, images[i]); } } /** * Sets the array of images in this image component to the * specified array of NioImageBuffer objects. If the data access * mode is not by-reference, then the NioImageBuffer data is copied * into this object. If the data access mode is by-reference, * then a shallow copy of the array of references to the * NioImageBuffer objects is made, but the NioImageBuffer * data is not necessarily copied. * <p> * The image class is set to ImageClass.NIO_IMAGE_BUFFER. * * @param images array of NioImageBuffer objects containing the image. * The size (width and height) of each image must be the same as the * size of the image component, and the length of the images array * must equal the depth of the image component. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if this ImageComponent object * is <i>not</i> yUp. * * @exception IllegalArgumentException if the length of the images array is * not equal to the depth of this ImageComponent object. * * @exception IllegalArgumentException if the width and height of each * image in the images array is not equal to the width and height of this * ImageComponent object. * * @exception UnsupportedOperationException this method is not supported * for Java 3D 1.5. * * @since Java 3D 1.5 */ public void set(NioImageBuffer[] images) { throw new UnsupportedOperationException(); /* checkForLiveOrCompiled(); int depth = ((ImageComponent3DRetained)this.retained).getDepth(); if (depth != images.length) throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D1")); for (int i=0; i<depth; i++) { ((ImageComponent3DRetained)this.retained).set(i, images[i]); } */ } /** * Sets this image component at the specified index to the * specified BufferedImage object. If the data access mode is not * by-reference, then the BufferedImage data is copied into this * object. If the data access mode is by-reference, then a * reference to the BufferedImage is saved, but the data is not * necessarily copied. * * @param index the image index. * The index must be less than the depth of this ImageComponent3D object. * * @param image BufferedImage object containing the image. * The size (width and height) must be the same as the current size of this * ImageComponent3D object. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the image class is not * ImageClass.BUFFERED_IMAGE. * * @exception IllegalArgumentException if the width and height the image * is not equal to the width and height of this ImageComponent object. */ public void set(int index, BufferedImage image) { checkForLiveOrCompiled(); if (image.getWidth(null) != this.getWidth()) throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D2")); if (image.getHeight(null) != this.getHeight()) throw new IllegalArgumentException(J3dI18N.getString("ImageComponent3D4")); ((ImageComponent3DRetained)this.retained).set(index, image); } /** * Sets this image component at the specified index to the * specified RenderedImage object. If the data access mode is not * by-reference, then the RenderedImage data is copied into this * object. If the data access mode is by-reference, then a * reference to the RenderedImage is saved, but the data is not * necessarily copied. * * @param index the image index. * The index must be less than the depth of this ImageComponent3D object. * * @param image RenderedImage object containing the image. * The size (width and height) must be the same as the current size of this * ImageComponent3D object. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the image class is not one of: * ImageClass.BUFFERED_IMAGE or ImageClass.RENDERED_IMAGE. * * @exception IllegalArgumentException if the width and height the image * is not equal to the width and height of this ImageComponent object. * * @since Java 3D 1.2 */ public void set(int index, RenderedImage image) { checkForLiveOrCompiled(); // For RenderedImage the width and height checking is done in the retained. ((ImageComponent3DRetained)this.retained).set(index, image); } /** * Sets this image component at the specified index to the * specified NioImageBuffer object. If the data access mode is not * by-reference, then the NioImageBuffer data is copied into this * object. If the data access mode is by-reference, then a * reference to the NioImageBuffer is saved, but the data is not * necessarily copied. * * @param index the image index. * The index must be less than the depth of this ImageComponent3D object. * * @param image NioImageBuffer object containing the image. * The size (width and height) must be the same as the current size of this * ImageComponent3D object. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the image class is not * ImageClass.NIO_IMAGE_BUFFER. * * @exception IllegalArgumentException if the width and height the image * is not equal to the width and height of this ImageComponent object. * * @exception UnsupportedOperationException this method is not supported * for Java 3D 1.5. * * @since Java 3D 1.5 */ public void set(int index, NioImageBuffer image) { throw new UnsupportedOperationException(); /* checkForLiveOrCompiled(); // For NioImageBuffer the width and height checking is done in the retained. ((ImageComponent3DRetained)this.retained).set(index, image); */ } /** * Retrieves the images from this ImageComponent3D object. If the * data access mode is not by-reference, then a copy of the images * is made. If the data access mode is by-reference, then the * references are returned. * * @return either a new array of new BufferedImage objects created from * the data * in this image component, or a new array of * references to the BufferedImages that this image component refers to. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the image class is not * ImageClass.BUFFERED_IMAGE. */ public BufferedImage[] getImage() { if (isLiveOrCompiled()) if(!this.getCapability(ImageComponent.ALLOW_IMAGE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("ImageComponent3D3")); return ((ImageComponent3DRetained)this.retained).getImage(); } /** * Retrieves the images from this ImageComponent3D object. If the * data access mode is not by-reference, then a copy of the images * is made. If the data access mode is by-reference, then the * references are returned. * * @return either a new array of new RenderedImage objects created from * the data * in this image component, or a new array of * references to the RenderedImages that this image component refers to. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the image class is not one of: * ImageClass.BUFFERED_IMAGE or ImageClass.RENDERED_IMAGE. * * @since Java 3D 1.2 */ public RenderedImage[] getRenderedImage() { if (isLiveOrCompiled()) if(!this.getCapability(ImageComponent.ALLOW_IMAGE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("ImageComponent3D3")); return ((ImageComponent3DRetained)this.retained).getRenderedImage(); } /** * Retrieves the images from this ImageComponent3D object. If the * data access mode is not by-reference, then a copy of the images * is made. If the data access mode is by-reference, then the * references are returned. * * @return either a new array of new RenderedImage objects created from * the data * in this image component, or a new array of * references to the RenderedImages that this image component refers to. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the image class is not * ImageClass.NIO_IMAGE_BUFFER. * * @exception UnsupportedOperationException this method is not supported * for Java 3D 1.5. * * @since Java 3D 1.5 */ public NioImageBuffer[] getNioImage() { throw new UnsupportedOperationException(); } /** * Retrieves one of the images from this ImageComponent3D object. If the * data access mode is not by-reference, then a copy of the image * is made. If the data access mode is by-reference, then the * reference is returned. * * @param index the index of the image to retrieve. * The index must be less than the depth of this ImageComponent3D object. * * @return either a new BufferedImage object created from the data * in this image component, or the BufferedImage object referenced * by this image component. * * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph * * @exception IllegalStateException if the image class is not * ImageClass.BUFFERED_IMAGE. */ public BufferedImage getImage(int index) { if (isLiveOrCompiled()) if(!this.getCapability(ImageComponent.ALLOW_IMAGE_READ)) throw new CapabilityNotSetException(J3dI18N.getString("ImageComponent3D3")); RenderedImage img = ((ImageComponent3DRetained)this.retained).getImage(index); if ((img != null) && !(img instanceof BufferedImage)) { throw new IllegalStateException(J3dI18N.getString("ImageComponent3D9")); } return (BufferedImage) img; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -