palettizedcolorspacemapper.java

来自「jpeg2000编解码」· Java 代码 · 共 414 行 · 第 1/2 页

JAVA
414
字号
        StringBuffer body = new StringBuffer("  "+eol);                if (pbox!=null) {            body .append ("ncomps= ") .append (getNumComps())                 .append (", scomp= ") .append (srcChannel);            for (c=0; c<getNumComps(); ++c) {                body .append(eol)                    .append("column= ") .append(c)                     .append(", ") .append(pbox.getBitDepth(c)) .append(" bit ")                    .append(pbox.isSigned(c)?"signed entry":"unsigned entry"); 	    }	} else {             body.append ("image does not contain a palette box"); }                rep.append(ColorSpace.indent("  ",body));        return rep.append("]").toString(); }    /**     * Returns, in the blk argument, a block of image data containing the     * specifed rectangular area, in the specified component. The data is     * returned, as a reference to the internal data, if any, instead of as a     * copy, therefore the returned data should not be modified.     *     * <P>The rectangular area to return is specified by the 'ulx', 'uly', 'w'     * and 'h' members of the 'blk' argument, relative to the current     * tile. These members are not modified by this method. The 'offset' and     * 'scanw' of the returned data can be arbitrary. See the 'DataBlk' class.     *     * <P>This method, in general, is more efficient than the 'getCompData()'     * method since it may not copy the data. However if the array of returned     * data is to be modified by the caller then the other method is probably     * preferable.     *     * <P>If possible, the data in the returned 'DataBlk' should be the     * internal data itself, instead of a copy, in order to increase the data     * transfer efficiency. However, this depends on the particular     * implementation (it may be more convenient to just return a copy of the     * data). This is the reason why the returned data should not be modified.     *     * <P>If the data array in <tt>blk</tt> is <tt>null</tt>, then a new one     * is created if necessary. The implementation of this interface may     * choose to return the same array or a new one, depending on what is more     * efficient. Therefore, the data array in <tt>blk</tt> prior to the     * method call should not be considered to contain the returned data, a     * new array may have been created. Instead, get the array from     * <tt>blk</tt> after the method has returned.     *     * <P>The returned data may have its 'progressive' attribute set. In this     * case the returned data is only an approximation of the "final" data.     *     * @param blk Its coordinates and dimensions specify the area to return,     * relative to the current tile. Some fields in this object are modified     * to return the data.     *     * @param c The index of the component from which to get the data.     *     * @return The requested DataBlk     *      * @see #getCompData     */    public DataBlk getInternCompData (DataBlk out, int c) {	return getCompData(out, c);    }    /**     * Returns the number of bits, referred to as the "range bits",     * corresponding to the nominal range of the image data in the specified     * component. If this number is <i>n</b> then for unsigned data the     * nominal range is between 0 and 2^b-1, and for signed data it is between     * -2^(b-1) and 2^(b-1)-1. In the case of transformed data which is not in     * the image domain (e.g., wavelet coefficients), this method returns the     * "range bits" of the image data that generated the coefficients.     *     * @param c The index of the component.     *     * @return The number of bits corresponding to the nominal range of the     * image data (in the image domain).     */    public int getNomRangeBits(int c) {        return pbox==null?            src.getNomRangeBits(c):            pbox.getBitDepth(c); }    /**     * Returns the number of components in the image.     *     * @return The number of components in the image.     */    public int getNumComps() {        return pbox==null? src.getNumComps(): pbox.getNumColumns(); }    /**     * Returns the component subsampling factor in the horizontal direction,     * for the specified component. This is, approximately, the ratio of     * dimensions between the reference grid and the component itself, see the     * 'ImgData' interface desription for details.     *     * @param c The index of the component (between 0 and N-1)     *     * @return The horizontal subsampling factor of component 'c'     *     * @see jj2000.j2k.image.ImgData     * */    public int getCompSubsX(int c) {        return imgdatasrc.getCompSubsX(srcChannel); }    /**     * Returns the component subsampling factor in the vertical direction, for     * the specified component. This is, approximately, the ratio of     * dimensions between the reference grid and the component itself, see the     * 'ImgData' interface desription for details.     *     * @param c The index of the component (between 0 and N-1)     *     * @return The vertical subsampling factor of component 'c'     *     * @see jj2000.j2k.image.ImgData     * */    public int getCompSubsY(int c) {        return imgdatasrc.getCompSubsY(srcChannel); }    /**     * Returns the width in pixels of the specified tile-component     *     * @param t Tile index     *     * @param c The index of the component, from 0 to N-1.     *     * @return The width in pixels of component <tt>c</tt> in tile<tt>t</tt>.     * */    public int getTileCompWidth(int t,int c) {        return imgdatasrc.getTileCompWidth(t, srcChannel); }    /**     * Returns the height in pixels of the specified tile-component.     *     * @param t The tile index.     *     * @param c The index of the component, from 0 to N-1.     *     * @return The height in pixels of component <tt>c</tt> in tile     * <tt>t</tt>.     * */    public int getTileCompHeight(int t,int c) {        return imgdatasrc.getTileCompHeight(t, srcChannel); }    /**     * Returns the width in pixels of the specified component in the overall     * image.     *     * @param c The index of the component, from 0 to N-1.     *     * @return The width in pixels of component <tt>c</tt> in the overall     * image.     * */    public int getCompImgWidth(int c) {        return imgdatasrc.getCompImgWidth(srcChannel); }    /**     * Returns the number of bits, referred to as the "range bits",     * corresponding to the nominal range of the image data in the specified     * component. If this number is <i>n</b> then for unsigned data the     * nominal range is between 0 and 2^b-1, and for signed data it is between     * -2^(b-1) and 2^(b-1)-1. In the case of transformed data which is not in     * the image domain (e.g., wavelet coefficients), this method returns the     * "range bits" of the image data that generated the coefficients.     *     * @param c The index of the component.     *     * @return The number of bits corresponding to the nominal range of the     * image data (in the image domain).     * */    public int getCompImgHeight(int c) {        return imgdatasrc.getCompImgHeight(srcChannel); }    /**     * Returns the horizontal coordinate of the upper-left corner of the     * specified component in the current tile.     *     * @param c The index of the component.     * */    public int getCompULX(int c) {        return imgdatasrc.getCompULX(srcChannel); }    /**     * Returns the vertical coordinate of the upper-left corner of the     * specified component in the current tile.     *     * @param c The index of the component.     * */    public int getCompULY(int c) {        return imgdatasrc.getCompULY(srcChannel); }    /* end class PalettizedColorSpaceMapper */ }

⌨️ 快捷键说明

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