Java Doc for TIFFDecompressor.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » com » sun » media » imageio » plugins » tiff » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » com.sun.media.imageio.plugins.tiff 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.media.imageio.plugins.tiff.TIFFDecompressor

All known Subclasses:   com.sun.media.imageioimpl.plugins.tiff.TIFFLZWDecompressor,  com.sun.media.imageioimpl.plugins.tiff.TIFFLSBDecompressor,  com.sun.media.imageioimpl.plugins.tiff.TIFFDeflateDecompressor,  com.sun.media.imageioimpl.plugins.tiff.TIFFNullDecompressor,  com.sun.media.imageioimpl.plugins.tiff.TIFFJPEGDecompressor,  com.sun.media.imageioimpl.plugins.tiff.TIFFFaxDecompressor,  com.sun.media.imageioimpl.plugins.tiff.TIFFYCbCrDecompressor,  com.sun.media.imageioimpl.plugins.tiff.TIFFPackBitsDecompressor,
TIFFDecompressor
abstract public class TIFFDecompressor (Code)
A class defining a pluggable TIFF decompressor.

The mapping between source and destination Y coordinates is given by the equations:

 dx = (sx - sourceXOffset)/subsampleX + dstXOffset;
 dy = (sy - sourceYOffset)/subsampleY + dstYOffset;
 
Note that the mapping from source coordinates to destination coordinates is not one-to-one if subsampling is being used, since only certain source pixels are to be copied to the destination. However, * the inverse mapping is always one-to-one:
 sx = (dx - dstXOffset)*subsampleX + sourceXOffset;
 sy = (dy - dstYOffset)*subsampleY + sourceYOffset;
 

Decompressors may be written with various levels of complexity. The most complex decompressors will override the decode method, and will perform all the work of decoding, subsampling, offsetting, clipping, and format conversion. This approach may be the most efficient, since it is possible to avoid the use of extra image buffers, and it may be possible to avoid decoding portions of the image that will not be copied into the destination.

Less ambitious decompressors may override the decodeRaw method, which is responsible for decompressing the entire tile or strip into a byte array (or other appropriate datatype). The default implementation of decode will perform all necessary setup of buffers, call decodeRaw to perform the actual decoding, perform subsampling, and copy the results into the final destination image. Where possible, it will pass the real image buffer to decodeRaw in order to avoid making an extra copy.

Slightly more ambitious decompressors may override decodeRaw, but avoid writing pixels that will be discarded in the subsampling phase.



Field Summary
protected  intactiveSrcHeight
     The height of the source region that will actually be copied into the destination image, taking into account all susbampling, offsetting, and clipping.
protected  intactiveSrcMinX
     The X coordinate of the upper-left source pixel that will actually be copied into the destination image, taking into account all subsampling, offsetting, and clipping.
protected  intactiveSrcMinY
     The Y coordinate of the upper-left source pixel that will actually be copied into the destination image, taking into account all subsampling, offsetting, and clipping.
protected  intactiveSrcWidth
     The width of the source region that will actually be copied into the destination image, taking into account all susbampling, offsetting, and clipping.
 booleanadjustBitDepths
    
 int[][]bitDepthScale
    
protected  int[]bitsPerSample
     The value of the BitsPerSample tag.
protected  intbyteCount
     The number of bytes of data from the source ImageInputStream to be decompressed.
protected  TIFFColorConvertercolorConverter
     A TIFFColorConverter object describing the color space of the encoded pixel data, or null.
protected  char[]colorMap
     The value of the ColorMap tag.
protected  intcompression
     The value of the Compression tag.
protected  int[]destinationBands
     The sequence of destination bands to receive the source data.
protected  intdstHeight
     The height of the region of the destination image to be written.
protected  intdstMinX
     The X coordinate of the upper left pixel to be written in the destination image.
protected  intdstMinY
     The Y coordinate of the upper left pixel to be written in the destination image.
protected  intdstWidth
     The width of the region of the destination image to be written.
protected  intdstXOffset
     The horizontal destination offset used, along with sourceXOffset and subsampleX, to map between horizontal source and destination pixel coordinates.
protected  intdstYOffset
     The vertical destination offset used, along with sourceYOffset and subsampleY, to map between horizontal source and destination pixel coordinates.
protected  int[]extraSamples
     The value of the ExtraSamples tag.
