📄 imgdatajoiner.java
字号:
/** * 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 imageData[c].getCompImgWidth(compIdx[c]); } /** * Returns the height in pixels of the specified component in the * overall image. * * @param n The index of the component, from 0 to N-1. * * @return The height in pixels of component <tt>n</tt> in the overall * image. * * * */ public int getCompImgHeight(int n){ return imageData[n].getCompImgHeight(compIdx[n]); } /** * Returns the number of bits, referred to as the "range bits", * corresponding to the nominal range of the data in the specified * component. If this number is <i>b</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. For floating point data this value is not * applicable. * * @param c The index of the component. * * @return The number of bits corresponding to the nominal range of the * data. Fro floating-point data this value is not applicable and the * return value is undefined. * */ public int getNomRangeBits(int c){ return imageData[c].getNomRangeBits(compIdx[c]); } /** * Returns the position of the fixed point in the specified * component. This is the position of the least significant integral * (i.e. non-fractional) bit, which is equivalent to the number of * fractional bits. For instance, for fixed-point values with 2 fractional * bits, 2 is returned. For floating-point data this value does not apply * and 0 should be returned. Position 0 is the position of the least * significant bit in the data. * * @param c The index of the component. * * @return The position of the fixed-point, which is the same as the * number of fractional bits. For floating-point data 0 is returned. * */ public int getFixedPoint(int c){ return imageData[c].getFixedPoint(compIdx[c]); } /** * 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 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 blk, int c){ return imageData[c].getInternCompData(blk, compIdx[c]); } /** * 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 copy of the internal data, therefore the returned data * can be modified "in place". * * <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' of * the returned data is 0, and the 'scanw' is the same as the block's * width. See the 'DataBlk' class. * * <P>This method, in general, is less efficient than the * 'getInternCompData()' method since, in general, it copies the * data. However if the array of returned data is to be modified by the * caller then this method is preferable. * * <P>If the data array in 'blk' is 'null', then a new one is created. If * the data array is not 'null' then it is reused, and it must be large * enough to contain the block's data. Otherwise an 'ArrayStoreException' * or an 'IndexOutOfBoundsException' is thrown by the Java system. * * <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. If it contains a non-null data array, * then it must be large enough. If it contains a null data array a new * one is created. 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 #getInternCompData * */ public DataBlk getCompData(DataBlk blk, int c){ return imageData[c].getCompData(blk, compIdx[c]); } /** * Changes the current tile, given the new coordinates. An * IllegalArgumentException is thrown if the coordinates do not correspond * to a valid tile. * * @param x The horizontal coordinate of the tile. * * @param y The vertical coordinate of the new tile. * */ public void setTile(int x, int y){ if (x!=0 || y != 0) { throw new IllegalArgumentException(); } } /** * Advances to the next tile, in standard scan-line order (by rows then * columns). A NoNextElementException is thrown if the current tile is the * last one (i.e. there is no next tile). This default implementation * assumes no tiling, so NoNextElementException() is always thrown. * */ public void nextTile() { throw new NoNextElementException(); } /** * Returns the coordinates of the current tile. This default * implementation assumes no-tiling, so (0,0) is returned. * * @param co If not null this object is used to return the information. If * null a new one is created and returned. * * @return The current tile's coordinates. * */ public Coord getTile(Coord co) { if (co != null) { co.x = 0; co.y = 0; return co; } else { return new Coord(0,0); } } /** * Returns the index of the current tile, relative to a standard scan-line * order. This default implementations assumes no tiling, so 0 is always * returned. * * @return The current tile's index (starts at 0). * */ public int getTileIdx() { return 0; } /** * Returns the horizontal coordinate of the upper-left corner of the * specified component in the current tile. * * @param c The component index. * */ public int getCompULX(int c) { return 0; } /** * Returns the vertical coordinate of the upper-left corner of the * specified component in the current tile. * * @param c The component index. * */ public int getCompULY(int c) { return 0; } /** Returns the horizontal tile partition offset in the reference grid */ public int getTilePartULX() { return 0; } /** Returns the vertical tile partition offset in the reference grid */ public int getTilePartULY() { return 0; } /** * Returns the horizontal coordinate of the image origin, the top-left * corner, in the canvas system, on the reference grid. * * @return The horizontal coordinate of the image origin in the canvas * system, on the reference grid. * */ public int getImgULX() { return 0; } /** * Returns the vertical coordinate of the image origin, the top-left * corner, in the canvas system, on the reference grid. * * @return The vertical coordinate of the image origin in the canvas * system, on the reference grid. * */ public int getImgULY() { return 0; } /** * Returns the number of tiles in the horizontal and vertical * directions. This default implementation assumes no tiling, so (1,1) is * always returned. * * @param co If not null this object is used to return the information. If * null a new one is created and returned. * * @return The number of tiles in the horizontal (Coord.x) and vertical * (Coord.y) directions. * */ public Coord getNumTiles(Coord co) { if (co != null) { co.x = 1; co.y = 1; return co; } else { return new Coord(1,1); } } /** * Returns the total number of tiles in the image. This default * implementation assumes no tiling, so 1 is always returned. * * @return The total number of tiles in the image. * */ public int getNumTiles() { return 1; } /** * Returns a string of information about the object, more than 1 line * long. The information string includes information from the several * input ImgData (their toString() method are called one after the other). * * @return A string of information about the object. * */ public String toString() { String string = "ImgDataJoiner: WxH = " + w + "x" + h; for(int i=0; i<nc; i++){ string += "\n- Component "+i+" "+imageData[i]; } return string; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -