Package pdf
Class PDFImage
- java.lang.Object
-
- pdf.PDFObject
-
- pdf.PDFStream
-
- pdf.PDFImage
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.io.Serializable
public class PDFImage extends PDFStream implements java.awt.image.ImageObserver, java.io.Serializable
This implements the Image XObject. Calling one of the
drawImagemethods ofPDFGraphicswill put all the necessary code into the pdf file, and the image will be encoded in ascii base 85, then deflated in zip format.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class pdf.PDFObject
objser, pdfDocument
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetHeight()Get the value of height.java.lang.StringgetName()Get the nameintgetWidth()Get the value of width.static java.lang.StringhandlePixel(int x, int y, int p)Converts a pixel to a hex stringbooleanimageUpdate(java.awt.Image img, int infoflags, int x, int y, int w, int h)DescribeimageUpdatemethod here.voidsetHeight(int v)Set the value of height.voidsetImage(java.awt.Image img, int x, int y, int w, int h, java.awt.image.ImageObserver obs)Set the imagevoidsetName(java.lang.String n)Set the namevoidsetWidth(int v)Set the value of width.voidwrite(java.io.OutputStream os)Compression needs to be improved herevoidwriteStream(java.io.OutputStream os)Writes the image to the stream-
Methods inherited from class pdf.PDFStream
getDeflate, getOutputStream, getStream, getWriter, setDeflate
-
Methods inherited from class pdf.PDFObject
getPDFDocument, getSerialID, getType, toArray, toString, writeEnd, writeStart
-
-
-
-
Constructor Detail
-
PDFImage
public PDFImage()
Creates a newPDFImageinstance.
-
PDFImage
public PDFImage(java.awt.Image img)
Creates a newPDFImageinstance.- Parameters:
img- anImagevalue
-
PDFImage
public PDFImage(java.awt.Image img, int x, int y, int w, int h, java.awt.image.ImageObserver obs)Creates a newPDFImageinstance.- Parameters:
img- anImagevaluex- anintvaluey- anintvaluew- anintvalueh- anintvalueobs- anImageObservervalue
-
-
Method Detail
-
getWidth
public int getWidth()
Get the value of width.- Returns:
- value of width.
-
setWidth
public void setWidth(int v)
Set the value of width.- Parameters:
v- Value to assign to width.
-
getHeight
public int getHeight()
Get the value of height.- Returns:
- value of height.
-
setHeight
public void setHeight(int v)
Set the value of height.- Parameters:
v- Value to assign to height.
-
setName
public void setName(java.lang.String n)
Set the name- Parameters:
n- aStringvalue
-
getName
public java.lang.String getName()
Get the name- Returns:
- a
Stringvalue
-
setImage
public void setImage(java.awt.Image img, int x, int y, int w, int h, java.awt.image.ImageObserver obs)Set the image- Parameters:
img- anImagevaluex- anintvaluey- anintvaluew- anintvalueh- anintvalueobs- anImageObservervalue
-
writeStream
public void writeStream(java.io.OutputStream os) throws java.io.IOExceptionWrites the image to the stream- Overrides:
writeStreamin classPDFStream- Parameters:
os- anOutputStreamvalue- Throws:
java.io.IOException- if an error occurs
-
write
public void write(java.io.OutputStream os) throws java.io.IOExceptionCompression needs to be improved here
-
handlePixel
public static java.lang.String handlePixel(int x, int y, int p)Converts a pixel to a hex string
- Parameters:
x- anintvaluey- anintvaluep- anintvalue- Returns:
- a
Stringvalue
-
imageUpdate
public boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int w, int h)DescribeimageUpdatemethod here.- Specified by:
imageUpdatein interfacejava.awt.image.ImageObserver- Parameters:
img- anImagevalueinfoflags- anintvaluex- anintvaluey- anintvaluew- anintvalueh- anintvalue- Returns:
- a
booleanvalue
-
-