Java Doc for XTIFFTileCodecImpl.java in  » GIS » openjump » org » libtiff » jai » codec » 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 » GIS » openjump » org.libtiff.jai.codec 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.libtiff.jai.codec.XTIFFTileCodecImpl

All known Subclasses:   org.libtiff.jai.codecimpl.XTIFFLZWTileCodec,  org.libtiff.jai.codecimpl.XTIFFFaxTileCodec,  org.libtiff.jai.codecimpl.XTIFFUncompTileCodec,  org.libtiff.jai.codecimpl.XTIFFPackTileCodec,
XTIFFTileCodecImpl
abstract public class XTIFFTileCodecImpl implements XTIFFTileCodec(Code)
Provides a base class for writing TIFF tile codecs, to be registered with the XTIFFDirectory. This codec allows for both decoding and (optionally) encoding of tiles, and also handles the colorspace conversion in decoding.

At the minimum you will need to implement the two methods decodeTilePixels() for byte and short data, as well as the methods register() and create(). If your decoder requires additional parameters from the tags, set them up in initializeDecoding(), and initializeEncoding() for encoding.

To implement encoding, you must override the canEncode() method to return true, and implement encodeTilePixels().
author:
   Niles Ritter
See Also:   XTIFFTileCodec



Field Summary
protected  byte_bdata
    
protected  short_sdata
    
protected  char[]bitsPerSample
    
protected  byte[]bpixvals
    
protected  DataBufferbuffer
    
protected  char[]colormap
    
protected  intcompression
    
protected  intdataType
    
protected  booleandecodePaletteAsShorts
    
protected  XTIFFDecodeParamdecodeParam
    
protected  XTIFFDirectorydirectory
    
protected  XTIFFEncodeParamencodeParam
    
protected  RenderedImageimage
    
protected  intimage_type
    
protected  booleanisTiled
    
protected  intlength
    
protected  intminX
    
protected  intminY
    
protected  intnumBands
    
protected  SampleModelsampleModel
    
protected  int[]sampleSize
    
protected  short[]spixvals
    
protected  inttileLength
    
protected  inttileWidth
    
protected  intunitsInThisTile
    
protected  intwidth
    

Constructor Summary
public  XTIFFTileCodecImpl()
     The empty constructor.

Method Summary
public  booleancanEncode()
     Indicate whether this codec can encode data.
abstract public  XTIFFTileCodeccreate()
     Implement this to return the corresponding empty codec object.
public  XTIFFTileCodeccreate(XTIFFEncodeParam param)
     The method for creating an encoder from the XTIFFEncodeParam information.
public  XTIFFTileCodeccreate(XTIFFDecodeParam param)
    
public  WritableRasterdecode(RenderedImage img, Rectangle newRect, byte[] bpixels)
     Decode a rectangle of data stored in bpixels into a raster tile.
protected  voiddecodeColor(Rectangle newRect)
     Postprocess the uncompressed color data into the appropriate display color model.
protected  voiddecodeColor(byte[] bpix, short[] sdata, Rectangle newRect)
     Decode short pixel data, or interpret palette data as short from byte.
protected  voiddecodeColor(short[] spix, short[] sdata, Rectangle newRect)
     Decode short color data, or interpret palette data as short.
protected  voiddecodeColor(byte[] bpix, byte[] bdata, Rectangle newRect)
    
abstract public  voiddecodeTilePixels(byte[] bpixels, Rectangle rect, byte[] pixels)
     decode bpixel byte array of data into pixels, packed for 1,2,4 8 bit pixels.
abstract public  voiddecodeTilePixels(byte[] bpixels, Rectangle rect, short[] pixels)
     decode bpixel byte array of data into pixels, packed for 16 bit pixels.
