Package org.apache.fop.afp
Class AFPPaintingState
- java.lang.Object
-
- org.apache.fop.util.AbstractPaintingState
-
- org.apache.fop.afp.AFPPaintingState
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class AFPPaintingState extends AbstractPaintingState
This keeps information about the current painting state when writing to an AFP datastream.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
AFPPaintingState.AFPData
Block level state dataprivate class
AFPPaintingState.AFPPagePaintingState
Page level state data-
Nested classes/interfaces inherited from class org.apache.fop.util.AbstractPaintingState
AbstractPaintingState.AbstractData, AbstractPaintingState.StateStack<E>
-
-
Field Summary
Fields Modifier and Type Field Description private float
bitmapEncodingQuality
image encoding quality setting (0.0f..1.0f)private int
bitsPerPixel
default value for image depthprivate boolean
canEmbedJpeg
private boolean
cmykImagesSupported
true if CMYK images (requires IOCA FS45 suppport on the target platform) may be generatedprivate org.apache.xmlgraphics.java2d.color.ColorConverter
colorConverter
color image handlerprivate boolean
colorImages
color image supportprivate float
ditheringQuality
dithering quality setting (0.0f..1.0f)private boolean
fs45
use FS45 imagesprivate boolean
gocaEnabled
determines whether GOCA is enabled or disabledprivate boolean
gocaPSeg
private int
landscapeRotation
the landscape rotationprivate float
lineWidthCorrection
A configurable value to correct the line width so that the output matches the expected.private static org.apache.commons.logging.Log
log
private boolean
nativeImagesSupported
true if certain image formats may be embedded unchanged in their native format.private AFPPaintingState.AFPPagePaintingState
pagePaintingState
the current pageprivate int
portraitRotation
the portrait rotationprivate boolean
pSeg
use page segment with F11 and F45 imagesprivate int
resolution
the output resolutionprivate static long
serialVersionUID
private boolean
strokeGocaText
determines whether to stroke text in GOCA mode or to use text operators where possibleprivate AFPUnitConverter
unitConv
a unit converter
-
Constructor Summary
Constructors Constructor Description AFPPaintingState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canEmbedJpeg()
Returns true if JPEGs can be embedded in an AFP document.java.lang.Object
clone()
float
getBitmapEncodingQuality()
Gets the image encoding quality setting to use when encoding bitmap images.int
getBitsPerPixel()
Returns the number of bits per pixelorg.apache.xmlgraphics.java2d.color.ColorConverter
getColorConverter()
Used to convert color in respect of the colorImages flagfloat
getDitheringQuality()
Gets the dithering quality setting to use when converting images to monochrome images.boolean
getFS45()
gets whether images should be FS45java.lang.String
getImageUri()
Gets the uri of the current imageprotected int
getLandscapeRotation()
Returns the landscape rotationfloat
getLineWidthCorrection()
Returns the line width correction.AFPPageFonts
getPageFonts()
Gets the current page fontsint
getPageHeight()
Returns the page heightprotected AFPPaintingState.AFPPagePaintingState
getPagePaintingState()
Returns the painting state of the current pageint
getPageRotation()
Returns the page rotationint
getPageWidth()
Returns the page widthjava.awt.Point
getPoint(int x, int y)
Returns a point on the current page, taking the current painting state into account.protected int
getPortraitRotation()
Returns the rotation to be used for portrait pagesint
getResolution()
Returns the output/device resolution.int
getRotation()
Returns the currently derived rotationAFPUnitConverter
getUnitConverter()
Returns the unit converterboolean
getWrapGocaPSeg()
boolean
getWrapPSeg()
Whether FS11 and SF45 non-inline images should be wrapped in a page segmentprotected AbstractPaintingState
instantiate()
Instantiates a new state objectprotected AbstractPaintingState.AbstractData
instantiateData()
Instantiates a new state data objectboolean
isCMYKImagesSupported()
Indicates whether CMYK images (IOCA FS45) are enabled.boolean
isColorImages()
Returns true if color images are to be usedboolean
isGOCAEnabled()
Indicates whether GOCA is enabled or disabled.boolean
isNativeImagesSupported()
Returns true if images are supported natively in this AFP environmentboolean
isStrokeGOCAText()
Indicates whether to stroke text in GOCA mode or to use text operators where possible.private void
readObject(java.io.ObjectInputStream ois)
void
setBitmapEncodingQuality(float quality)
Sets the image encoding quality setting to use when encoding bitmap images.void
setBitsPerPixel(int bitsPerPixel)
Sets the number of bits used per pixelvoid
setCanEmbedJpeg(boolean canEmbed)
Set whether or not JPEG images can be embedded within an AFP document.void
setCMYKImagesSupported(boolean value)
Controls whether CMYK images (IOCA FS45) are enabled.void
setColorImages(boolean colorImages)
Sets whether images are color or not and instantiates a ColorHandlervoid
setDitheringQuality(float quality)
Sets the dithering quality setting to use when converting images to monochrome images.void
setFS45(boolean fs45)
sets whether images should be FS45void
setGOCAEnabled(boolean enabled)
Controls whether GOCA is enabled or disabled.void
setImageUri(java.lang.String uri)
Sets the uri of the current imagevoid
setLandscapeRotation(int rotation)
Sets the rotation to be used for landscape pages, valid values are 0, 90, 180, 270 (default).void
setLineWidthCorrection(float correction)
Sets the line width correctionvoid
setNativeImagesSupported(boolean nativeImagesSupported)
Sets whether images are natively supported or not in the AFP environmentvoid
setPageHeight(int pageHeight)
Sets the page heightvoid
setPageWidth(int pageWidth)
Sets the page widthvoid
setPortraitRotation(int rotation)
Sets the rotation to be used for portrait pages, valid values are 0 (default), 90, 180, 270.void
setResolution(int resolution)
Sets the output/device resolutionvoid
setStrokeGOCAText(boolean stroke)
Controls whether to stroke text in GOCA mode or to use text operators where possible.void
setWrapGocaPSeg(boolean pSeg)
void
setWrapPSeg(boolean pSeg)
Sets whether FS11 and FS45 non-inline images should be wrapped in a page segmentjava.lang.String
toString()
-
Methods inherited from class org.apache.fop.util.AbstractPaintingState
checkTransform, clear, clearTransform, concatenate, getBackColor, getBaseTransform, getColor, getData, getFontName, getFontSize, getLineWidth, getStateStack, getTransform, resetTransform, restore, restoreAll, save, saveAll, setBackColor, setColor, setDashArray, setData, setFontName, setFontSize, setLineWidth
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
log
private static org.apache.commons.logging.Log log
-
portraitRotation
private int portraitRotation
the portrait rotation
-
landscapeRotation
private int landscapeRotation
the landscape rotation
-
colorImages
private boolean colorImages
color image support
-
ditheringQuality
private float ditheringQuality
dithering quality setting (0.0f..1.0f)
-
bitmapEncodingQuality
private float bitmapEncodingQuality
image encoding quality setting (0.0f..1.0f)
-
colorConverter
private transient org.apache.xmlgraphics.java2d.color.ColorConverter colorConverter
color image handler
-
nativeImagesSupported
private boolean nativeImagesSupported
true if certain image formats may be embedded unchanged in their native format.
-
canEmbedJpeg
private boolean canEmbedJpeg
-
cmykImagesSupported
private boolean cmykImagesSupported
true if CMYK images (requires IOCA FS45 suppport on the target platform) may be generated
-
bitsPerPixel
private int bitsPerPixel
default value for image depth
-
resolution
private int resolution
the output resolution
-
lineWidthCorrection
private float lineWidthCorrection
A configurable value to correct the line width so that the output matches the expected. Different devices may need different values.
-
gocaEnabled
private boolean gocaEnabled
determines whether GOCA is enabled or disabled
-
strokeGocaText
private boolean strokeGocaText
determines whether to stroke text in GOCA mode or to use text operators where possible
-
pSeg
private boolean pSeg
use page segment with F11 and F45 images
-
gocaPSeg
private boolean gocaPSeg
-
fs45
private boolean fs45
use FS45 images
-
pagePaintingState
private transient AFPPaintingState.AFPPagePaintingState pagePaintingState
the current page
-
unitConv
private final transient AFPUnitConverter unitConv
a unit converter
-
-
Method Detail
-
readObject
private void readObject(java.io.ObjectInputStream ois) throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundException
java.io.IOException
-
setPortraitRotation
public void setPortraitRotation(int rotation)
Sets the rotation to be used for portrait pages, valid values are 0 (default), 90, 180, 270.- Parameters:
rotation
- The rotation in degrees.
-
getPortraitRotation
protected int getPortraitRotation()
Returns the rotation to be used for portrait pages- Returns:
- the rotation to be used for portrait pages
-
setLandscapeRotation
public void setLandscapeRotation(int rotation)
Sets the rotation to be used for landscape pages, valid values are 0, 90, 180, 270 (default).- Parameters:
rotation
- The rotation in degrees.
-
getLandscapeRotation
protected int getLandscapeRotation()
Returns the landscape rotation- Returns:
- the landscape rotation
-
setBitsPerPixel
public void setBitsPerPixel(int bitsPerPixel)
Sets the number of bits used per pixel- Parameters:
bitsPerPixel
- number of bits per pixel
-
getBitsPerPixel
public int getBitsPerPixel()
Returns the number of bits per pixel- Returns:
- the number of bits per pixel
-
setColorImages
public void setColorImages(boolean colorImages)
Sets whether images are color or not and instantiates a ColorHandler- Parameters:
colorImages
- color image output
-
isColorImages
public boolean isColorImages()
Returns true if color images are to be used- Returns:
- true if color images are to be used
-
getColorConverter
public org.apache.xmlgraphics.java2d.color.ColorConverter getColorConverter()
Used to convert color in respect of the colorImages flag- Returns:
- the color converter
-
setNativeImagesSupported
public void setNativeImagesSupported(boolean nativeImagesSupported)
Sets whether images are natively supported or not in the AFP environment- Parameters:
nativeImagesSupported
- true if images are natively supported in this AFP environment
-
isNativeImagesSupported
public boolean isNativeImagesSupported()
Returns true if images are supported natively in this AFP environment- Returns:
- true if images are supported natively in this AFP environment
-
setCanEmbedJpeg
public void setCanEmbedJpeg(boolean canEmbed)
Set whether or not JPEG images can be embedded within an AFP document.- Parameters:
canEmbed
- true if the JPEG image can be embedded
-
canEmbedJpeg
public boolean canEmbedJpeg()
Returns true if JPEGs can be embedded in an AFP document.- Returns:
- true if JPEG embedding is allowed
-
setCMYKImagesSupported
public void setCMYKImagesSupported(boolean value)
Controls whether CMYK images (IOCA FS45) are enabled. By default, support is disabled for wider compatibility. When disabled, any CMYK image is converted to the selected color format.- Parameters:
value
- true to enabled CMYK images
-
isCMYKImagesSupported
public boolean isCMYKImagesSupported()
Indicates whether CMYK images (IOCA FS45) are enabled.- Returns:
- true if IOCA FS45 is enabled
-
getDitheringQuality
public float getDitheringQuality()
Gets the dithering quality setting to use when converting images to monochrome images.- Returns:
- the dithering quality (a value between 0.0f and 1.0f)
-
setDitheringQuality
public void setDitheringQuality(float quality)
Sets the dithering quality setting to use when converting images to monochrome images.- Parameters:
quality
- Defines the desired quality level for the conversion. Valid values: a value between 0.0f (fastest) and 1.0f (best)
-
getBitmapEncodingQuality
public float getBitmapEncodingQuality()
Gets the image encoding quality setting to use when encoding bitmap images.- Returns:
- the encoding quality (a value between 0.0f and 1.0f, 1.0 meaning loss-less)
-
setBitmapEncodingQuality
public void setBitmapEncodingQuality(float quality)
Sets the image encoding quality setting to use when encoding bitmap images.- Parameters:
quality
- Defines the desired quality level for the conversion. Valid values: a value between 0.0f (lowest) and 1.0f (best, loss-less)
-
setResolution
public void setResolution(int resolution)
Sets the output/device resolution- Parameters:
resolution
- the output resolution (dpi)
-
setLineWidthCorrection
public void setLineWidthCorrection(float correction)
Sets the line width correction- Parameters:
correction
- the line width multiplying factor correction
-
getResolution
public int getResolution()
Returns the output/device resolution.- Returns:
- the resolution in dpi
-
getLineWidthCorrection
public float getLineWidthCorrection()
Returns the line width correction.- Returns:
- the correction
-
setGOCAEnabled
public void setGOCAEnabled(boolean enabled)
Controls whether GOCA is enabled or disabled.- Parameters:
enabled
- true if GOCA is enabled, false if it is disabled
-
isGOCAEnabled
public boolean isGOCAEnabled()
Indicates whether GOCA is enabled or disabled.- Returns:
- true if GOCA is enabled, false if GOCA is disabled
-
setStrokeGOCAText
public void setStrokeGOCAText(boolean stroke)
Controls whether to stroke text in GOCA mode or to use text operators where possible.- Parameters:
stroke
- true to stroke, false to paint with text operators where possible
-
isStrokeGOCAText
public boolean isStrokeGOCAText()
Indicates whether to stroke text in GOCA mode or to use text operators where possible.- Returns:
- true to stroke, false to paint with text operators where possible
-
getWrapPSeg
public boolean getWrapPSeg()
Whether FS11 and SF45 non-inline images should be wrapped in a page segment- Returns:
- true iff images should be wrapped
-
setWrapPSeg
public void setWrapPSeg(boolean pSeg)
Sets whether FS11 and FS45 non-inline images should be wrapped in a page segment- Parameters:
pSeg
- true iff images should be wrapped
-
getWrapGocaPSeg
public boolean getWrapGocaPSeg()
-
setWrapGocaPSeg
public void setWrapGocaPSeg(boolean pSeg)
-
getFS45
public boolean getFS45()
gets whether images should be FS45- Returns:
- true iff images should be FS45
-
setFS45
public void setFS45(boolean fs45)
sets whether images should be FS45- Parameters:
fs45
- true iff images should be FS45
-
instantiateData
protected AbstractPaintingState.AbstractData instantiateData()
Instantiates a new state data object- Specified by:
instantiateData
in classAbstractPaintingState
- Returns:
- a new state data object
-
instantiate
protected AbstractPaintingState instantiate()
Instantiates a new state object- Specified by:
instantiate
in classAbstractPaintingState
- Returns:
- a new state object
-
getPagePaintingState
protected AFPPaintingState.AFPPagePaintingState getPagePaintingState()
Returns the painting state of the current page- Returns:
- the painting state of the current page
-
getPageFonts
public AFPPageFonts getPageFonts()
Gets the current page fonts- Returns:
- the current page fonts
-
setPageWidth
public void setPageWidth(int pageWidth)
Sets the page width- Parameters:
pageWidth
- the page width
-
getPageWidth
public int getPageWidth()
Returns the page width- Returns:
- the page width
-
setPageHeight
public void setPageHeight(int pageHeight)
Sets the page height- Parameters:
pageHeight
- the page height
-
getPageHeight
public int getPageHeight()
Returns the page height- Returns:
- the page height
-
getPageRotation
public int getPageRotation()
Returns the page rotation- Returns:
- the page rotation
-
setImageUri
public void setImageUri(java.lang.String uri)
Sets the uri of the current image- Parameters:
uri
- the uri of the current image
-
getImageUri
public java.lang.String getImageUri()
Gets the uri of the current image- Returns:
- the uri of the current image
-
getRotation
public int getRotation()
Returns the currently derived rotation- Returns:
- the currently derived rotation
-
getUnitConverter
public AFPUnitConverter getUnitConverter()
Returns the unit converter- Returns:
- the unit converter
-
getPoint
public java.awt.Point getPoint(int x, int y)
Returns a point on the current page, taking the current painting state into account.- Parameters:
x
- the X-coordinatey
- the Y-coordinate- Returns:
- a point on the current page
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classAbstractPaintingState
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractPaintingState
-
-