com.lowagie.text

Class Jpeg

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

AX, AY, BX, BY, CX, CY, DEFAULT, DX, DY, LEFT, MIDDLE, ORIGINAL_BMP, ORIGINAL_GIF, ORIGINAL_JPEG, ORIGINAL_NONE, ORIGINAL_PNG, ORIGINAL_PS, ORIGINAL_TIFF, ORIGINAL_WMF, RIGHT, TEXTWRAP, UNDERLYING, XYRatio, absoluteX, absoluteY, additional, alignment, alt, annotation, bpc, colorspace, deflated, dpiX, dpiY, imageMask, indentationLeft, indentationRight, interpolation, invert, layer, markupAttributes, mask, mySerialId, originalData, originalType, plainHeight, plainWidth, profile, rawData, rotation, scaledHeight, scaledWidth, serialId, smask, spacingAfter, spacingBefore, template, transparency, type, url, widthPercentage

Fields inherited from class com.lowagie.text.Rectangle

BOTTOM, BOX, LEFT, NO_BORDER, RIGHT, TOP, UNDEFINED, background, border, borderColorBottom, borderColorLeft, borderColorRight, borderColorTop, borderWidth, borderWidthBottom, borderWidthLeft, borderWidthRight, borderWidthTop, color, grayFill, llx, lly, markupAttributes, rotation, 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, CCITTG3_1D, CCITTG3_2D, CCITTG4, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, 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(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
Jpeg(byte[] img)
Constructs a Jpeg-object from memory.
Jpeg(byte[] img, float width, float height)
Constructs a Jpeg-object from memory.
Jpeg(Image image)
Constructs an Image -object, using an url .

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, getDpiX, getDpiY, getICCProfile, getImageMask, 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, isInvertMask, isInverted, isJpeg, isMask, isMaskCandidate, isSmask, isTag, makeMask, matrix, plainHeight, plainWidth, rawData, scaleAbsolute, scaleAbsoluteHeight, scaleAbsoluteWidth, scalePercent, scalePercent, scaleToFit, scaledHeight, scaledWidth, setAbsolutePosition, setAdditional, setAlignment, setAlt, setAnnotation, setDeflated, setDpi, setImageMask, setIndentationLeft, setIndentationRight, setInterpolation, setInvertMask, setInverted, setLayer, setMarkupAttribute, setMarkupAttributes, setOriginalData, setOriginalType, setRotation, setRotationDegrees, setSmask, setSpacingAfter, setSpacingBefore, setTemplateData, setTransparency, setUrl, setWidthPercentage, setXYRatio, skip, spacingAfter, spacingBefore, tagICC, templateData, toURL, type, 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, getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, getRotation, getVariableBorderWidth, 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, setMarkupAttribute, setMarkupAttributes, setRight, setTop, setUseVariableBorders, top, top, type, updateBorderBasedOnWidth, width

Field Details

JFIF_ID

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

M_APP0

public static final int M_APP0
Marker value
Field Value:
224

M_APPE

public static final int M_APPE
Marker value
Field Value:
238

NOPARAM_MARKER

public static final int NOPARAM_MARKER
This is a type of marker.
Field Value:
2

NOPARAM_MARKERS

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

NOT_A_MARKER

public static final int NOT_A_MARKER
This is a type of marker.
Field Value:
-1

UNSUPPORTED_MARKER

public static final int UNSUPPORTED_MARKER
This is a type of marker.
Field Value:
1

UNSUPPORTED_MARKERS

public static final int[] UNSUPPORTED_MARKERS
Unsupported Jpeg markers.

VALID_MARKER

public static final int VALID_MARKER
This is a type of marker.
Field Value:
0

VALID_MARKERS

public static final int[] VALID_MARKERS
Acceptable Jpeg markers.

Constructor Details

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.

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

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

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

Jpeg

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

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

Jpeg

(package private)  Jpeg(Image image)
Constructs an Image -object, using an url .
Parameters:
image - another Image object.

Method Details

getShort

private static final int getShort(InputStream is)
            throws IOException
Reads a short from the InputStream.
Parameters:
is - the InputStream
Returns:
an int

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.