protected  BufferedImageimage
     The final destination image.
 booleanisBilevel
    
 booleanisContiguous
    
 booleanisImageSimple
    
protected  IIOMetadatametadata
     The IIOMetadata object containing metadata for the current image.
protected  longoffset
     The offset in the source ImageInputStream of the start of the data to be decompressed.
protected  intphotometricInterpretation
     The value of the PhotometricInterpretation tag.
protected  booleanplanar
     true if the image is encoded using separate planes.
protected  BufferedImagerawImage
     A BufferedImage for the decodeRaw method to write into.
protected  ImageReaderreader
     The ImageReader calling this TIFFDecompressor.
protected  int[]sampleFormat
     The value of the SampleFormat tag.
protected  intsamplesPerPixel
     The value of the SamplesPerPixel tag.
protected  int[]sourceBands
     The sequence of source bands that are to be copied into the destination.
protected  intsourceXOffset
     The source X offset used, along with dstXOffset and subsampleX, to map between horizontal source and destination pixel coordinates.
protected  intsourceYOffset
     The source Y offset used, along with dstYOffset and subsampleY, to map between vertical source and destination pixel coordinates.
protected  intsrcHeight
     The height of the source region being decoded from the source stream.
protected  intsrcMinX
     The X coordinate of the upper-left pixel of the source region being decoded from the source stream.
protected  intsrcMinY
     The Y coordinate of the upper-left pixel of the source region being decoded from the source stream.
protected  intsrcWidth
     The width of the source region being decoded from the source stream.
protected  ImageInputStreamstream
     The ImageInputStream containing the TIFF source data.
protected  intsubsampleX
     The horizontal subsampling factor.
protected  intsubsampleY
     The vertical subsampling factor.


Method Summary
public  voidbeginDecoding()
     This routine is called prior to a sequence of calls to the decode method, in order to allow any necessary tables or other structures to be initialized based on metadata values.
static  ColorModelcreateComponentCM(ColorSpace colorSpace, int numBands, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied)
     Create a ComponentColorModel for use in creating an ImageTypeSpecifier.
static  SampleModelcreateInterleavedSM(int dataType, int numBands)
     Create a PixelInterleavedSampleModel for use in creating an ImageTypeSpecifier.
public  BufferedImagecreateRawImage()
     Creates a BufferedImage whose underlying data array will be suitable for holding the raw decoded output of the decodeRaw method.
public  voiddecode()
     Decodes the input bit stream (located in the ImageInputStream stream, at offset offset, and continuing for byteCount bytes) into the output BufferedImage image.

The default implementation analyzes the destination image to determine if it is suitable as the destination for the decodeRaw method.

abstract public  voiddecodeRaw(byte[] b, int dstOffset, int bitsPerPixel, int scanlineStride)
     Decodes the source data into the provided byte array b, starting at the offset given by dstOffset.
public  voiddecodeRaw(short[] s, int dstOffset, int bitsPerPixel, int scanlineStride)
     Decodes the source data into the provided short array s, starting at the offset given by dstOffset.
public  voiddecodeRaw(int[] i, int dstOffset, int bitsPerPixel, int scanlineStride)
     Decodes the source data into the provided int array i, starting at the offset given by dstOffset.
public  voiddecodeRaw(float[] f, int dstOffset, int bitsPerPixel, int scanlineStride)
     Decodes the source data into the provided float array f, starting at the offset given by dstOffset.
public  ImageTypeSpecifiergetRawImageType()
     Returns an ImageTypeSpecifier describing an image whose underlying data array has the same format as the raw source pixel data.
public static  ImageTypeSpecifiergetRawImageTypeSpecifier(int photometricInterpretation, int compression, int samplesPerPixel, int[] bitsPerSample, int[] sampleFormat, int[] extraSamples, char[] colorMap)
     A utility method that returns an ImageTypeSpecifier suitable for decoding an image with the given parameters.
Parameters:
  photometricInterpretation - the value of thePhotometricInterpretation field.
Parameters:
  compression - the value of the Compression field.
Parameters:
  samplesPerPixel - the value of theSamplesPerPixel field.
Parameters:
  bitsPerSample - the value of the BitsPerSample field.
Parameters:
  sampleFormat - the value of the SampleFormat field.
Parameters:
  extraSamples - the value of the ExtraSamples field.
Parameters:
  colorMap - the value of the ColorMap field.
