public class DisplacementMap extends FilterEffect<T>
Effect.AccelType
DefaultInput
Constructor and Description |
---|
DisplacementMap(FloatMap mapData)
Constructs a new
DisplacementMap effect,
using the default input for source data. |
DisplacementMap(FloatMap mapData,
Effect contentInput)
Constructs a new
DisplacementMap effect using the specified
input Effect for source data, or the default input if
contentInput is null . |
Modifier and Type | Method and Description |
---|---|
ImageData |
filterImageDatas(FilterContext fctx,
BaseTransform transform,
Rectangle outputClip,
RenderState rstate,
ImageData... inputs)
Convenience method that sends the given input data through the
current peer, and then attempts to release the input image data.
|
Effect.AccelType |
getAccelType(FilterContext fctx)
Returns one of the
AccelType values, indicating
whether this Effect is accelerated in hardware for the
given FilterContext . |
Effect |
getContentInput()
Returns the content input for this
Effect . |
DirtyRegionContainer |
getDirtyRegions(Effect defaultInput,
DirtyRegionPool regionPool)
Returns the dirty region container containing dirty regions affected
by this filter operation.
|
FloatMap |
getMapData()
Returns the map data for this
Effect . |
float |
getOffsetX()
Returns the x offset factor.
|
float |
getOffsetY()
Returns the y offset factor.
|
RenderState |
getRenderState(FilterContext fctx,
BaseTransform transform,
Rectangle outputClip,
Object renderHelper,
Effect defaultInput)
Returns the object representing the rendering strategy and state for
the filter operation characterized by the specified arguments.
|
float |
getScaleX()
Returns the x scale factor.
|
float |
getScaleY()
Returns the y scale factor.
|
boolean |
getWrap()
Returns whether values taken from outside the edges of the map
"wrap around" or not.
|
boolean |
reducesOpaquePixels()
Whether an opacity for any pixel is different (lower)
than the corresponding pixel in the default input.
|
void |
setContentInput(Effect contentInput)
Sets the content input for this
Effect to a specific
Effect or to the default input if input is
null . |
void |
setMapData(FloatMap mapData)
Sets the map data for this
Effect . |
void |
setOffsetX(float offsetX)
Sets the x offset factor.
|
void |
setOffsetY(float offsetY)
Sets the y offset factor.
|
void |
setScaleX(float scaleX)
Sets the x scale factor.
|
void |
setScaleY(float scaleY)
Sets the y scale factor.
|
void |
setWrap(boolean wrap)
Sets whether values taken from outside the edges of the map
"wrap around" or not.
|
Point2D |
transform(Point2D p,
Effect defaultInput)
Transform the specified point
p from the coordinate space
of the primary content input to the coordinate space of the effect
output. |
Point2D |
untransform(Point2D p,
Effect defaultInput)
Transform the specified point
p from the coordinate space
of the output of the effect into the coordinate space of the
primary content input. |
filter, getBounds, untransformClip
combineBounds, combineBounds, createCompatibleImage, ensureTransform, getCompatibleImage, getInputs, getNumInputs, getResultBounds, releaseCompatibleImage, setInput, transformBounds
public DisplacementMap(FloatMap mapData)
DisplacementMap
effect,
using the default input for source data.
This is a shorthand equivalent to:
new DisplacementMap(mapData, DefaultInput)
IllegalArgumentException
- if mapData
is nullpublic DisplacementMap(FloatMap mapData, Effect contentInput)
DisplacementMap
effect using the specified
input Effect
for source data, or the default input if
contentInput
is null
.mapData
- the map datacontentInput
- the content input Effect
IllegalArgumentException
- if mapData
is nullpublic final FloatMap getMapData()
Effect
.Effect
public void setMapData(FloatMap mapData)
Effect
.mapData
- the map data for this Effect
IllegalArgumentException
- if mapData
is nullpublic final Effect getContentInput()
Effect
.Effect
public void setContentInput(Effect contentInput)
Effect
to a specific
Effect
or to the default input if input
is
null
.contentInput
- the content input for this Effect
public float getScaleX()
public void setScaleX(float scaleX)
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
scaleX
- the x scale factorpublic float getScaleY()
public void setScaleY(float scaleY)
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
scaleY
- the y scale factorpublic float getOffsetX()
public void setOffsetX(float offsetX)
Min: n/a Max: n/a Default: -0.5 Identity: 0.0
offsetX
- the x offset factorpublic float getOffsetY()
public void setOffsetY(float offsetY)
Min: n/a Max: n/a Default: -0.5 Identity: 0.0
offsetY
- the y offset factorpublic boolean getWrap()
public void setWrap(boolean wrap)
Min: n/a Max: n/a Default: false Identity: n/a
wrap
- true if wrapping is enabled, false otherwisepublic Point2D transform(Point2D p, Effect defaultInput)
p
from the coordinate space
of the primary content input to the coordinate space of the effect
output.
In essence, this method asks the question "Which output coordinate
is most affected by the data at the specified coordinate in the
primary source input?"
Since the displacement map represents a mapping from output pixels
to relative source pixels, there may be multiple answers or no
answer for any given input coordinate so this method returns
(NaN, NaN)
.
transform
in class FilterEffect<RenderState>
p
- the point in the coordinate space of the primary content
input to be transformeddefaultInput
- the default input Effect
to be used in
all cases where a filter has a null input(NaN, NaN)
public Point2D untransform(Point2D p, Effect defaultInput)
p
from the coordinate space
of the output of the effect into the coordinate space of the
primary content input.
In essence, this method asks the question "Which source coordinate
contributes most to the definition of the output at the specified
coordinate?"
This method returns the floating point coordinate where the backwards mapping displacement map tells it to get the data for the specified coordinate.
untransform
in class FilterEffect<RenderState>
p
- the point in the coordinate space of the result output
to be transformeddefaultInput
- the default input Effect
to be used in
all cases where a filter has a null inputpublic ImageData filterImageDatas(FilterContext fctx, BaseTransform transform, Rectangle outputClip, RenderState rstate, ImageData... inputs)
public RenderState getRenderState(FilterContext fctx, BaseTransform transform, Rectangle outputClip, Object renderHelper, Effect defaultInput)
FilterEffect
FilterContext
object may be null.
outputClip
and renderHelper
may always be null just
as they may be null for a given filter operation.getRenderState
in class FilterEffect<RenderState>
fctx
- the context object that would be used by the Renderer
if this call is preparing for a render operation, or nulltransform
- the transform for the output of this operationoutputClip
- the clip rectangle that may restrict this operation, or nullrenderHelper
- the rendering helper object that can be used to shortcut
this operation under certain conditions, or nulldefaultInput
- the Effect
to be used in place of any null inputspublic boolean reducesOpaquePixels()
Effect
reducesOpaquePixels
in class Effect
public DirtyRegionContainer getDirtyRegions(Effect defaultInput, DirtyRegionPool regionPool)
Effect
getDirtyRegions
in class Effect
defaultInput
- the default input Effect
to be used in
all cases where a filter has a null inputregionPool
- the pool of dirty regionspublic Effect.AccelType getAccelType(FilterContext fctx)
Effect
AccelType
values, indicating
whether this Effect
is accelerated in hardware for the
given FilterContext
.getAccelType
in class Effect
AccelType
valuesCopyright © 2020. All rights reserved.