Top Description Inners Fields Constructors Methods
org.apache.pdfbox.rendering

pack-priv Class SoftMask

extends Object
implements Paint
Class Inheritance
All Implemented Interfaces
java.awt.Paint, java.awt.Transparency
Imports
java.awt.Color, .Paint, .PaintContext, .Rectangle, .RenderingHints, java.awt.geom.AffineTransform, .Rectangle2D, java.awt.image.BufferedImage, .ColorModel, .Raster, .WritableRaster, java.io.IOException, org.apache.commons.logging.Log, .LogFactory, org.apache.pdfbox.pdmodel.common.function.PDFunction, .PDFunctionTypeIdentity, org.apache.pdfbox.pdmodel.graphics.color.PDColor

A Paint which applies a soft mask to an underlying Paint.
Authors
Petr Slaby, John Hewson, Matthias Bläsing, Tilman Hausherr

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private static final ColorModel
private final Rectangle2D
private int
private static final Log
private final BufferedImage
private final Paint
private final PDFunction

Constructor Summary

AccessConstructor and Description
pack-priv
SoftMask(Paint
underlying paint.
paint
,
BufferedImage
soft mask
mask
,
Rectangle2D
bbox of the soft mask in the underlying Graphics2D device space
bboxDevice
,
PDColor
the color to be used outside the transparency group’s bounding box; if null, black will be used.
backdropColor
,
PDFunction
the transfer function, may be null.
transferFunction
)

Creates a new soft mask paint.

Method Summary

Modifier and TypeMethod and Description
public PaintContext
createContext(ColorModel
the preferred ColorModel which represents the most convenient format for the caller to receive the pixel data, or null if there is no preference.
cm
,
Rectangle
the device space bounding box of the graphics primitive being rendered. Implementations of the Paint interface are allowed to throw NullPointerException for a null deviceBounds.
deviceBounds
,
Rectangle2D
the user space bounding box of the graphics primitive being rendered. Implementations of the Paint interface are allowed to throw NullPointerException for a null userBounds.
userBounds
,
AffineTransform
the AffineTransform from user space into device space. Implementations of the Paint interface are allowed to throw NullPointerException for a null xform.
xform
,
RenderingHints
the set of hints that the context object can use to choose between rendering alternatives. Implementations of the Paint interface are allowed to throw NullPointerException for a null hints.
hints
)

Implements java.awt.Paint.createContext.

Creates and returns a PaintContext used to generate the color pattern.

public int
getTransparency()

Implements java.awt.Transparency.getTransparency.

Returns the type of this Transparency.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ARGB_COLOR_MODELback to summary
private static final ColorModel ARGB_COLOR_MODEL
bboxDeviceback to summary
private final Rectangle2D bboxDevice
bcback to summary
private int bc
LOGback to summary
private static final Log LOG
maskback to summary
private final BufferedImage mask
paintback to summary
private final Paint paint
transferFunctionback to summary
private final PDFunction transferFunction

Constructor Detail

SoftMaskback to summary
pack-priv SoftMask(Paint paint, BufferedImage mask, Rectangle2D bboxDevice, PDColor backdropColor, PDFunction transferFunction)

Creates a new soft mask paint.

Parameters
paint:Paint

underlying paint.

mask:BufferedImage

soft mask

bboxDevice:Rectangle2D

bbox of the soft mask in the underlying Graphics2D device space

backdropColor:PDColor

the color to be used outside the transparency group’s bounding box; if null, black will be used.

transferFunction:PDFunction

the transfer function, may be null.

Method Detail

createContextback to summary
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)

Implements java.awt.Paint.createContext.

Doc from java.awt.Paint.createContext.

Creates and returns a PaintContext used to generate the color pattern. The arguments to this method convey additional information about the rendering operation that may be used or ignored on various implementations of the Paint interface. A caller must pass non-null values for all of the arguments except for the ColorModel argument which may be null to indicate that no specific ColorModel type is preferred. Implementations of the Paint interface are allowed to use or ignore any of the arguments as makes sense for their function, and are not constrained to use the specified ColorModel for the returned PaintContext, even if it is not null. Implementations are allowed to throw NullPointerException for any null argument other than the ColorModel argument, but are not required to do so.

Parameters
cm:ColorModel

the preferred ColorModel which represents the most convenient format for the caller to receive the pixel data, or null if there is no preference.

deviceBounds:Rectangle

the device space bounding box of the graphics primitive being rendered. Implementations of the Paint interface are allowed to throw NullPointerException for a null deviceBounds.

userBounds:Rectangle2D

the user space bounding box of the graphics primitive being rendered. Implementations of the Paint interface are allowed to throw NullPointerException for a null userBounds.

xform:AffineTransform

the AffineTransform from user space into device space. Implementations of the Paint interface are allowed to throw NullPointerException for a null xform.

hints:RenderingHints

the set of hints that the context object can use to choose between rendering alternatives. Implementations of the Paint interface are allowed to throw NullPointerException for a null hints.

Returns:PaintContext

the PaintContext for generating color patterns.

Annotations
@Override
getTransparencyback to summary
public int getTransparency()

Implements java.awt.Transparency.getTransparency.

Doc from java.awt.Transparency.getTransparency.

Returns the type of this Transparency.

Returns:int

the field type of this Transparency, which is either OPAQUE, BITMASK or TRANSLUCENT.

Annotations
@Override
org.apache.pdfbox.rendering back to summary

private Class SoftMask.SoftPaintContext

extends Object
implements PaintContext
Class Inheritance
All Implemented Interfaces
java.awt.PaintContext

Field Summary

Modifier and TypeField and Description
private final PaintContext

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements java.awt.PaintContext.dispose.

Releases the resources allocated for the operation.

public ColorModel
getColorModel()

Implements java.awt.PaintContext.getColorModel.

Returns the ColorModel of the output.

public Raster
getRaster(int
the x coordinate of the area in device space for which colors are generated.
x1
,
int
the y coordinate of the area in device space for which colors are generated.
y1
,
int
the width of the area in device space
w
,
int
the height of the area in device space
h
)

Implements java.awt.PaintContext.getRaster.

Returns a Raster containing the colors generated for the graphics operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final PaintContext context

Constructor Detail

SoftPaintContextback to summary
pack-priv SoftPaintContext(PaintContext context)

Method Detail

disposeback to summary
public void dispose()

Implements java.awt.PaintContext.dispose.

Doc from java.awt.PaintContext.dispose.

Releases the resources allocated for the operation.

Annotations
@Override
getColorModelback to summary
public ColorModel getColorModel()

Implements java.awt.PaintContext.getColorModel.

Doc from java.awt.PaintContext.getColorModel.

Returns the ColorModel of the output. Note that this ColorModel might be different from the hint specified in the createContext method of Paint. Not all PaintContext objects are capable of generating color patterns in an arbitrary ColorModel.

Returns:ColorModel

the ColorModel of the output.

Annotations
@Override
getRasterback to summary
public Raster getRaster(int x1, int y1, int w, int h)

Implements java.awt.PaintContext.getRaster.

Doc from java.awt.PaintContext.getRaster.

Returns a Raster containing the colors generated for the graphics operation.

Parameters
x1:int

the x coordinate of the area in device space for which colors are generated.

y1:int

the y coordinate of the area in device space for which colors are generated.

w:int

the width of the area in device space

h:int

the height of the area in device space

Returns:Raster

a Raster representing the specified rectangular area and containing the colors generated for the graphics operation.

Annotations
@Override