org.foray.graphic
Class TIFFGraphic

java.lang.Object
  extended by org.foray.graphic.Graphic4a
      extended by org.foray.graphic.TIFFGraphic
All Implemented Interfaces:
org.axsl.graphic.Graphic

public class TIFFGraphic
extends Graphic4a

A TIFF image.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.axsl.graphic.Graphic
org.axsl.graphic.Graphic.Compression, org.axsl.graphic.Graphic.Type
 
Field Summary
static byte COMPRESSION_CCITT_GROUP_3
          Constant indicating that the image is compressed using CCITT Group 3.
static byte COMPRESSION_CCITT_GROUP_4
          Constant indicating that the image is compressed using CCITT Group 4.
static byte COMPRESSION_CCITT_ID
          Constant indicating that the image is compressed using CCITT ID.
static byte COMPRESSION_JPEG
          Constant indicating that the image is compressed using JPEG.
static byte COMPRESSION_LZW
          Constant indicating that the image is compressed using LZW.
static char COMPRESSION_PACKBITS
          Constant indicating that the image is compressed using Packbits.
static byte COMPRESSION_UNCOMPRESSED
          Constant indicating that the image is uncompressed.
static char COMPRESSION_UNCOMPRESSED_2
          Constant indicating that the image is uncompressed.
 
Fields inherited from class org.foray.graphic.Graphic4a
BIT_DEPTH_4, BIT_DEPTH_COLOR, BIT_DEPTH_GRAYSCALE, BIT_DEPTH_MONOCHROME
 
Constructor Summary
TIFFGraphic(GraphicServer4a server, URL url, BufferedInputStream bis)
          Constructor.
 
Method Summary
 int absoluteHeightReal()
          Returns the absolute height, in millipoints, of the graphic.
 int absoluteWidthReal()
          Returns the absolute width, in millipoints, of the graphic.
 ColorSpace getColorSpace()
           
 org.axsl.graphic.Graphic.Compression getCompressionType()
           
 byte[] getContent()
           
 org.axsl.graphic.Graphic.Type getGraphicType()
           
 String getMimeType()
           
 String getName()
           
 byte[] getRawSamples()
           
 int getStripCount()
          Return the strip count.
 Color getTransparentColor()
           
 boolean isInverted()
           
 boolean isTransparent()
           
protected  void loadImage()
          Load the original TIFF data.
protected  void parseBasics()
          This abstract method is implemented in subclasses to initiate parsing of enough of the image for it to be used in layout.
 int pixelHeight()
           
 int pixelWidth()
           
 
Methods inherited from class org.foray.graphic.Graphic4a
absoluteHeight, absoluteWidth, canMakeGraphicOutput, close, getBitDepth, getBitsPerComponent, getContentSize, getGraphicOutput, getInputStream, getLinks, getLogger, getRawColorSpace, getServer, getUrl, isImageLoaded, isValid, loadImageWrapper, maxBytesToParseBasics, parseBasicsWrapper, setBasicsParsed, setBitDepth, setContent, setImageLoaded, setInputStream, setLinks, setValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPRESSION_UNCOMPRESSED

public static final byte COMPRESSION_UNCOMPRESSED
Constant indicating that the image is uncompressed.

See Also:
"Graphics File Formats, 2nd Edition, O'Reilly, 1996, p. 891.", COMPRESSION_UNCOMPRESSED_2, Constant Field Values

COMPRESSION_CCITT_ID

public static final byte COMPRESSION_CCITT_ID
Constant indicating that the image is compressed using CCITT ID.

See Also:
"Graphics File Formats, 2nd Edition, O'Reilly, 1996, p. 891.", Constant Field Values

COMPRESSION_CCITT_GROUP_3

public static final byte COMPRESSION_CCITT_GROUP_3
Constant indicating that the image is compressed using CCITT Group 3.

See Also:
"Graphics File Formats, 2nd Edition, O'Reilly, 1996, p. 891.", Constant Field Values

COMPRESSION_CCITT_GROUP_4

public static final byte COMPRESSION_CCITT_GROUP_4
Constant indicating that the image is compressed using CCITT Group 4.

See Also:
"Graphics File Formats, 2nd Edition, O'Reilly, 1996, p. 891.", Constant Field Values

COMPRESSION_LZW

public static final byte COMPRESSION_LZW
Constant indicating that the image is compressed using LZW.

See Also:
"Graphics File Formats, 2nd Edition, O'Reilly, 1996, p. 891.", Constant Field Values

COMPRESSION_JPEG

