⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 raster.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * one of: CLIP_POSITION or CLIP_IMAGE.  The default mode     * is CLIP_POSITION.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public void setClipMode(int clipMode) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_CLIP_MODE_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("Raster10"));        ((RasterRetained)this.retained).setClipMode(clipMode);    }    /**     * Retrieves the current clipping mode of this raster object.     * @return clipMode the clipping mode of this raster,     * one of: CLIP_POSITION or CLIP_IMAGE.     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public int getClipMode() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_CLIP_MODE_READ))                throw new CapabilityNotSetException(J3dI18N.getString("Raster11"));        return (((RasterRetained)this.retained).getClipMode());    }    /**     * @deprecated As of Java 3D version 1.3, replaced by     * <code>setSrcOffset(int,int)</code>     */    public void setOffset(int xSrcOffset, int ySrcOffset) {	setSrcOffset(xSrcOffset, ySrcOffset);    }    /**     * @deprecated As of Java 3D version 1.3, replaced by     * <code>setSrcOffset(java.awt.Point)</code>     */    public void setOffset(Point srcOffset) {	setSrcOffset(srcOffset);    }    /**     * @deprecated As of Java 3D version 1.3, replaced by     * <code>getSrcOffset(java.awt.Point)</code>     */    public void getOffset(Point srcOffset) {	getSrcOffset(srcOffset);    }    /**     * Sets the offset within the source array of pixels     * at which to start copying.     * @param xSrcOffset the x offset within the source array of pixels     * at which to start copying     * @param ySrcOffset the y offset within the source array of pixels     * at which to start copying     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public void setSrcOffset(int xSrcOffset, int ySrcOffset) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("Raster7"));        ((RasterRetained)this.retained).setSrcOffset(xSrcOffset, ySrcOffset);    }    /**     * Sets the offset within the source array of pixels     * at which to start copying.     * @param srcOffset the new source pixel offset     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public void setSrcOffset(Point srcOffset) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("Raster7"));        ((RasterRetained)this.retained).setSrcOffset(srcOffset.x, srcOffset.y);    }    /**     * Retrieves the current source pixel offset.     * @param srcOffset the object that will receive the source offset     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public void getSrcOffset(Point srcOffset) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_READ))                throw new CapabilityNotSetException(J3dI18N.getString("Raster8"));        ((RasterRetained)this.retained).getSrcOffset(srcOffset);    }    /**     * Sets the number of pixels to be copied from the pixel array.     * @param width the number of columns in the array of pixels to copy     * @param height the number of rows in the array of pixels to copy     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setSize(int width, int height) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_SIZE_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("Raster9"));        ((RasterRetained)this.retained).setSize(width, height);    }       /**     * Sets the size of the array of pixels to be copied.     * @param size the new size     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void setSize(Dimension size) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_SIZE_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("Raster9"));        ((RasterRetained)this.retained).setSize(size.width, size.height);    }        /**     * Retrieves the current raster size.     * @param size the object that will receive the size     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */    public void getSize(Dimension size) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_SIZE_READ))                throw new CapabilityNotSetException(J3dI18N.getString("Raster1"));          ((RasterRetained)this.retained).getSize(size);    }      /**     * Sets the destination pixel offset of the upper-left corner of     * the rendered image relative to the transformed position.  This     * pixel offset is added to the transformed raster position prior     * to rendering the image.     *     * @param xDstOffset the x coordinate of the new offset     * @param yDstOffset the y coordinate of the new offset     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public void setDstOffset(int xDstOffset, int yDstOffset) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("Raster7"));        ((RasterRetained)this.retained).setDstOffset(xDstOffset, yDstOffset);    }    /**     * Sets the destination pixel offset of the upper-left corner of     * the rendered image relative to the transformed position.  This     * pixel offset is added to the transformed raster position prior     * to rendering the image.     *     * @param dstOffset the new destination pixel offset     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public void setDstOffset(Point dstOffset) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("Raster7"));        ((RasterRetained)this.retained).setDstOffset(dstOffset.x, dstOffset.y);    }    /**     * Retrieves the current destination pixel offset.     * @param dstOffset the object that will receive the destination offset     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @since Java 3D 1.3     */    public void getDstOffset(Point dstOffset) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_OFFSET_READ))                throw new CapabilityNotSetException(J3dI18N.getString("Raster8"));        ((RasterRetained)this.retained).getDstOffset(dstOffset);    }    /**     * 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     *     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     *     * @exception IllegalSharingException if this Raster is live and     * the specified image is being used by a Canvas3D as an off-screen buffer.     *     * @exception IllegalArgumentException if the image class of the specified     * ImageComponent2D is ImageClass.NIO_IMAGE_BUFFER.     *     */      public void setImage(ImageComponent2D image) {                if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_IMAGE_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("Raster3"));                // Do illegal sharing check        if(image != null) {            ImageComponent2DRetained imageRetained = (ImageComponent2DRetained) image.retained;            if(imageRetained.getUsedByOffScreen()) {                if(isLive()) {                    throw new IllegalSharingException(J3dI18N.getString("Raster12"));                }            }        }                ((RasterRetained)this.retained).setImage(image);    }    /**     * Retrieves the current pixel array object.     * @return image the ImageComponent2D object containing the     * color data     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */      public ImageComponent2D getImage() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_IMAGE_READ))                throw new CapabilityNotSetException(J3dI18N.getString("Raster4"));          return (((RasterRetained)this.retained).getImage());    }    /**     * Sets the depth image used to copy pixels to/from a Canvas3D.     * This is used when the type is RASTER_DEPTH or RASTER_COLOR_DEPTH.     * @param depthComponent the DepthComponent object containing the     * depth (z-buffer) data     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */      public void setDepthComponent(DepthComponent depthComponent) {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_DEPTH_COMPONENT_WRITE))                throw new CapabilityNotSetException(J3dI18N.getString("Raster5"));        ((RasterRetained)this.retained).setDepthComponent(depthComponent);    }    /**     * Retrieves the current depth image object.     * @return depthImage DepthComponent containing the     * depth (z-buffer) data     * @exception CapabilityNotSetException if appropriate capability is     * not set and this object is part of live or compiled scene graph     */      public DepthComponent getDepthComponent() {        if (isLiveOrCompiled())            if(!this.getCapability(ALLOW_DEPTH_COMPONENT_READ))                throw new CapabilityNotSetException(J3dI18N.getString("Raster6"));          return (((RasterRetained)this.retained).getDepthComponent());    }      /**     * @deprecated replaced with cloneNodeComponent(boolean forceDuplicate)     */    public NodeComponent cloneNodeComponent() {        Raster r = new Raster();        r.duplicateNodeComponent(this);                   return r;    }    /**     * NOTE: Applications should <i>not</i> call this method directly.     * It should only be called by the cloneNode method.     *     * @deprecated replaced with duplicateNodeComponent(     *  NodeComponent originalNodeComponent, boolean forceDuplicate)     */    public void duplicateNodeComponent(NodeComponent originalNodeComponent) {	checkDuplicateNodeComponent(originalNodeComponent);    }      /**     * Copies all node information from <code>originalNodeComponent</code> into     * the current node.  This method is called from the     * <code>duplicateNode</code> method. This routine does     * the actual duplication of all "local data" (any data defined in     * this object).      *     * @param originalNodeComponent the original node to duplicate.     * @param forceDuplicate when set to <code>true</code>, causes the     *  <code>duplicateOnCloneTree</code> flag to be ignored.  When     *  <code>false</code>, the value of each node's     *  <code>duplicateOnCloneTree</code> variable determines whether     *  NodeComponent data is duplicated or copied.     *     * @see Node#cloneTree     * @see NodeComponent#setDuplicateOnCloneTree     */    void duplicateAttributes(NodeComponent originalNodeComponent, 			     boolean forceDuplicate) {	super.duplicateAttributes(originalNodeComponent, forceDuplicate);	RasterRetained raster = (RasterRetained) originalNodeComponent.retained;	RasterRetained rt = (RasterRetained) retained;	Point3f p = new Point3f();	raster.getPosition(p);	rt.setPosition(p);	rt.setType(raster.getType());	rt.setClipMode(raster.getClipMode());	Point offset = new Point();	raster.getSrcOffset(offset);	rt.setSrcOffset(offset.x, offset.y);	raster.getDstOffset(offset);	rt.setDstOffset(offset.x, offset.y);	Dimension dim = new Dimension();	raster.getSize(dim);	rt.setSize(dim.width, dim.height);	rt.setImage((ImageComponent2D) getNodeComponent(				     raster.getImage(),				     forceDuplicate,				     originalNodeComponent.nodeHashtable));	rt.setDepthComponent((DepthComponent) getNodeComponent(					    raster.getDepthComponent(),					    forceDuplicate,					    originalNodeComponent.nodeHashtable));    } /**    *  This function is called from getNodeComponent() to see if any of   *  the sub-NodeComponents  duplicateOnCloneTree flag is true.    *  If it is the case, current NodeComponent needs to    *  duplicate also even though current duplicateOnCloneTree flag is false.    *  This should be overwrite by NodeComponent which contains sub-NodeComponent.   */   boolean duplicateChild() {      if (getDuplicateOnCloneTree())	return true;      RasterRetained rt = (RasterRetained) retained;      NodeComponent nc = rt.getImage();      if ((nc != null) && nc.getDuplicateOnCloneTree())	return true;      nc = rt.getDepthComponent();      if ((nc != null) && nc.getDuplicateOnCloneTree())	return true;      return false;   }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -