public class RenderedImageSrc extends Object implements BlkImgDataSrc
Modifier and Type | Field and Description |
---|---|
private Raster |
aTile
The raster for a destination tile
|
private int[][] |
barr
Buffer for the 3 components of each pixel(in the current block)
|
private byte[] |
buf
The line buffer.
|
private ColorModel |
cm |
private Point |
co |
private DataBlkInt |
dbi
Data block used only to store coordinates of the buffered blocks
|
private int |
dcOffset |
private Rectangle |
destinationRegion |
private int |
h
The height of the image
|
private boolean |
inputIsRaster
Indicates a
raster rather than a RenderedImage
to be encoded. |
private DataBlkInt |
intBlk
Temporary DataBlkInt object (needed when encoder uses floating-point
filters).
|
private boolean |
isBinary |
(package private) int |
minX
The destination upper-left corner
|
(package private) int |
minY
The destination upper-left corner
|
private int |
nc
The number of components in the image
|
private boolean |
noSubband |
private boolean |
noTransform |
private J2KImageWriteParamJava |
param |
private Raster |
raster
The input source raster.
|
private int |
rb
The number of bits that determine the nominal dynamic range
|
(package private) int |
scaleX
The source -> destination transformation
|
(package private) int |
scaleY
The source -> destination transformation
|
private SampleModel |
sm |
(package private) int[] |
sourceBands
The source bands to be encoded.
|
private Rectangle |
sourceRegion |
private RenderedImage |
src |
(package private) int |
tileHeight
The tile height for encoding
|
(package private) int |
tileWidth
The tile width for encoding
|
(package private) int |
tileXOffset
The tile grid offset for encoding
|
(package private) int |
tileYOffset
The tile grid offset for encoding
|
private int |
w
The width of the image
|
private J2KImageWriter |
writer
Used to process abortion.
|
(package private) int |
xOffset
The source -> destination transformation
|
(package private) int |
yOffset
The source -> destination transformation
|
Constructor and Description |
---|
RenderedImageSrc(Raster raster,
J2KImageWriteParamJava param,
J2KImageWriter writer)
Creates
RenderedImageSrc for encoding a Raster . |
RenderedImageSrc(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.
|
private void |
getFromParam() |
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.
|
Point |
getNumTiles(Point co)
Returns the number of tiles in the horizontal and vertical
directions.
|
private int |
getNumXTiles() |
private int |
getNumYTiles() |
private Raster |
getTile(int tileX,
int tileY) |
Point |
getTile(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.
|
Point |
getTileOff(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.
|
private int |
mapToSourceX(int x) |
private int |
mapToSourceY(int y) |
void |
nextTile()
Advances to the next tile, in standard scan-line order (by rows then
columns).
|
private void |
setSampleModelAndMore() |
void |
setTile(int x,
int y)
Changes the current tile, given the new coordinates.
|
private static int |
ToTile(int pos,
int tileOffset,
int tileSize) |
private int w
private int h
int tileWidth
int tileHeight
int tileXOffset
int tileYOffset
int scaleX
int scaleY
int xOffset
int yOffset
int[] sourceBands
int minX
int minY
private int nc
private int rb
private int[][] barr
private DataBlkInt dbi
private byte[] buf
private DataBlkInt intBlk
private RenderedImage src
private J2KImageWriteParamJava param
private Raster raster
private Raster aTile
private Point co
private int dcOffset
private boolean isBinary
private Rectangle destinationRegion
private Rectangle sourceRegion
private ColorModel cm
private SampleModel sm
private boolean noTransform
private boolean noSubband
private J2KImageWriter writer
private boolean inputIsRaster
raster
rather than a RenderedImage
to be encoded.public RenderedImageSrc(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(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.private void getFromParam()
private void setSampleModelAndMore()
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)
n
- 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 Point getTile(Point co)
public int getTileIdx()
getTileIdx
in interface ImgData
public Point getTileOff(Point p, int c)
p
- 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 Point getNumTiles(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.private int getNumXTiles()
private int getNumYTiles()
private static int ToTile(int pos, int tileOffset, int tileSize)
private Raster getTile(int tileX, int tileY)
private int mapToSourceX(int x)
private int mapToSourceY(int y)
Copyright © 2016 Open Microscopy Environment