public class PSImageUtils
extends java.lang.Object
Constructor and Description |
---|
PSImageUtils() |
Modifier and Type | Method and Description |
---|---|
static int[] |
getRGB(java.awt.image.RenderedImage img,
int startX,
int startY,
int w,
int h,
int[] rgbArray,
int offset,
int scansize)
Extracts a packed RGB integer array of a RenderedImage.
|
static void |
paintForm(PSResource form,
java.awt.geom.Dimension2D formDimensions,
java.awt.geom.Rectangle2D targetRect,
PSGenerator gen)
Paints a reusable image (previously added as a PostScript form).
|
static void |
paintForm(PSResource form,
java.awt.geom.Rectangle2D targetRect,
PSGenerator gen)
Deprecated.
Please use
paintForm(PSResource, Dimension2D, Rectangle2D, PSGenerator)
instead. |
static void |
paintReusableImage(java.lang.String formName,
java.awt.geom.Rectangle2D targetRect,
PSGenerator gen)
Deprecated.
Please use
paintForm(PSResource, Dimension2D, Rectangle2D, PSGenerator)
instead. |
static void |
renderBitmapImage(java.awt.image.RenderedImage img,
float x,
float y,
float w,
float h,
PSGenerator gen)
Renders a bitmap image to PostScript.
|
static void |
renderEPS(byte[] rawEPS,
java.lang.String name,
float x,
float y,
float w,
float h,
float bboxx,
float bboxy,
float bboxw,
float bboxh,
PSGenerator gen)
Deprecated.
Please use the variant with the InputStream as parameter
|
static void |
renderEPS(java.io.InputStream in,
java.lang.String name,
java.awt.geom.Rectangle2D viewport,
java.awt.geom.Rectangle2D bbox,
PSGenerator gen)
Places an EPS file in the PostScript stream.
|
static void |
translateAndScale(PSGenerator gen,
java.awt.geom.Dimension2D imageDimensions,
java.awt.geom.Rectangle2D targetRect)
Generates commands to modify the current transformation matrix so an image fits
into a given rectangle.
|
static void |
writeImage(byte[] img,
java.awt.Dimension imgDim,
java.lang.String imgDescription,
java.awt.geom.Rectangle2D targetRect,
boolean isJPEG,
java.awt.color.ColorSpace colorSpace,
PSGenerator gen)
Deprecated.
Please use the variant with the more versatile ImageEncoder as parameter
|
static void |
writeImage(ImageEncoder encoder,
java.awt.Dimension imgDim,
java.lang.String imgDescription,
java.awt.geom.Rectangle2D targetRect,
java.awt.image.ColorModel colorModel,
PSGenerator gen)
Writes a bitmap image to the PostScript stream.
|
static void |
writeImage(ImageEncoder encoder,
java.awt.Dimension imgDim,
java.lang.String imgDescription,
java.awt.geom.Rectangle2D targetRect,
java.awt.color.ColorSpace colorSpace,
int bitsPerComponent,
boolean invertImage,
PSGenerator gen)
Writes a bitmap image to the PostScript stream.
|
static PSResource |
writeReusableImage(byte[] img,
java.awt.Dimension imgDim,
java.lang.String formName,
java.lang.String imageDescription,
boolean isJPEG,
java.awt.color.ColorSpace colorSpace,
PSGenerator gen)
Deprecated.
Please use
FormGenerator |
protected static PSResource |
writeReusableImage(ImageEncoder encoder,
java.awt.Dimension imgDim,
java.lang.String formName,
java.lang.String imageDescription,
java.awt.color.ColorSpace colorSpace,
boolean invertImage,
PSGenerator gen)
Deprecated.
Please use
FormGenerator |
public static void writeImage(byte[] img, java.awt.Dimension imgDim, java.lang.String imgDescription, java.awt.geom.Rectangle2D targetRect, boolean isJPEG, java.awt.color.ColorSpace colorSpace, PSGenerator gen) throws java.io.IOException
img
- the bitmap image as a byte arrayimgDim
- the dimensions of the imageimgDescription
- the name of the imagetargetRect
- the target rectangle to place the image inisJPEG
- true if "img" contains a DCT-encoded images, false if "img" contains the
decoded bitmapcolorSpace
- the color space of the imagegen
- the PostScript generatorjava.io.IOException
- In case of an I/O exceptionpublic static void writeImage(ImageEncoder encoder, java.awt.Dimension imgDim, java.lang.String imgDescription, java.awt.geom.Rectangle2D targetRect, java.awt.color.ColorSpace colorSpace, int bitsPerComponent, boolean invertImage, PSGenerator gen) throws java.io.IOException
encoder
- the image encoderimgDim
- the dimensions of the imageimgDescription
- the name of the imagetargetRect
- the target rectangle to place the image incolorSpace
- the color space of the imagebitsPerComponent
- the number of bits per componentinvertImage
- true if the image shall be invertedgen
- the PostScript generatorjava.io.IOException
- In case of an I/O exceptionpublic static void writeImage(ImageEncoder encoder, java.awt.Dimension imgDim, java.lang.String imgDescription, java.awt.geom.Rectangle2D targetRect, java.awt.image.ColorModel colorModel, PSGenerator gen) throws java.io.IOException
encoder
- the image encoderimgDim
- the dimensions of the imageimgDescription
- the name of the imagetargetRect
- the target rectangle to place the image incolorModel
- the color model of the imagegen
- the PostScript generatorjava.io.IOException
- In case of an I/O exceptionpublic static void renderBitmapImage(java.awt.image.RenderedImage img, float x, float y, float w, float h, PSGenerator gen) throws java.io.IOException
img
- image to renderx
- x positiony
- y positionw
- widthh
- heightgen
- PS generatorjava.io.IOException
- In case of an I/O problem while rendering the imagepublic static PSResource writeReusableImage(byte[] img, java.awt.Dimension imgDim, java.lang.String formName, java.lang.String imageDescription, boolean isJPEG, java.awt.color.ColorSpace colorSpace, PSGenerator gen) throws java.io.IOException
FormGenerator
img
- the raw bitmap dataimgDim
- the dimensions of the imageformName
- the name of the PostScript form to useimageDescription
- a description of the image added as a DSC Title commentisJPEG
- true if "img" contains a DCT-encoded images, false if "img" contains the
decoded bitmapcolorSpace
- the color space of the imagegen
- the PostScript generatorjava.io.IOException
- In case of an I/O exceptionprotected static PSResource writeReusableImage(ImageEncoder encoder, java.awt.Dimension imgDim, java.lang.String formName, java.lang.String imageDescription, java.awt.color.ColorSpace colorSpace, boolean invertImage, PSGenerator gen) throws java.io.IOException
FormGenerator
encoder
- the ImageEncoder that will provide the raw bitmap dataimgDim
- the dimensions of the imageformName
- the name of the PostScript form to useimageDescription
- a description of the image added as a DSC Title commentcolorSpace
- the color space of the imageinvertImage
- true if the image shall be invertedgen
- the PostScript generatorjava.io.IOException
- In case of an I/O exceptionpublic static void paintReusableImage(java.lang.String formName, java.awt.geom.Rectangle2D targetRect, PSGenerator gen) throws java.io.IOException
paintForm(PSResource, Dimension2D, Rectangle2D, PSGenerator)
instead.formName
- the name of the PostScript form implementing the imagetargetRect
- the target rectangle to place the image ingen
- the PostScript generatorjava.io.IOException
- In case of an I/O exceptionpublic static void paintForm(PSResource form, java.awt.geom.Rectangle2D targetRect, PSGenerator gen) throws java.io.IOException
paintForm(PSResource, Dimension2D, Rectangle2D, PSGenerator)
instead.form
- the PostScript form resource implementing the imagetargetRect
- the target rectangle to place the image ingen
- the PostScript generatorjava.io.IOException
- In case of an I/O exceptionpublic static void paintForm(PSResource form, java.awt.geom.Dimension2D formDimensions, java.awt.geom.Rectangle2D targetRect, PSGenerator gen) throws java.io.IOException
form
- the PostScript form resource implementing the imageformDimensions
- the original dimensions of the formtargetRect
- the target rectangle to place the image ingen
- the PostScript generatorjava.io.IOException
- In case of an I/O exceptionpublic static void translateAndScale(PSGenerator gen, java.awt.geom.Dimension2D imageDimensions, java.awt.geom.Rectangle2D targetRect) throws java.io.IOException
gen
- the PostScript generatorimageDimensions
- the image's dimensionstargetRect
- the target rectanglejava.io.IOException
- if an I/O error occurspublic static int[] getRGB(java.awt.image.RenderedImage img, int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize)
img
- the imagestartX
- the starting X coordinatestartY
- the starting Y coordinatew
- the width of the cropped imageh
- the height of the cropped imagergbArray
- the prepared integer array to write tooffset
- offset in the target arrayscansize
- width of a row in the target arraypublic static void renderEPS(byte[] rawEPS, java.lang.String name, float x, float y, float w, float h, float bboxx, float bboxy, float bboxw, float bboxh, PSGenerator gen) throws java.io.IOException
rawEPS
- byte array containing the raw EPS dataname
- name for the EPS documentx
- x-coordinate of viewport in pointsy
- y-coordinate of viewport in pointsw
- width of viewport in pointsh
- height of viewport in pointsbboxx
- x-coordinate of EPS bounding box in pointsbboxy
- y-coordinate of EPS bounding box in pointsbboxw
- width of EPS bounding box in pointsbboxh
- height of EPS bounding box in pointsgen
- the PS generatorjava.io.IOException
- in case an I/O error happens during outputpublic static void renderEPS(java.io.InputStream in, java.lang.String name, java.awt.geom.Rectangle2D viewport, java.awt.geom.Rectangle2D bbox, PSGenerator gen) throws java.io.IOException
in
- the InputStream that contains the EPS streamname
- name for the EPS documentviewport
- the viewport in points in which to place the EPSbbox
- the EPS bounding box in pointsgen
- the PS generatorjava.io.IOException
- in case an I/O error happens during outputCopyright 1999-2012 The Apache Software Foundation. All Rights Reserved.