com.lowagie.text
Class Jpeg

java.lang.Object
  extended bycom.lowagie.text.Rectangle
      extended bycom.lowagie.text.Image
          extended bycom.lowagie.text.Jpeg
All Implemented Interfaces:
Element, MarkupAttributes

public class Jpeg
extends Image
implements Element

An Jpeg is the representation of a graphic element (JPEG) that has to be inserted into the document

See Also:
Element, Image

Field Summary
static byte[] JFIF_ID
          sequence that is used in all Jpeg files
static int M_APP0
          Marker value
static int M_APPE
          Marker value
static int NOPARAM_MARKER
          This is a type of marker.
static int[] NOPARAM_MARKERS
          Jpeg markers without additional parameters.
static int NOT_A_MARKER
          This is a type of marker.
static int UNSUPPORTED_MARKER
          This is a type of marker.
static int[] UNSUPPORTED_MARKERS
          Unsupported Jpeg markers.
static int VALID_MARKER
          This is a type of marker.
static int[] VALID_MARKERS
          Acceptable Jpeg markers.
 
Fields inherited from class com.lowagie.text.Image
absoluteX, absoluteY, alignment, alt, annotation, AX, AY, bpc, BX, BY, colorspace, CX, CY, DEFAULT, deflated, dpiX, dpiY, DX, DY, imageMask, indentationLeft, indentationRight, interpolation, invert, layer, LEFT, markupAttributes, mask, MIDDLE, mySerialId, ORIGINAL_BMP, ORIGINAL_GIF, ORIGINAL_JPEG, ORIGINAL_NONE, ORIGINAL_PNG, ORIGINAL_PS, ORIGINAL_TIFF, ORIGINAL_WMF, originalData, originalType, plainHeight, plainWidth, profile, rawData, RIGHT, rotation, scaledHeight, scaledWidth, serialId, spacingAfter, spacingBefore, template, TEXTWRAP, transparency, type, UNDERLYING, url
 
Fields inherited from class com.lowagie.text.Rectangle
background, border, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, BOTTOM, BOX, color, llx, lly, NO_BORDER, TOP, UNDEFINED, urx, ury, useVariableBorders
 
Fields inherited from interface com.lowagie.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, GRAPHIC, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE
 
Constructor Summary
  Jpeg(byte[] img)
          Constructs a Jpeg-object from memory.
  Jpeg(byte[] img, float width, float height)
          Constructs a Jpeg-object from memory.
(package private) Jpeg(Image image)
           
  Jpeg(String filename)
          Deprecated. use Image.getInstance(...) to create an Image
  Jpeg(String filename, float width, float height)
          Deprecated. use Image.getInstance(...) to create an Image
  Jpeg(URL url)
          Constructs a Jpeg-object, using an url.
  Jpeg(URL url, float width, float height)
          Deprecated. use Image.getInstance(...) to create an Image
 
Method Summary
private static int getShort(InputStream is)
          Reads a short from the InputStream.
private static int marker(int marker)
          Returns a type of marker.
private  void processParameters()
          This method checks if the image is a valid JPEG and processes some parameters.
 
Methods inherited from class com.lowagie.text.Image
absoluteX, absoluteY, alignment, alt, annotation, bpc, colorspace, getAdditional, getDirectReference, getDpiX, getDpiY, getICCProfile, getImageMask, getImageRotation, getInitialRotation, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getLayer, getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, getMySerialId, getOriginalData, getOriginalType, getSerialId, getTransparency, getWidthPercentage, getXYRatio, hasAbsolutePosition, hasAbsoluteX, hasICCProfile, indentationLeft, indentationRight, isDeflated, isImgRaw, isImgTemplate, isInterpolation, isInverted, isInvertMask, isJpeg, isMask, isMaskCandidate, isSmask, isTag, makeMask, matrix, plainHeight, plainWidth, rawData, scaleAbsolute, scaleAbsoluteHeight, scaleAbsoluteWidth, scaledHeight, scaledWidth, scalePercent, scalePercent, scaleToFit, setAbsolutePosition, setAdditional, setAlignment, setAlt, setAnnotation, setDeflated, setDirectReference, setDpi, setImageMask, setIndentationLeft, setIndentationRight, setInitialRotation, setInterpolation, setInverted, setInvertMask, setLayer, setMarkupAttribute, setMarkupAttributes, setOriginalData, setOriginalType, setRotation, setRotationDegrees, setSmask, setSpacingAfter, setSpacingBefore, setTemplateData, setTransparency, setUrl, setWidthPercentage, setXYRatio, simplifyColorspace, skip, spacingAfter, spacingBefore, tagICC, templateData, toURL, type, unEscapeURL, url
 
