public abstract class Renderer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Renderer.RendererState
Enumeration describing the lifecycle states of the renderer.
|
Modifier and Type | Field and Description |
---|---|
static String |
rootPkg |
protected static boolean |
verbose |
Modifier | Constructor and Description |
---|---|
protected |
Renderer() |
Modifier and Type | Method and Description |
---|---|
abstract void |
clearImage(Filterable image)
Mainly used by
ImagePool for the purpose of clearing
an image before handing it back to the user. |
abstract PoolFilterable |
createCompatibleImage(int w,
int h) |
LockableResource |
createFloatTexture(int w,
int h) |
abstract ImageData |
createImageData(FilterContext fctx,
Filterable src)
Mainly used by the
Identity effect for the purpose of
creating a cached ImageData from the given platform-specific
image (e.g. |
protected abstract EffectPeer |
createPeer(FilterContext fctx,
String name,
int unrollCount)
Creates a new peer given the context, name and unroll count.
|
abstract Effect.AccelType |
getAccelType()
Returns the
Effect.AccelType used by default for peers of this renderer. |
protected abstract Renderer |
getBackupRenderer()
Returns an instance of backup renderer to be used if this renderer
is in
LOST state. |
abstract int |
getCompatibleHeight(int h) |
PoolFilterable |
getCompatibleImage(int w,
int h) |
abstract int |
getCompatibleWidth(int w) |
EffectPeer |
getPeerInstance(FilterContext fctx,
String name,
int unrollCount)
Returns a (cached) instance of peer given the context, name and unroll
count.
|
protected Collection<EffectPeer> |
getPeers()
Returns current cache of peers.
|
static Renderer |
getRenderer(FilterContext fctx)
Returns a renderer associated with given filter context based on the
environment and flags set.
|
static Renderer |
getRenderer(FilterContext fctx,
Effect effect,
int approxW,
int approxH)
Returns a renderer that is most optimal for the approximate size
of the filtering operation.
|
protected Renderer |
getRendererForSize(Effect effect,
int approxW,
int approxH)
Returns a
Renderer instance that is most appropriate
for the given size of the source data. |
abstract Renderer.RendererState |
getRendererState()
Returns this renderer's current state.
|
protected static Renderer |
getSoftwareRenderer()
This method can be used by subclasses to create a backup renderer,
either a SW (Java) renderer or an SSE (native) renderer, depending
on what is available.
|
abstract boolean |
isImageDataCompatible(ImageData id)
Determines whether the passed
ImageData is compatible with this
renderer (that is, if it can be used as a input source for this
renderer's peers). |
void |
releaseCompatibleImage(Filterable image) |
void |
releasePurgatory()
This is a temporary workaround for a PowerVR SGX issue.
|
abstract Filterable |
transform(FilterContext fctx,
Filterable original,
BaseTransform transform,
Rectangle origBounds,
Rectangle xformBounds) |
abstract ImageData |
transform(FilterContext fctx,
ImageData original,
BaseTransform transform,
Rectangle origBounds,
Rectangle xformBounds) |
ImageData |
transform(FilterContext fctx,
ImageData img,
int xpow2scales,
int ypow2scales) |
void |
updateFloatTexture(LockableResource texture,
FloatMap map) |
public static final String rootPkg
protected static final boolean verbose
public abstract Effect.AccelType getAccelType()
Effect.AccelType
used by default for peers of this renderer.
Note that the Renderer may specialize in peers of this type, and
it may create them in general by default, but the renderers all
look for an Intrinsic peer for a given operation as well so the
actual peer implementaiton for a given effect may sometimes differ
from this AccelType
. Care should be taken if the actual
AccelType
for a specific operation is needed, then the
EffectPeer.getAccelType()
should be consulted directly
in those cases.AccelType
used by typical peers of this rendererpublic abstract int getCompatibleWidth(int w)
public abstract int getCompatibleHeight(int h)
public abstract PoolFilterable createCompatibleImage(int w, int h)
public PoolFilterable getCompatibleImage(int w, int h)
public void releaseCompatibleImage(Filterable image)
public void releasePurgatory()
public abstract void clearImage(Filterable image)
ImagePool
for the purpose of clearing
an image before handing it back to the user.image
- the image to be clearedpublic abstract ImageData createImageData(FilterContext fctx, Filterable src)
Identity
effect for the purpose of
creating a cached ImageData
from the given platform-specific
image (e.g. a BufferedImage
wrapped in a J2DImage
).fctx
- the filter contextplatformImage
- the platform-specific source image to be copied
into the new ImageData
objectImageData
public ImageData transform(FilterContext fctx, ImageData img, int xpow2scales, int ypow2scales)
public abstract Filterable transform(FilterContext fctx, Filterable original, BaseTransform transform, Rectangle origBounds, Rectangle xformBounds)
public abstract ImageData transform(FilterContext fctx, ImageData original, BaseTransform transform, Rectangle origBounds, Rectangle xformBounds)
public LockableResource createFloatTexture(int w, int h)
public void updateFloatTexture(LockableResource texture, FloatMap map)
public final EffectPeer getPeerInstance(FilterContext fctx, String name, int unrollCount)
fctx
- filter context - same as this renderer's contextname
- not-unrolled name of the peerunrollCount
- public abstract Renderer.RendererState getRendererState()
Renderer.RendererState
protected abstract EffectPeer createPeer(FilterContext fctx, String name, int unrollCount)
fctx
- context shared with the renderername
- of the peerunrollCount
- unroll countprotected Collection<EffectPeer> getPeers()
protected static Renderer getSoftwareRenderer()
protected abstract Renderer getBackupRenderer()
LOST
state.protected Renderer getRendererForSize(Effect effect, int approxW, int approxH)
Renderer
instance that is most appropriate
for the given size of the source data. The default implementation
simply returns "this" renderer, but subclasses may override this
method and return a different renderer depending on the size of
the operation. For example, a GPU-based renderer may wish to
return a software renderer for small-sized operations (because of
lower overhead, etc).approxW
- approximate input widthapproxH
- approximate input heightRenderer
best suited for this sizepublic static Renderer getRenderer(FilterContext fctx)
fctx
- context to create the renderer forpublic static Renderer getRenderer(FilterContext fctx, Effect effect, int approxW, int approxH)
fctx
- context to create the renderer foreffect
- uses in the renderingapproxW
- approximate input widthapproxH
- approximate input heightpublic abstract boolean isImageDataCompatible(ImageData id)
ImageData
is compatible with this
renderer (that is, if it can be used as a input source for this
renderer's peers).id
- ImageData
to be checkedCopyright © 2020. All rights reserved.