public  voidsetActiveSrcHeight(int activeSrcHeight)
     Sets the value of the activeSrcHeight field.
public  voidsetActiveSrcMinX(int activeSrcMinX)
     Sets the value of the activeSrcMinX field.
public  voidsetActiveSrcMinY(int activeSrcMinY)
     Sets the value of the activeSrcMinY field.
public  voidsetActiveSrcWidth(int activeSrcWidth)
     Sets the value of the activeSrcWidth field.
public  voidsetBitsPerSample(int[] bitsPerSample)
     Sets the value of the bitsPerSample field.
public  voidsetByteCount(int byteCount)
     Sets the value of the byteCount field.
public  voidsetColorConverter(TIFFColorConverter colorConverter)
     Sets the TIFFColorConverter object describing the color space of the encoded data in the input stream.
public  voidsetColorMap(char[] colorMap)
     Sets the value of the colorMap field.
public  voidsetCompression(int compression)
     Sets the value of the compression field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  compression - the compression type.

public  voidsetDestinationBands(int[] destinationBands)
     Sets the value of the destinationBands field.
public  voidsetDstHeight(int dstHeight)
     Sets the value of the dstHeight field.
public  voidsetDstMinX(int dstMinX)
     Sets the value of the dstMinX field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  dstMinX - the minimum X coordinate of the destinationregion.

public  voidsetDstMinY(int dstMinY)
     Sets the value of the dstMinY field.
public  voidsetDstWidth(int dstWidth)
     Sets the value of the dstWidth field.
public  voidsetDstXOffset(int dstXOffset)
     Sets the value of the dstXOffset field.
public  voidsetDstYOffset(int dstYOffset)
     Sets the value of the dstYOffset field.
public  voidsetExtraSamples(int[] extraSamples)
     Sets the value of the extraSamples field.
public  voidsetImage(BufferedImage image)
     Sets the value of the image field.
public  voidsetMetadata(IIOMetadata metadata)
     Sets the value of the metadata field.
public  voidsetOffset(long offset)
     Sets the value of the offset field.
public  voidsetPhotometricInterpretation(int photometricInterpretation)
     Sets the value of the photometricInterpretation field.
public  voidsetPlanar(boolean planar)
     Sets the value of the planar field.
public  voidsetReader(ImageReader reader)
     Sets the value of the reader field.
public  voidsetSampleFormat(int[] sampleFormat)
     Sets the value of the sampleFormat field.
public  voidsetSamplesPerPixel(int samplesPerPixel)
     Sets the value of the samplesPerPixel field.
public  voidsetSourceBands(int[] sourceBands)
     Sets the value of the sourceBands field.
public  voidsetSourceXOffset(int sourceXOffset)
     Sets the value of the sourceXOffset field.
public  voidsetSourceYOffset(int sourceYOffset)
     Sets the value of the sourceYOffset.
public  voidsetSrcHeight(int srcHeight)
     Sets the value of the srcHeight field.
public  voidsetSrcMinX(int srcMinX)
     Sets the value of the srcMinX field.
public  voidsetSrcMinY(int srcMinY)
     Sets the value of the srcMinY field.
public  voidsetSrcWidth(int srcWidth)
     Sets the value of the srcWidth field.
public  voidsetStream(ImageInputStream stream)
     Sets the value of the stream field.
public  voidsetSubsampleX(int subsampleX)
     Sets the value of the subsampleX field.
public  voidsetSubsampleY(int subsampleY)
     Sets the value of the subsampleY field.

Field Detail
activeSrcHeight
protected int activeSrcHeight(Code)
The height of the source region that will actually be copied into the destination image, taking into account all susbampling, offsetting, and clipping.

The active source height will always be equal to (dstHeight - 1)*subsampleY + 1.




activeSrcMinX
protected int activeSrcMinX(Code)
The X coordinate of the upper-left source pixel that will actually be copied into the destination image, taking into account all subsampling, offsetting, and clipping. That is, the pixel at (activeSrcMinX, activeSrcMinY) is to be copied into the destination pixel at (dstMinX, dstMinY).

The pixels in the source region to be copied are those with X coordinates of the form activeSrcMinX + k*subsampleX, where k is an integer such that 0 <= k < dstWidth.




activeSrcMinY
protected int activeSrcMinY(Code)
The Y coordinate of the upper-left source pixel that will actually be copied into the destination image, taking into account all subsampling, offsetting, and clipping.