protected  voiddecodeTilePixels(byte[] bpixels, Rectangle newRect)
     Decode a tile of data into either byte or short pixel buffers. Override this if you have other buffer types (e.g.
public  intencode(RenderedImage img, Rectangle rect, byte[] bpixels)
     Encode the data into buffer and return byte count Normally you will not need to override this method, but instead implement the encodeTilePixels() method.
public  intencodeTilePixels(int[] pixels, Rectangle rect, byte[] bpixels)
     encode the tile in pixels into bpixels and return the byte size of the compressed data.
public  intgetCompressedTileSize(RenderedImage im)
     If derived classes can make a better estimate for the maximum size of a compressed tile, they should override this, which assumes conservatively that it won't be worse than twice the original size.
public  intgetCompression()
    
protected  longgetLongField(int fld)
     A common utility method for accessing the XTIFFFields in the current image directory.
protected  voidgetTilePixels(Rectangle rect)
     Get the portion of tile fitting into buffer.
public  voidinitialize()
     The method for initializing information common to both encoder and decoder.
protected  voidinitialize(XTIFFEncodeParam param)
    
protected  voidinitialize(XTIFFDecodeParam param)
    
public  voidinitializeDecoding()
     The initialization method particular to decoding. Extend for whatever compression-specific information or parameters is needed.
public  voidinitializeEncoding()
     The initialization method particular to encoding. Extend for whatever compression-specific information or parameters is needed.
abstract public  voidregister()
     Registration method.
public  voidregister(int comp)
     This method may be used by the implementations register() method to register itself with the XTIFFDirectory.
protected  WritableRastersetTilePixels(Rectangle rect)
     Take the values from the buffer and store them in a WritableRaster object.
protected  voidsetupBufferForDecoding()
     One-time setup for encoding.
protected  voidsetupBufferForEncoding()
    
protected  voidsetupSourceImage(RenderedImage img)
    
protected  voidunpackShorts(byte byteArray, short output, int shortCount)
     A useful Method to interpret a byte array as shorts.

Field Detail
_bdata
protected byte _bdata(Code)



_sdata
protected short _sdata(Code)



bitsPerSample
protected char[] bitsPerSample(Code)



bpixvals
protected byte[] bpixvals(Code)



buffer
protected DataBuffer buffer(Code)



colormap
protected char[] colormap(Code)



compression
protected int compression(Code)



dataType
protected int dataType(Code)



decodePaletteAsShorts
protected boolean decodePaletteAsShorts(Code)



decodeParam
protected XTIFFDecodeParam decodeParam(Code)



directory
protected XTIFFDirectory directory(Code)



encodeParam
protected XTIFFEncodeParam encodeParam(Code)



image
protected RenderedImage image(Code)



image_type
protected int image_type(Code)



isTiled
protected boolean isTiled(Code)



length
protected int length(Code)



minX
protected int minX(Code)



minY
protected int minY(Code)



numBands
protected int numBands(Code)



sampleModel
protected SampleModel sampleModel(Code)



sampleSize
protected int[] sampleSize(Code)



spixvals
protected short[] spixvals(Code)



tileLength
protected int tileLength(Code)



tileWidth
protected int tileWidth(Code)



unitsInThisTile
protected int unitsInThisTile(Code)



width
protected int width(Code)




Constructor Detail
XTIFFTileCodecImpl
public XTIFFTileCodecImpl()(Code)
The empty constructor.




Method Detail
canEncode
public boolean canEncode()(Code)
Indicate whether this codec can encode data. Override to return true only if your codec implments encoding.



create
abstract public XTIFFTileCodec create()(Code)
Implement this to return the corresponding empty codec object.



create
public XTIFFTileCodec create(XTIFFEncodeParam param) throws IOException(Code)
The method for creating an encoder from the XTIFFEncodeParam information.



create
public XTIFFTileCodec create(XTIFFDecodeParam param) throws IOException(Code)
The standard decoder creation method



decode
public WritableRaster decode(RenderedImage img, Rectangle newRect, byte[] bpixels)(Code)
Decode a rectangle of data stored in bpixels into a raster tile. Usually you will not need to override this, but instead implement the decodeTilePixels methods.



decodeColor
protected void decodeColor(Rectangle newRect)(Code)
Postprocess the uncompressed color data into the appropriate display color model. This implementation Does a number of things:
  • For RGB color, reverse to BGR which apparently is faster for Java 2D display
  • For one-bit WHITE_IS_ZERO data, flip the values so that they will look correct
  • If the decodePaletteAsShorts flag is true then unpack the bits and apply the lookup table, as 16-bit lookup is not supported in JAI.
Override this if you have other color types.
See Also:   XTIFFDecodeParam



decodeColor
protected void decodeColor(byte[] bpix, short[] sdata, Rectangle newRect)(Code)
Decode short pixel data, or interpret palette data as short from byte.



decodeColor
protected void decodeColor(short[] spix, short[] sdata, Rectangle newRect)(Code)
Decode short color data, or interpret palette data as short.



decodeColor
protected void decodeColor(byte[] bpix, byte[] bdata, Rectangle newRect)(Code)
Decode byte color data



decodeTilePixels
abstract public void decodeTilePixels(byte[] bpixels, Rectangle rect, byte[] pixels)(Code)
decode bpixel byte array of data into pixels, packed for 1,2,4 8 bit pixels. Must implment this.
Parameters:
  bpixels - the byte array of compressed input data
Parameters:
  rect - the rectangular shape of the target pixels
Parameters:
  pixels - the target decompressed pixels.



decodeTilePixels
abstract public void decodeTilePixels(byte[] bpixels, Rectangle rect, short[] pixels)(Code)
decode bpixel byte array of data into pixels, packed for 16 bit pixels. Must implment this.
Parameters:
  bpixels - the byte array of compressed input data
Parameters:
  rect - the rectangular shape of the target pixels
Parameters:
  pixels - the target decompressed pixels.



decodeTilePixels
protected void decodeTilePixels(byte[] bpixels, Rectangle newRect)(Code)
Decode a tile of data into either byte or short pixel buffers. Override this if you have other buffer types (e.g. int)



encode
public int encode(RenderedImage img, Rectangle rect, byte[] bpixels)(Code)
Encode the data into buffer and return byte count Normally you will not need to override this method, but instead implement the encodeTilePixels() method.



encodeTilePixels
public int encodeTilePixels(int[] pixels, Rectangle rect, byte[] bpixels)(Code)
encode the tile in pixels into bpixels and return the byte size of the compressed data. Override this method if canEncode() = true;
Parameters:
  pixels - input pixels
Parameters:
  rect - the array dimensions of samples
Parameters:
  bpixels - the target array of compressed byte data



getCompressedTileSize
public int getCompressedTileSize(RenderedImage im)(Code)
If derived classes can make a better estimate for the maximum size of a compressed tile, they should override this, which assumes conservatively that it won't be worse than twice the original size.
Parameters:
  im - the rendered image containing the image data



getCompression
public int getCompression()(Code)
Returns the TIFF compression type



getLongField
protected long getLongField(int fld)(Code)
A common utility method for accessing the XTIFFFields in the current image directory.



getTilePixels
protected void getTilePixels(Rectangle rect)(Code)
Get the portion of tile fitting into buffer. You probably won't need to override this.
Parameters:
  rect - the region to extract from image.



initialize
public void initialize()(Code)
The method for initializing information common to both encoder and decoder.



initialize
protected void initialize(XTIFFEncodeParam param) throws IOException(Code)



initialize
protected void initialize(XTIFFDecodeParam param) throws IOException(Code)



initializeDecoding
public void initializeDecoding()(Code)
The initialization method particular to decoding. Extend for whatever compression-specific information or parameters is needed. The decoding parameter has already been assigned at this point, as well as the XTIFFDirectory parsed from the input stream, and so all XTIFFFields are available.



initializeEncoding
public void initializeEncoding()(Code)
The initialization method particular to encoding. Extend for whatever compression-specific information or parameters is needed. The decoding parameter has already been assigned at this point, as well as the XTIFFDirectory parsed from the input stream, and so all XTIFFFields are available.



register
abstract public void register()(Code)
Registration method. Must be implemented by the extended class to register itself with the XTIFFDirectory for all compression codes it supports (e.g Fax codec supports 3 codes).
See Also:   XTIFFDirectory



register
public void register(int comp)(Code)
This method may be used by the implementations register() method to register itself with the XTIFFDirectory.
See Also:   XTIFFDirectory



setTilePixels
protected WritableRaster setTilePixels(Rectangle rect)(Code)
Take the values from the buffer and store them in a WritableRaster object.



setupBufferForDecoding
protected void setupBufferForDecoding()(Code)
One-time setup for encoding. Some configurations require a temp array for unpacking 16-bit palette data.



setupBufferForEncoding
protected void setupBufferForEncoding()(Code)
One-time setup for encoding



setupSourceImage
protected void setupSourceImage(RenderedImage img)(Code)
One-time common image parameter setup
Parameters:
  img - the source image that will be encoded into a TIFF formatted stream, orthe TIFF image from which Raster tiles will be decoded.



unpackShorts
protected void unpackShorts(byte byteArray, short output, int shortCount)(Code)
A useful Method to interpret a byte array as shorts. Method depends on whether the bytes are stored in a big endian or little endian format.



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.