org.foray.pdf.object
Class PDFXImage

java.lang.Object
  extended by org.foray.pdf.object.PDFObject
      extended by org.foray.pdf.object.PDFStream
          extended by org.foray.pdf.object.PDFXObject
              extended by org.foray.pdf.object.PDFXImage

public class PDFXImage
extends PDFXObject

A sampled image that is to be embedded in a PDF File. Images in PDF are XObjects (external objects).

See Also:
PDFXObject

Field Summary
 
Fields inherited from class org.foray.pdf.object.PDFObject
EOL, MSG_EOL, XREF_EOL
 
Constructor Summary
PDFXImage(PDFDocument doc, org.axsl.graphic.Graphic graphic)
          Create a sampled-image Xobject.
 
Method Summary
 org.axsl.graphic.Graphic getGraphic()
          Return the encapsulated graphic.
 float getHorizontalScaling(Rectangle2D.Float contentRectangle)
          Returns the horizontal scaling factor that should be used for a specific "Do" for a specific content rectangle.
 float getVerticalScaling(Rectangle2D.Float contentRectangle)
          Returns the vertical scaling factor that should be used for a specific "Do" for a specific content rectangle.
protected  String specialXObjectDictEntries()
          Subclasses return any specialized dictionary entries here, so that they are included when writing the stream dictionary.
protected  void xObjectContent()
          Add the content specific to this type of XObject to the content stream.
protected  String xObjectSubtype()
          Returns the subtype for this XObject.
 
Methods inherited from class org.foray.pdf.object.PDFXObject
addStreamFilters, finalizeStreamContent, getXObjectName, makeXObject, specialStreamDictEntries
 
Methods inherited from class org.foray.pdf.object.PDFStream
add, addDefaultFilters, addEncryption, addFilter, addFilter, applyFilters, getDataLength, getOutputStream, output, outputStreamData, setData, setOutputStream, toPDF
 
Methods inherited from class org.foray.pdf.object.PDFObject
bufferToByteArray, byteArrayToStream, getCharsPerLine, getGeneration, getLogger, getNumber, getPDFDocument, pdfID, pdfReference, setNumber, stringToByteArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFXImage

public PDFXImage(PDFDocument doc,
                 org.axsl.graphic.Graphic graphic)
          throws org.axsl.graphic.GraphicException
Create a sampled-image Xobject.

Parameters:
doc - The parent PDF document.
graphic - The graphic to be encapsulated.
Throws:
org.axsl.graphic.GraphicException - For errors getting the appropriate filter.
Method Detail

xObjectSubtype

protected String xObjectSubtype()
Description copied from class: PDFXObject
Returns the subtype for this XObject.

Specified by:
xObjectSubtype in class PDFXObject
Returns:
The subtype for this XObject.

xObjectContent

protected void xObjectContent()
                       throws org.axsl.pdf.PdfException
Description copied from class: PDFXObject
Add the content specific to this type of XObject to the content stream.

Specified by:
xObjectContent in class PDFXObject
Throws:
org.axsl.pdf.PdfException - For errors in the graphic or when writing to the stream.

specialXObjectDictEntries

protected String specialXObjectDictEntries()
Description copied from class: PDFXObject
Subclasses return any specialized dictionary entries here, so that they are included when writing the stream dictionary.

Specified by:
specialXObjectDictEntries in class PDFXObject
Returns:
The dictonary entries specific to this type of XObject.

getHorizontalScaling

public float getHorizontalScaling(Rectangle2D.Float contentRectangle)
Description copied from class: PDFXObject
Returns the horizontal scaling factor that should be used for a specific "Do" for a specific content rectangle. This is used in transformations that are outside the actual XObject definition, so that the XObject can be reused in other places, using different content rectangles. This abstraction is needed because bitmapped graphics are specified in image space, and XForm graphics (SVG and EPS) are specified in form space, which require radically different scaling mechanisms.

Specified by:
getHorizontalScaling in class PDFXObject
Parameters:
contentRectangle - The content rectangle into which the graphic will be scaled.
Returns:
The horizontal scaling factor that should be applied to this graphic when converting from its native space to user space.

getVerticalScaling

public float getVerticalScaling(Rectangle2D.Float contentRectangle)
Description copied from class: PDFXObject
Returns the vertical scaling factor that should be used for a specific "Do" for a specific content rectangle. See PDFXObject.getHorizontalScaling(java.awt.geom.Rectangle2D.Float) for an explanation of the need for this computation.

Specified by:
getVerticalScaling in class PDFXObject
Parameters:
contentRectangle - The content rectangle into which the graphic will be scaled.
Returns:
The vertical scaling factor that should be applied to this graphic when converting from its native space to user space.

getGraphic

public org.axsl.graphic.Graphic getGraphic()
Description copied from class: PDFXObject
Return the encapsulated graphic.

Specified by:
getGraphic in class PDFXObject
Returns:
The graphic.


Copyright © 2017. All rights reserved.