The pixels in the source region to be copied are those with Y coordinates of the form activeSrcMinY + k*subsampleY, where k is an integer such that 0 <= k < dstHeight.




activeSrcWidth
protected int activeSrcWidth(Code)
The width of the source region that will actually be copied into the destination image, taking into account all susbampling, offsetting, and clipping.

The active source width will always be equal to (dstWidth - 1)*subsampleX + 1.




adjustBitDepths
boolean adjustBitDepths(Code)



bitDepthScale
int[][] bitDepthScale(Code)



bitsPerSample
protected int[] bitsPerSample(Code)
The value of the BitsPerSample tag.



byteCount
protected int byteCount(Code)
The number of bytes of data from the source ImageInputStream to be decompressed.



colorConverter
protected TIFFColorConverter colorConverter(Code)
A TIFFColorConverter object describing the color space of the encoded pixel data, or null.



colorMap
protected char[] colorMap(Code)
The value of the ColorMap tag.



compression
protected int compression(Code)
The value of the Compression tag. Legal values are BaselineTIFFTagSet.COMPRESSION_NONE , BaselineTIFFTagSet.COMPRESSION_CCITT_RLE , BaselineTIFFTagSet.COMPRESSION_CCITT_T_4 , BaselineTIFFTagSet.COMPRESSION_CCITT_T_6 , BaselineTIFFTagSet.COMPRESSION_LZW , BaselineTIFFTagSet.COMPRESSION_OLD_JPEG , BaselineTIFFTagSet.COMPRESSION_JPEG , BaselineTIFFTagSet.COMPRESSION_ZLIB , BaselineTIFFTagSet.COMPRESSION_PACKBITS , BaselineTIFFTagSet.COMPRESSION_DEFLATE , or other value defined by a TIFF extension.



destinationBands
protected int[] destinationBands(Code)
The sequence of destination bands to receive the source data.



dstHeight
protected int dstHeight(Code)
The height of the region of the destination image to be written.



dstMinX
protected int dstMinX(Code)
The X coordinate of the upper left pixel to be written in the destination image.



dstMinY
protected int dstMinY(Code)
The Y coordinate of the upper left pixel to be written in the destination image.



dstWidth
protected int dstWidth(Code)
The width of the region of the destination image to be written.



dstXOffset
protected int dstXOffset(Code)
The horizontal destination offset used, along with sourceXOffset and subsampleX, to map between horizontal source and destination pixel coordinates. See the comment for TIFFDecompressor.sourceXOffsetsourceXOffset for the mapping equations.



dstYOffset
protected int dstYOffset(Code)
The vertical destination offset used, along with sourceYOffset and subsampleY, to map between horizontal source and destination pixel coordinates. See the comment for TIFFDecompressor.sourceYOffsetsourceYOffset for the mapping equations.



extraSamples
protected int[] extraSamples(Code)
The value of the ExtraSamples tag. Legal values are BaselineTIFFTagSet.EXTRA_SAMPLES_UNSPECIFIED , BaselineTIFFTagSet.EXTRA_SAMPLES_ASSOCIATED_ALPHA , BaselineTIFFTagSet.EXTRA_SAMPLES_UNASSOCIATED_ALPHA , or other value defined by a TIFF extension.



image
protected BufferedImage image(Code)
The final destination image.



isBilevel
boolean isBilevel(Code)



isContiguous
boolean isContiguous(Code)



isImageSimple
boolean isImageSimple(Code)



metadata
protected IIOMetadata metadata(Code)
The IIOMetadata object containing metadata for the current image.



offset
protected long offset(Code)
The offset in the source ImageInputStream of the start of the data to be decompressed.



photometricInterpretation
protected int photometricInterpretation(Code)
The value of the PhotometricInterpretation tag. Legal values are BaselineTIFFTagSet.PHOTOMETRIC_INTERPRETATION_WHITE_IS_ZERO , BaselineTIFFTagSet.PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO , BaselineTIFFTagSet.PHOTOMETRIC_INTERPRETATION_RGB , BaselineTIFFTagSet.PHOTOMETRIC_INTERPRETATION_PALETTE_COLOR , BaselineTIFFTagSet.PHOTOMETRIC_INTERPRETATION_TRANSPARENCY_MASK , BaselineTIFFTagSet.PHOTOMETRIC_INTERPRETATION_Y_CB_CR , BaselineTIFFTagSet.PHOTOMETRIC_INTERPRETATION_CIELAB , BaselineTIFFTagSet.PHOTOMETRIC_INTERPRETATION_ICCLAB , or other value defined by a TIFF extension.