public static final byte COMPRESSION_JPEG
Constant indicating that the image is compressed using JPEG.

See Also:
"Graphics File Formats, 2nd Edition, O'Reilly, 1996, p. 891.", Constant Field Values

COMPRESSION_UNCOMPRESSED_2

public static final char COMPRESSION_UNCOMPRESSED_2
Constant indicating that the image is uncompressed.

See Also:
"Graphics File Formats, 2nd Edition, O'Reilly, 1996, p. 891.", COMPRESSION_UNCOMPRESSED, Constant Field Values

COMPRESSION_PACKBITS

public static final char COMPRESSION_PACKBITS
Constant indicating that the image is compressed using Packbits.

See Also:
"Graphics File Formats, 2nd Edition, O'Reilly, 1996, p. 891.", Constant Field Values
Constructor Detail

TIFFGraphic

public TIFFGraphic(GraphicServer4a server,
                   URL url,
                   BufferedInputStream bis)
Constructor.

Parameters:
server - The parent graphic server.
url - The URL which contains the graphic content.
bis - The reusable input stream containing the bytes from url.
Method Detail

getCompressionType

public org.axsl.graphic.Graphic.Compression getCompressionType()
                                                        throws org.axsl.graphic.GraphicException
Throws:
org.axsl.graphic.GraphicException

getGraphicType

public org.axsl.graphic.Graphic.Type getGraphicType()

getMimeType

public String getMimeType()

getName

public String getName()

parseBasics

protected void parseBasics()
                    throws IOException
Description copied from class: Graphic4a

This abstract method is implemented in subclasses to initiate parsing of enough of the image for it to be used in layout. This method is responsible to:

  1. store the image's intrinsic width in Graphic.pixelWidth()
  2. store the image's intrinsic height in Graphic.pixelHeight()

The housekeeping work related to resetting the buffer, handling IOExceptions, and managing whether this method should be run are handled elsewhere. In short, this method does not need to address the details handled there.

Specified by:
parseBasics in class Graphic4a
Throws:
IOException - For IO errors during reading of the file.

loadImage

protected void loadImage()
                  throws org.axsl.graphic.GraphicException
Load the original TIFF data. This loads only strip 1 of the original TIFF data.

Specified by:
loadImage in class Graphic4a
Throws:
org.axsl.graphic.GraphicException - For IO Errors.

getStripCount

public int getStripCount()
Return the strip count.

Returns:
the stripCount.

getRawSamples

public byte[] getRawSamples()
                     throws org.axsl.graphic.GraphicException
Throws:
org.axsl.graphic.GraphicException

getContent

public byte[] getContent()
                  throws org.axsl.graphic.GraphicException
Specified by:
getContent in interface org.axsl.graphic.Graphic
Overrides:
getContent in class Graphic4a
Throws:
org.axsl.graphic.GraphicException

absoluteWidthReal

public int absoluteWidthReal()
                      throws org.axsl.graphic.GraphicException
Description copied from class: Graphic4a
Returns the absolute width, in millipoints, of the graphic.

Specified by:
absoluteWidthReal in class Graphic4a
Returns:
The absolute width, in millipoints, of this graphic, if known. If not known, returns -1.
Throws:
org.axsl.graphic.GraphicException - For errors during reading of image file.

absoluteHeightReal

public int absoluteHeightReal()
                       throws org.axsl.graphic.GraphicException
Description copied from class: Graphic4a
Returns the absolute height, in millipoints, of the graphic.

Specified by:
absoluteHeightReal in class Graphic4a
Returns:
The absolute height, in millipoints, of this graphic, if known. If not known, returns -1.
Throws:
org.axsl.graphic.GraphicException - For errors during reading of image file.

isInverted

public boolean isInverted()

getColorSpace

public ColorSpace getColorSpace()
                         throws org.axsl.graphic.GraphicException
Throws:
org.axsl.graphic.GraphicException

isTransparent

public boolean isTransparent()
                      throws org.axsl.graphic.GraphicException
Throws:
org.axsl.graphic.GraphicException

getTransparentColor

public Color getTransparentColor()
                          throws org.axsl.graphic.GraphicException
Throws:
org.axsl.graphic.GraphicException

pixelWidth

public int pixelWidth()
               throws org.axsl.graphic.GraphicException
Throws:
org.axsl.graphic.GraphicException

pixelHeight

public int pixelHeight()
                throws org.axsl.graphic.GraphicException
Throws:
org.axsl.graphic.GraphicException


Copyright © 2017. All rights reserved.