eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TIFFReader':

Home

everywhere
www.exept.de
for:
[back]

Class: TIFFReader


Inheritance:

   Object
   |
   +--ImageReader
      |
      +--TIFFReader

Package:
stx:libview2
Category:
Graphics-Images-Readers
Version:
rev: 1.83 date: 2004/03/05 19:07:44
user: stefan
file: TIFFReader.st directory: libview2
module: stx stc-classLibrary: libview2
Author:
Claus Gittinger

Description:


This class knows how to read TIFF files and how to
write uncompressed TIFF files.

Implemented & Missing Features:

  - Only single image files are supported.
  - Not all formats are implemented, and of those that are, not all are tested.
    It should read with most rgb, palette, mono and greyscale images, 
    although the alpha channel is currently not supported and ignored.
    It supports reading of uncompressed, LZW, packbits and CCITT-G3 compressed images
    JPEG and many other formats are currently not implemented.

  - Only writing of uncompressed images is currently implemented.
    It should write (at least) mono, 8-bit palette and 24 bit rgb formats.

More formats will come... (will they ever be needed ?)

TODO (?): since I dont want to spend all of my life adding more formats here and
reinventing the wheel, this code should be changed to use the tiff library.
That would give us most formats and also writing capabilities for free.
Late note: 
    I hate C and interfacing to C libraries: it almost always leads to trouble
    w.r.t. memory leaks, non-reentrancy, non-interruptability etc.
    (we recently fixed a malloc-non-reentrant bug for some architecture...)
    So its robably better to do it all in a real programming language ;-)


Related information:

    Image
    Form
    Icon
    BlitImageReader
    FaceReader
    GIFReader
    JPEGReader
    PBMReader
    PCXReader
    ST80FormReader
    SunRasterReader
    TargaReader
    WindowsIconReader
    XBMReader
    XPMReader
    XWDReader

Class protocol:

initialization
o  initialize
install myself in the Image classes fileFormat table
for the `.tiff' and `.tif' extensions.

testing
o  canRepresent: anImage
return true, if anImage can be represented in my file format.
Any image is supported.

o  isValidImageFile: aFileName
return true, if aFileName contains a GIF image


Instance protocol:

private
o  decodeTiffTag: tagType numberType: numberType length: length

o  decompressPackBits: nIn from: srcBytes to: dstBytes startingAt: dstOffset

private-data reading
o  readCCITT3RLETiffImageData

o  readCCITT3RLEWTiffImageData

o  readCCITTGroup3TiffImageData
not really tested - all I got is a single fax from NeXT step

o  readCCITTGroup4TiffImageData

o  readCCITTRLEWTiffImageData

o  readDCSTiffImageData

o  readDeflateTiffImageData

o  readJBIGTiffImageData

o  readJPEGTiffImageData

o  readLZWTiffImageData
read LZW compressed tiff data; this method only
handles 3x8 rgb and 1x2 or 2x2 greyscale images.
For 2x2 greyscale images, the alpha plane is ignored.
(maybe other formats work also - its simply not
tested)

o  readNeXTJPEGTiffImageData

o  readNeXTRLE2TiffImageData

o  readNewJPEGTiffImageData

o  readPackbitsTiffImageData
this has only been tested with monochrome images

o  readPixarFilmTiffImageData

o  readPixarLogTiffImageData

o  readThunderScanTiffImageData

o  readTiffImageData

o  readUncompressedTiffImageData

private-reading
o  positionToStrip: stripNr

o  readBytes: n signed: isSigned
read n 8bit signed or unsigned integers and return them in an array or byteArray

o  readChars: n
read n characters and return them in a string

o  readDoubles: nFloats
read nFloats IEEE 32bit floats and return them in an array

o  readFloats: nFloats
read nFloats IEEE 32bit floats and return them in an array

o  readFracts: nFracts signed: isSigned
read nFracts fractions (2 32bit words) and return them in an array

o  readLongs: nLongs signed: isSigned
read nLongs signed or unsigned long numbers (32bit) and return them in an array

o  readShorts: nShorts signed: isSigned
read nShorts signed or unsigned short numbers (16bit) and return them in an array

private-writing
o  writeBitsPerSample
'bitsPerSample: ' print. bitsPerSample printNewline.
'store bitspersample at: ' print. outStream position printNewline.

o  writeColorMap

o  writeStripByteCounts
'stripByteCounts: ' print. stripByteCounts printNewline.
'store stripbytecounts at: ' print. outStream position printNewline.

o  writeStripOffsets
'stripOffsets: ' print. stripOffsets printNewline.
'store stripoffsets at: ' print. outStream position printNewline.

o  writeTag: tagType

o  writeTiffTag: tagType

o  writeUncompressedBits
write bits as one or multiple strips

reading
o  fromStream: aStream
read a stream containing a TIFF image.
Leave image description in instance variables.

writing
o  save: image onStream: aStream
save image as (uncompressed) TIFF file on aFileName



ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 21:19:26 GMT