planar
protected boolean planar(Code)
true if the image is encoded using separate planes.



rawImage
protected BufferedImage rawImage(Code)
A BufferedImage for the decodeRaw method to write into.



reader
protected ImageReader reader(Code)
The ImageReader calling this TIFFDecompressor.



sampleFormat
protected int[] sampleFormat(Code)
The value of the SampleFormat tag. Legal values are BaselineTIFFTagSet.SAMPLE_FORMAT_UNSIGNED_INTEGER , BaselineTIFFTagSet.SAMPLE_FORMAT_SIGNED_INTEGER , BaselineTIFFTagSet.SAMPLE_FORMAT_FLOATING_POINT , BaselineTIFFTagSet.SAMPLE_FORMAT_UNDEFINED , or other value defined by a TIFF extension.



samplesPerPixel
protected int samplesPerPixel(Code)
The value of the SamplesPerPixel tag.



sourceBands
protected int[] sourceBands(Code)
The sequence of source bands that are to be copied into the destination.



sourceXOffset
protected int sourceXOffset(Code)
The source X offset used, along with dstXOffset and subsampleX, to map between horizontal source and destination pixel coordinates.



sourceYOffset
protected int sourceYOffset(Code)
The source Y offset used, along with dstYOffset and subsampleY, to map between vertical source and destination pixel coordinates.



srcHeight
protected int srcHeight(Code)
The height of the source region being decoded from the source stream. This value is not affected by source subsampling.



srcMinX
protected int srcMinX(Code)
The X coordinate of the upper-left pixel of the source region being decoded from the source stream. This value is not affected by source subsampling.



srcMinY
protected int srcMinY(Code)
The Y coordinate of the upper-left pixel of the source region being decoded from the source stream. This value is not affected by source subsampling.



srcWidth
protected int srcWidth(Code)
The width of the source region being decoded from the source stream. This value is not affected by source subsampling.



stream
protected ImageInputStream stream(Code)
The ImageInputStream containing the TIFF source data.



subsampleX
protected int subsampleX(Code)
The horizontal subsampling factor. A factor of 1 means that every column is copied to the destination; a factor of 2 means that every second column is copied, etc.



subsampleY
protected int subsampleY(Code)
The vertical subsampling factor. A factor of 1 means that every row is copied to the destination; a factor of 2 means that every second row is copied, etc.





Method Detail
beginDecoding
public void beginDecoding()(Code)
This routine is called prior to a sequence of calls to the decode method, in order to allow any necessary tables or other structures to be initialized based on metadata values. This routine is guaranteed to be called any time the metadata values have changed.

The default implementation computes tables used by the decode method to rescale components to different bit depths. Thus, if this method is overridden, it is important for the subclass method to call super(), unless it overrides decode as well.




createComponentCM
static ColorModel createComponentCM(ColorSpace colorSpace, int numBands, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied)(Code)
Create a ComponentColorModel for use in creating an ImageTypeSpecifier.



createInterleavedSM
static SampleModel createInterleavedSM(int dataType, int numBands)(Code)
Create a PixelInterleavedSampleModel for use in creating an ImageTypeSpecifier. Its dimensions will be 1x1 and it will have ascending band offsets as {0, 1, 2, ..., numBands}.
Parameters:
  dataType - The data type (DataBuffer.TYPE_*).
Parameters:
  numBands - The number of bands. A PixelInterleavedSampleModel.



createRawImage
public BufferedImage createRawImage()(Code)
Creates a BufferedImage whose underlying data array will be suitable for holding the raw decoded output of the decodeRaw method.

The default implementation calls getRawImageType, and calls the resulting ImageTypeSpecifier's createBufferedImage method. a BufferedImage whose underlying dataarray has the same format as the raw source pixel data, ornull if it is not possible to create such animage.




decode
public void decode() throws IOException(Code)
Decodes the input bit stream (located in the ImageInputStream stream, at offset offset, and continuing for byteCount bytes) into the output BufferedImage image.

