public class RenderedImageSrc extends java.lang.Object implements BlkImgDataSrc
Constructor and Description |
---|
RenderedImageSrc(java.awt.image.Raster raster,
J2KImageWriteParamJava param,
J2KImageWriter writer)
Creates
RenderedImageSrc for encoding a Raster . |
RenderedImageSrc(java.awt.image.RenderedImage src,
J2KImageWriteParamJava param,
J2KImageWriter writer)
Creates
RenderedImageSrc for encoding a
RenderedImage . |
Modifier and Type | Method and Description |
---|---|
DataBlk |
getCompData(DataBlk blk,
int c)
Returns, in the blk argument, a block of image data containing the
specifed rectangular area, in the specified component.
|
int |
getCompHeight(int c)
Returns the height in pixels of the specified component in the current
tile.
|
int |
getCompImgHeight(int c)
Returns the height in pixels of the specified component in the overall
image.
|
int |
getCompImgWidth(int c)
Returns the width in pixels of the specified component in the overall
image.
|
int |
getCompSubsX(int c)
Returns the component subsampling factor in the horizontal direction,
for the specified component.
|
int |
getCompSubsY(int c)
Returns the component subsampling factor in the vertical direction, for
the specified component.
|
int |
getCompULX(int c)
Returns the horizontal coordinate of the upper-left corner of the
active tile, with respect to the canvas origin, in the component
coordinates, for the specified component.
|
int |
getCompULY(int c)
Returns the vertical coordinate of the upper-left corner of the active
tile, with respect to the canvas origin, in the component coordinates,
for the specified component.
|
int |
getCompWidth(int n)
Returns the width in pixels of the specified component in the current
tile.
|
int |
getFixedPoint(int c)
Returns the position of the fixed point in the specified component
(i.e.
|
int |
getImgHeight()
Returns the overall height of the image in pixels.
|
int |
getImgULX()
Returns the horizontal coordinate of the image origin, the top-left
corner, in the canvas system, on the reference grid.
|
int |
getImgULY()
Returns the vertical coordinate of the image origin, the top-left
corner, in the canvas system, on the reference grid.
|
int |
getImgWidth()
Returns the overall width of the image in pixels.
|
DataBlk |
getInternCompData(DataBlk blk,
int c)
Returns, in the blk argument, the block of image data containing the
specifed rectangular area, in the specified component.
|
int |
getNomRangeBits(int c)
Returns the number of bits corresponding to the nominal range of the
data in the specified component.
|
int |
getNomTileHeight()
Returns the nominal tiles height
|
int |
getNomTileWidth()
Returns the nominal tiles width
|
int |
getNumComps()
Returns the number of components in the image.
|
int |
getNumTiles()
Returns the total number of tiles in the image.
|
java.awt.Point |
getNumTiles(java.awt.Point co)
Returns the number of tiles in the horizontal and vertical
directions.
|
java.awt.Point |
getTile(java.awt.Point co)
Returns the coordinates of the current tile.
|
int |
getTileCompHeight(int t,
int c)
Returns the height in pixels of the specified tile-component.
|
int |
getTileCompWidth(int t,
int c)
Returns the width in pixels of the specified tile-component
|
int |
getTileGridXOffset() |
int |
getTileGridYOffset() |
int |
getTileHeight()
Returns the overall height of the current tile in pixels.
|
int |
getTileIdx()
Returns the index of the current tile, relative to a standard scan-line
order.
|
java.awt.Point |
getTileOff(java.awt.Point p,
int c)
Returns the horizontal and vertical offset of the upper-left corner of
the current tile, in the specified component, relative to the canvas
origin, in the component coordinates (not in the reference grid
coordinates).
|
int |
getTilePartULX()
Returns the horizontal tile partition offset in the reference grid
|
int |
getTilePartULY()
Returns the vertical tile partition offset in the reference grid
|
int |
getTileWidth()
Returns the width of the current tile in pixels.
|
boolean |
isOrigSigned(int c)
Returns true if the data read was originally signed in the specified
component, false if not.
|
void |
nextTile()
Advances to the next tile, in standard scan-line order (by rows then
columns).
|
void |
setTile(int x,
int y)
Changes the current tile, given the new coordinates.
|
public RenderedImageSrc(java.awt.image.Raster raster, J2KImageWriteParamJava param, J2KImageWriter writer)
RenderedImageSrc
for encoding a Raster
.raster
- The Raster
to be encoded.param
- The J2KImageWriteParamJava
used in encoding.writer
- The J2KImageWriter
performs the encoding.IOException
- If an error occurs while opening the file.public RenderedImageSrc(java.awt.image.RenderedImage src, J2KImageWriteParamJava param, J2KImageWriter writer)
RenderedImageSrc
for encoding a
RenderedImage
.src
- The RenderedImage
to be encoded.param
- The J2KImageWriteParamJava
used in encoding.writer
- The J2KImageWriter
performs the encoding.IOException
- If an error occurs while opening the file.public int getTilePartULX()
ImgData
getTilePartULX
in interface ImgData
public int getTilePartULY()
ImgData
getTilePartULY
in interface ImgData
public int getTileWidth()
getTileWidth
in interface ImgData
public int getTileHeight()
getTileHeight
in interface ImgData
public int getNomTileWidth()
ImgData
getNomTileWidth
in interface ImgData
public int getNomTileHeight()
ImgData
getNomTileHeight
in interface ImgData
public int getImgWidth()
getImgWidth
in interface ImgData
public int getImgHeight()
getImgHeight
in interface ImgData
public int getNumComps()
getNumComps
in interface ImgData
public int getTileGridXOffset()
public int getTileGridYOffset()
public int getTileCompHeight(int t, int c)
ImgData
getTileCompHeight
in interface ImgData
t
- The tile index.c
- The index of the component, from 0 to N-1.public int getTileCompWidth(int t, int c)
ImgData
getTileCompWidth
in interface ImgData
t
- Tile indexc
- The index of the component, from 0 to N-1.public int getCompSubsX(int c)
getCompSubsX
in interface ImgData
c
- The index of the component (between 0 and C-1)ImgData
public int getCompSubsY(int c)
getCompSubsY
in interface ImgData
c
- The index of the component (between 0 and C-1)ImgData
public int getCompWidth(int n)
c
- The index of the component, from 0 to C-1.public int getCompHeight(int c)
c
- The index of the component, from 0 to C-1.public int getCompImgWidth(int c)
getCompImgWidth
in interface ImgData
c
- The index of the component, from 0 to C-1.public int getCompImgHeight(int c)
getCompImgHeight
in interface ImgData
c
- The index of the component, from 0 to C-1.public void setTile(int x, int y)
public void nextTile()
public java.awt.Point getTile(java.awt.Point co)
public int getTileIdx()
getTileIdx
in interface ImgData
public java.awt.Point getTileOff(java.awt.Point p, int c)
co
- If not null the object is used to return the values, if null
a new one is created and returned.c
- The index of the component (between 0 and C-1)public int getCompULX(int c)
getCompULX
in interface ImgData
c
- The index of the component (between 0 and C-1)public int getCompULY(int c)
getCompULY
in interface ImgData
c
- The index of the component (between 0 and C-1)public int getImgULX()
public int getImgULY()
public java.awt.Point getNumTiles(java.awt.Point co)
getNumTiles
in interface ImgData
co
- If not null this object is used to return the information. If
null a new one is created and returned.public int getNumTiles()
getNumTiles
in interface ImgData
public int getNomRangeBits(int c)
If this number is b then the nominal range is between -2^(b-1) and 2^(b-1)-1, since unsigned data is level shifted to have a nominal avergae of 0.
getNomRangeBits
in interface ImgData
c
- The index of the component.public int getFixedPoint(int c)
getFixedPoint
in interface BlkImgDataSrc
c
- The index of the component.public final DataBlk getInternCompData(DataBlk blk, int c)
After being read the coefficients are level shifted by subtracting 2^(nominal bit range - 1)
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.
If the data array in blk is null, 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 blk 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 blk after the method has returned.
The returned data always has its 'progressive' attribute unset (i.e. false).
When an I/O exception is encountered the JJ2KExceptionHandler is used. The exception is passed to its handleException method. The action that is taken depends on the action that has been registered in JJ2KExceptionHandler. See JJ2KExceptionHandler for details.
This method implements buffering for the 3 components: When the first one is asked, all the 3 components are read and stored until they are needed.
getInternCompData
in interface BlkImgDataSrc
blk
- Its coordinates and dimensions specify the area to
return. Some fields in this object are modified to return the data.c
- The index of the component from which to get the data. Only 0,
1 and 3 are valid.getCompData(jj2000.j2k.image.DataBlk, int)
,
JJ2KExceptionHandler
public final DataBlk getCompData(DataBlk blk, int c)
After being read the coefficients are level shifted by subtracting 2^(nominal bit range - 1)
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.
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.
The returned data has its 'progressive' attribute unset (i.e. false).
When an I/O exception is encountered the JJ2KExceptionHandler is used. The exception is passed to its handleException method. The action that is taken depends on the action that has been registered in JJ2KExceptionHandler. See JJ2KExceptionHandler for details.
getCompData
in interface BlkImgDataSrc
blk
- Its coordinates and dimensions specify the area to
return. If it contains a non-null data array, then it must have the
correct dimensions. If it contains a null data array a new one is
created. The fields in this object are modified to return the data.c
- The index of the component from which to get the data. Only
0,1 and 2 are valid.getInternCompData(jj2000.j2k.image.DataBlk, int)
,
JJ2KExceptionHandler
public boolean isOrigSigned(int c)
c
- The index of the component, from 0 to N-1.Copyright © 2014 Open Microscopy Environment