Methods inherited from class com.lowagie.text.Rectangle
backgroundColor, border, borderColor, borderWidth, bottom, bottom, cloneNonPositionParameters, disableBorderSide, enableBorderSide, getBorderColorBottom, getBorderColorLeft, getBorderColorRight, getBorderColorTop, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getChunks, getRotation, grayFill, hasBorder, hasBorders, height, isUseVariableBorders, left, left, normalize, process, rectangle, right, right, rotate, setBackgroundColor, setBorder, setBorderColor, setBorderColorBottom, setBorderColorLeft, setBorderColorRight, setBorderColorTop, setBorderWidth, setBorderWidthBottom, setBorderWidthLeft, setBorderWidthRight, setBorderWidthTop, setBottom, setGrayFill, setLeft, setRight, setTop, setUseVariableBorders, softCloneNonPositionParameters, top, top, toString, width
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.lowagie.text.Element
getChunks, process, toString, type
 

Field Detail

NOT_A_MARKER

public static final int NOT_A_MARKER
This is a type of marker.

See Also:
Constant Field Values

VALID_MARKER

public static final int VALID_MARKER
This is a type of marker.

See Also:
Constant Field Values

VALID_MARKERS

public static final int[] VALID_MARKERS
Acceptable Jpeg markers.


UNSUPPORTED_MARKER

public static final int UNSUPPORTED_MARKER
This is a type of marker.

See Also:
Constant Field Values

UNSUPPORTED_MARKERS

public static final int[] UNSUPPORTED_MARKERS
Unsupported Jpeg markers.


NOPARAM_MARKER

public static final int NOPARAM_MARKER
This is a type of marker.

See Also:
Constant Field Values

NOPARAM_MARKERS

public static final int[] NOPARAM_MARKERS
Jpeg markers without additional parameters.


M_APP0

public static final int M_APP0
Marker value

See Also:
Constant Field Values

M_APPE

public static final int M_APPE
Marker value

See Also:
Constant Field Values

JFIF_ID

public static final byte[] JFIF_ID
sequence that is used in all Jpeg files

Constructor Detail

Jpeg

Jpeg(Image image)

Jpeg

public Jpeg(URL url)
     throws BadElementException,
            IOException
Constructs a Jpeg-object, using an url.

Parameters:
url - the URL where the image can be found
Throws:
BadElementException
IOException

Jpeg

public Jpeg(URL url,
            float width,
            float height)
     throws BadElementException,
            IOException
Deprecated. use Image.getInstance(...) to create an Image

Constructs a Jpeg-object, using an url.

Parameters:
url - the URL where the image can be found.
width - new width of the Jpeg
height - new height of the Jpeg
Throws:
BadElementException
IOException

Jpeg

public Jpeg(String filename)
     throws BadElementException,
            MalformedURLException,
            IOException
Deprecated. use Image.getInstance(...) to create an Image

Constructs a Jpeg-object, using a filename.

Parameters:
filename - a String-representation of the file that contains the Image.
Throws:
BadElementException
MalformedURLException
IOException

Jpeg

public Jpeg(String filename,
            float width,
            float height)
     throws BadElementException,
            MalformedURLException,
            IOException
Deprecated. use Image.getInstance(...) to create an Image

Constructs a Jpeg-object, using a filename.

Parameters:
filename - a String-representation of the file that contains the Image.
width - new width of the Jpeg
height - new height of the Jpeg
Throws:
BadElementException
MalformedURLException
IOException

Jpeg

public Jpeg(byte[] img)
     throws BadElementException,
            IOException
Constructs a Jpeg-object from memory.

Parameters:
img - the memory image
Throws:
BadElementException
IOException

Jpeg

public Jpeg(byte[] img,
            float width,
            float height)
     throws BadElementException,
            IOException
Constructs a Jpeg-object from memory.

Parameters:
img - the memory image.
width - the width you want the image to have
height - the height you want the image to have
Throws:
BadElementException
IOException
Method Detail

getShort

private static final int getShort(InputStream is)
                           throws IOException
Reads a short from the InputStream.

Parameters:
is - the InputStream
Returns:
an int
Throws:
IOException

marker

private static final int marker(int marker)
Returns a type of marker.

Parameters:
marker - an int
Returns:
a type: VALID_MARKER, UNSUPPORTED_MARKER or NOPARAM_MARKER

processParameters

private void processParameters()
                        throws BadElementException,
                               IOException
This method checks if the image is a valid JPEG and processes some parameters.

Throws:
BadElementException
IOException