The default implementation analyzes the destination image to determine if it is suitable as the destination for the decodeRaw method. If not, a suitable image is created. Next, decodeRaw is called to perform the actual decoding, and the results are copied into the destination image if necessary. Subsampling and offsetting are performed automatically.

The precise responsibilities of this routine are as follows. The input bit stream is defined by the instance variables stream, offset, and byteCount. These bits contain the data for the region of the source image defined by srcMinX, srcMinY, srcWidth, and srcHeight.

The source data is required to be subsampling, starting at the sourceXOffsetth column and including every subsampleXth pixel thereafter (and similarly for sourceYOffset and subsampleY).

Pixels are copied into the destination with an addition shift of (dstXOffset, dstYOffset). The complete set of formulas relating the source and destination coordinate spaces are:

 dx = (sx - sourceXOffset)/subsampleX + dstXOffset;
 dy = (sy - sourceYOffset)/subsampleY + dstYOffset; 
 
Only source pixels such that (sx - sourceXOffset) % subsampleX == 0 and (sy - sourceYOffset) % subsampleY == 0 are copied.

The inverse mapping, from destination to source coordinates, is one-to-one:

 sx = (dx - dstXOffset)*subsampleX + sourceXOffset;
 sy = (dy - dstYOffset)*subsampleY + sourceYOffset;
 

The region of the destination image to be updated is given by the instance variables dstMinX, dstMinY, dstWidth, and dstHeight.

It is possible that not all of the source data being read will contribute to the destination image. For example, the destination offsets could be set such that some of the source pixels land outside of the bounds of the image. As a convenience, the bounds of the active source region (that is, the region of the strip or tile being read that actually contributes to the destination image, taking clipping into account) are available as activeSrcMinX, activeSrcMinY, activeSrcWidth and activeSrcHeight. Thus, the source pixel at (activeSrcMinX, activeSrcMinY) will map to the destination pixel (dstMinX, dstMinY).

The sequence of source bands given by sourceBands are to be copied into the sequence of bands in the destination given by destinationBands.

Some standard tag information is provided the instance variables photometricInterpretation, compression, samplesPerPixel, bitsPerSample, sampleFormat, extraSamples, and colorMap.

In practice, unless there is a significant performance advantage to be gained by overriding this routine, most users will prefer to use the default implementation of this routine, and instead override the decodeRaw and/or getRawImageType methods.
exception:
  IOException - if an error occurs indecodeRaw.




decodeRaw
abstract public void decodeRaw(byte[] b, int dstOffset, int bitsPerPixel, int scanlineStride) throws IOException(Code)
Decodes the source data into the provided byte array b, starting at the offset given by dstOffset. Each pixel occupies bitsPerPixel bits, with no padding between pixels. Scanlines are separated by scanlineStride bytes.
Parameters:
  b - a byte array to be written.
Parameters:
  dstOffset - the starting offset in b to bewritten.
Parameters:
  bitsPerPixel - the number of bits for each pixel.
Parameters:
  scanlineStride - the number of bytes toadvance between that starting pixels of each scanline.
throws:
  IOException - if an error occurs reading from the sourceImageInputStream.



decodeRaw
public void decodeRaw(short[] s, int dstOffset, int bitsPerPixel, int scanlineStride) throws IOException(Code)
Decodes the source data into the provided short array s, starting at the offset given by dstOffset. Each pixel occupies bitsPerPixel bits, with no padding between pixels. Scanlines are separated by scanlineStride shorts

The default implementation calls decodeRaw(byte[] b, ...) and copies the resulting data into s.
Parameters:
  s - a short array to be written.
Parameters:
  dstOffset - the starting offset in s to bewritten.
Parameters:
  bitsPerPixel - the number of bits for each pixel.
Parameters:
  scanlineStride - the number of shorts toadvance between that starting pixels of each scanline.
throws:
  IOException - if an error occurs reading from the sourceImageInputStream.




decodeRaw
public void decodeRaw(int[] i, int dstOffset, int bitsPerPixel, int scanlineStride) throws IOException(Code)
Decodes the source data into the provided int array i, starting at the offset given by dstOffset. Each pixel occupies bitsPerPixel bits, with no padding between pixels. Scanlines are separated by scanlineStride ints.

The default implementation calls decodeRaw(byte[] b, ...) and copies the resulting data into i.
Parameters:
  i - an int array to be written.
Parameters:
  dstOffset - the starting offset in i to bewritten.
Parameters:
  bitsPerPixel - the number of bits for each pixel.
Parameters:
  scanlineStride - the number of ints toadvance between that starting pixels of each scanline.
throws:
  IOException - if an error occurs reading from the sourceImageInputStream.




decodeRaw
public void decodeRaw(float[] f, int dstOffset, int bitsPerPixel, int scanlineStride) throws IOException(Code)
Decodes the source data into the provided float array f, starting at the offset given by dstOffset. Each pixel occupies bitsPerPixel bits, with no padding between pixels. Scanlines are separated by scanlineStride floats.

The default implementation calls decodeRaw(byte[] b, ...) and copies the resulting data into f.
Parameters:
  f - a float array to be written.
Parameters:
  dstOffset - the starting offset in f to bewritten.
Parameters:
  bitsPerPixel - the number of bits for each pixel.
Parameters:
  scanlineStride - the number of floats toadvance between that starting pixels of each scanline.
throws:
  IOException - if an error occurs reading from the sourceImageInputStream.




getRawImageType
public ImageTypeSpecifier getRawImageType()(Code)
Returns an ImageTypeSpecifier describing an image whose underlying data array has the same format as the raw source pixel data. an ImageTypeSpecifier.



getRawImageTypeSpecifier
public static ImageTypeSpecifier getRawImageTypeSpecifier(int photometricInterpretation, int compression, int samplesPerPixel, int[] bitsPerSample, int[] sampleFormat, int[] extraSamples, char[] colorMap)(Code)
A utility method that returns an ImageTypeSpecifier suitable for decoding an image with the given parameters.
Parameters:
  photometricInterpretation - the value of thePhotometricInterpretation field.
Parameters:
  compression - the value of the Compression field.
Parameters:
  samplesPerPixel - the value of theSamplesPerPixel field.
Parameters:
  bitsPerSample - the value of the BitsPerSample field.
Parameters:
  sampleFormat - the value of the SampleFormat field.
Parameters:
  extraSamples - the value of the ExtraSamples field.
Parameters:
  colorMap - the value of the ColorMap field. a suitable ImageTypeSpecifier, ornull if it is not possible to create one.



setActiveSrcHeight
public void setActiveSrcHeight(int activeSrcHeight)(Code)
Sets the value of the activeSrcHeight field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  activeSrcHeight - the height of the active source region.




setActiveSrcMinX
public void setActiveSrcMinX(int activeSrcMinX)(Code)
Sets the value of the activeSrcMinX field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  activeSrcMinX - the minimum X coordinate of the activesource region.




setActiveSrcMinY
public void setActiveSrcMinY(int activeSrcMinY)(Code)
Sets the value of the activeSrcMinY field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  activeSrcMinY - the minimum Y coordinate of the activesource region.




setActiveSrcWidth
public void setActiveSrcWidth(int activeSrcWidth)(Code)
Sets the value of the activeSrcWidth field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  activeSrcWidth - the width of the active source region.




setBitsPerSample
public void setBitsPerSample(int[] bitsPerSample)(Code)
Sets the value of the bitsPerSample field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  bitsPerSample - the number of bits for each source imagesample.




setByteCount
public void setByteCount(int byteCount)(Code)
Sets the value of the byteCount field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  byteCount - the number of bytes of compressed data.




setColorConverter
public void setColorConverter(TIFFColorConverter colorConverter)(Code)
Sets the TIFFColorConverter object describing the color space of the encoded data in the input stream. If no TIFFColorConverter is set, no conversion will be performed.
Parameters:
  colorConverter - a TIFFColorConverter object, ornull.



setColorMap
public void setColorMap(char[] colorMap)(Code)
Sets the value of the colorMap field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  colorMap - the color map to apply to the source data,as an array of chars.




setCompression
public void setCompression(int compression)(Code)
Sets the value of the compression field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  compression - the compression type.




setDestinationBands
public void setDestinationBands(int[] destinationBands)(Code)
Sets the value of the destinationBands field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  destinationBands - an array of intsspecifying the destination bands to be written.




setDstHeight
public void setDstHeight(int dstHeight)(Code)
Sets the value of the dstHeight field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  dstHeight - the height of the destination region.




setDstMinX
public void setDstMinX(int dstMinX)(Code)
Sets the value of the dstMinX field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  dstMinX - the minimum X coordinate of the destinationregion.




setDstMinY
public void setDstMinY(int dstMinY)(Code)
Sets the value of the dstMinY field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  dstMinY - the minimum Y coordinate of the destinationregion.




setDstWidth
public void setDstWidth(int dstWidth)(Code)
Sets the value of the dstWidth field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  dstWidth - the width of the destination region.




setDstXOffset
public void setDstXOffset(int dstXOffset)(Code)
Sets the value of the dstXOffset field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  dstXOffset - the horizontal destination offset to beused when mapping between source and destination coordinates.




setDstYOffset
public void setDstYOffset(int dstYOffset)(Code)
Sets the value of the dstYOffset field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  dstYOffset - the vertical destination offset to beused when mapping between source and destination coordinates.




setExtraSamples
public void setExtraSamples(int[] extraSamples)(Code)
Sets the value of the extraSamples field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  extraSamples - the interpretation of any samples in thesource file beyond those used for basic color or grayscaleinformation.




setImage
public void setImage(BufferedImage image)(Code)
Sets the value of the image field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  image - the destination BufferedImage.




setMetadata
public void setMetadata(IIOMetadata metadata)(Code)
Sets the value of the metadata field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  metadata - the IIOMetadata object for theimage being read.




setOffset
public void setOffset(long offset)(Code)
Sets the value of the offset field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  offset - the offset of the beginning of the compresseddata.




setPhotometricInterpretation
public void setPhotometricInterpretation(int photometricInterpretation)(Code)
Sets the value of the photometricInterpretation field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  photometricInterpretation - the photometric interpretationvalue.




setPlanar
public void setPlanar(boolean planar)(Code)
Sets the value of the planar field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  planar - true if the image to be decoded isstored in planar format.




setReader
public void setReader(ImageReader reader)(Code)
Sets the value of the reader field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  reader - the current ImageReader.




setSampleFormat
public void setSampleFormat(int[] sampleFormat)(Code)
Sets the value of the sampleFormat field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  sampleFormat - the format of the source image data,for example unsigned integer or floating-point.




setSamplesPerPixel
public void setSamplesPerPixel(int samplesPerPixel)(Code)
Sets the value of the samplesPerPixel field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  samplesPerPixel - the number of samples in each sourcepixel.




setSourceBands
public void setSourceBands(int[] sourceBands)(Code)
Sets the value of the sourceBands field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  sourceBands - an array of intsspecifying the source bands to be read.




setSourceXOffset
public void setSourceXOffset(int sourceXOffset)(Code)
Sets the value of the sourceXOffset field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  sourceXOffset - the horizontal source offset to be used whenmapping between source and destination coordinates.




setSourceYOffset
public void setSourceYOffset(int sourceYOffset)(Code)
Sets the value of the sourceYOffset.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  sourceYOffset - the vertical source offset to be used whenmapping between source and destination coordinates.




setSrcHeight
public void setSrcHeight(int srcHeight)(Code)
Sets the value of the srcHeight field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  srcHeight - the height of the source region being decoded,irrespective of how it will be copied into the destination.




setSrcMinX
public void setSrcMinX(int srcMinX)(Code)
Sets the value of the srcMinX field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  srcMinX - the minimum X coordinate of the source regionbeing decoded, irrespective of how it will be copied into thedestination.




setSrcMinY
public void setSrcMinY(int srcMinY)(Code)
Sets the value of the srcMinY field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  srcMinY - the minimum Y coordinate of the source regionbeing decoded, irrespective of how it will be copied into thedestination.




setSrcWidth
public void setSrcWidth(int srcWidth)(Code)
Sets the value of the srcWidth field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  srcWidth - the width of the source region being decoded,irrespective of how it will be copied into the destination.




setStream
public void setStream(ImageInputStream stream)(Code)
Sets the value of the stream field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  stream - the ImageInputStream to be read.




setSubsampleX
public void setSubsampleX(int subsampleX)(Code)
Sets the value of the subsampleX field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  subsampleX - the horizontal subsampling factor.
throws:
  IllegalArgumentException - if subsampleX isless than or equal to 0.




setSubsampleY
public void setSubsampleY(int subsampleY)(Code)
Sets the value of the subsampleY field.

If this method is called, the beginDecoding method must be called prior to calling any of the decode methods.
Parameters:
  subsampleY - the vertical subsampling factor.
throws:
  IllegalArgumentException - if subsampleY isless than or equal to 0.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.