public interface ResourceFactory extends GraphicsResource
Modifier and Type | Method and Description |
---|---|
void |
addFactoryListener(ResourceFactoryListener l) |
ShapeRep |
createArcRep() |
ShapeRep |
createEllipseRep() |
Texture |
createFloatTexture(int width,
int height) |
Texture |
createMaskTexture(int width,
int height,
Texture.WrapMode wrapMode) |
Mesh |
createMesh() |
MeshView |
createMeshView(Mesh mesh) |
ShapeRep |
createPathRep() |
PhongMaterial |
createPhongMaterial() |
Presentable |
createPresentable(PresentableState pState) |
ShapeRep |
createRoundRectRep() |
RTTexture |
createRTTexture(int width,
int height,
Texture.WrapMode wrapMode) |
RTTexture |
createRTTexture(int width,
int height,
Texture.WrapMode wrapMode,
boolean msaa) |
Texture |
createTexture(Image image,
Texture.Usage usageHint,
Texture.WrapMode wrapMode)
Returns a new
Texture containing the pixels from the given
image with the indicated texture edge wrap mode. |
Texture |
createTexture(Image image,
Texture.Usage usageHint,
Texture.WrapMode wrapMode,
boolean useMipmap)
Returns a new
Texture containing the pixels from the given
image with the indicated texture edge wrap mode. |
Texture |
createTexture(MediaFrame frame)
Returns a new
Texture that can contain the video image as specified
in the provided MediaFrame . |
Texture |
createTexture(PixelFormat formatHint,
Texture.Usage usageHint,
Texture.WrapMode wrapMode,
int w,
int h)
Returns a new
Texture with the given format and edge wrapping
support. |
Texture |
createTexture(PixelFormat formatHint,
Texture.Usage usageHint,
Texture.WrapMode wrapMode,
int w,
int h,
boolean useMipmap)
Returns a new
Texture with the given format and edge wrapping
support. |
void |
dispose() |
Texture |
getCachedTexture(Image image,
Texture.WrapMode wrapMode)
Returns a
Texture for the given image set up to use or
simulate the indicated wrap mode. |
Texture |
getCachedTexture(Image image,
Texture.WrapMode wrapMode,
boolean useMipmap)
Returns a
Texture for the given image set up to use or
simulate the indicated wrap mode. |
Texture |
getGlyphTexture() |
int |
getMaximumTextureSize()
Returns the maximum supported texture dimension for this device.
|
Texture |
getRegionTexture() |
int |
getRTTHeight(int h,
Texture.WrapMode wrapMode) |
int |
getRTTWidth(int w,
Texture.WrapMode wrapMode) |
TextureResourcePool |
getTextureResourcePool() |
boolean |
isCompatibleTexture(Texture tex)
A Texture may have been obtained from a different resource factory.
|
boolean |
isDeviceReady()
Returns status of this graphics device.
|
boolean |
isFormatSupported(PixelFormat format)
Returns true if the given
PixelFormat is supported; otherwise
returns false. |
boolean |
isSuperShaderAllowed() |
boolean |
isWrapModeSupported(Texture.WrapMode mode)
Returns true iff the indicated
wrap mode is directly
supported (i.e. |
void |
removeFactoryListener(ResourceFactoryListener l) |
void |
setGlyphTexture(Texture texture) |
void |
setRegionTexture(Texture texture) |
boolean isDeviceReady()
TextureResourcePool getTextureResourcePool()
Texture createTexture(Image image, Texture.Usage usageHint, Texture.WrapMode wrapMode)
Texture
containing the pixels from the given
image with the indicated texture edge wrap mode.
Note that the dimensions of the returned texture may be larger
than those of the given image.
Equivalent to (but perhaps more efficient than):
PixelFormat format = image.getPixelFormat();
int w = image.getWidth();
int h = image.getHeight();
Texture tex = createTexture(format, usageHint, wrapMode, w, h);
tex.update(image, 0, 0, w, h);
image
- the pixel data to be uploaded to the new textureusageHint
- the Dynamic vs. Static nature of the texture datawrapMode
- the desired edge behavior (clamping vs. wrapping)Texture createTexture(Image image, Texture.Usage usageHint, Texture.WrapMode wrapMode, boolean useMipmap)
Texture
containing the pixels from the given
image with the indicated texture edge wrap mode.
Note that the dimensions of the returned texture may be larger
than those of the given image.
Equivalent to (but perhaps more efficient than):
PixelFormat format = image.getPixelFormat();
int w = image.getWidth();
int h = image.getHeight();
Texture tex = createTexture(format, usageHint, wrapMode, w, h, useMipmap);
tex.update(image, 0, 0, w, h);
image
- the pixel data to be uploaded to the new textureusageHint
- the Dynamic vs. Static nature of the texture datawrapMode
- the desired edge behavior (clamping vs. wrapping)useMipmap
- the flag indicates should texture be created with mipmapTexture createTexture(PixelFormat formatHint, Texture.Usage usageHint, Texture.WrapMode wrapMode, int w, int h)
Texture
with the given format and edge wrapping
support. Note that the dimensions of the returned texture may be larger
than those requested and the wrap mode may be a simulated version of
the type requested.formatHint
- intended pixel format of the data to be stored
in this textureusageHint
- the Dynamic vs. Static nature of the texture datawrapMode
- intended wrap mode to be used for the texturew
- width of the content in the textureh
- height of the content in the textureTexture createTexture(PixelFormat formatHint, Texture.Usage usageHint, Texture.WrapMode wrapMode, int w, int h, boolean useMipmap)
Texture
with the given format and edge wrapping
support. Note that the dimensions of the returned texture may be larger
than those requested and the wrap mode may be a simulated version of
the type requested.formatHint
- intended pixel format of the data to be stored
in this textureusageHint
- the Dynamic vs. Static nature of the texture datawrapMode
- intended wrap mode to be used for the texturew
- width of the content in the textureh
- height of the content in the textureuseMipmap
- the flag indicates should texture be created with mipmapTexture createTexture(MediaFrame frame)
Texture
that can contain the video image as specified
in the provided MediaFrame
. Note that padding is almost implicit
since this method has to accommodate the line strides of each plane. Also
due to renderer limitations, some format conversion may be necessary so
the texture format may end up being different from the video image format.frame
- the video image that we need to create a new texture forTexture getCachedTexture(Image image, Texture.WrapMode wrapMode)
Texture
for the given image set up to use or
simulate the indicated wrap mode.
If no texture could be found in the cache, this method will create a
new texture and put it in the cache before returning it.
NOTE: the caller of this method should not hold a reference to the
cached texture beyond its immediate needs since the cache may be
cleared at any time.image
- the pixel data to be uploaded if the texture is new or
needs new fringe pixels to simulate a new wrap modewrapMode
- the mode that describes the behavior for samples
outside the content areaTexture getCachedTexture(Image image, Texture.WrapMode wrapMode, boolean useMipmap)
Texture
for the given image set up to use or
simulate the indicated wrap mode.
If no texture could be found in the cache, this method will create a
new texture and put it in the cache before returning it.
NOTE: the caller of this method should not hold a reference to the
cached texture beyond its immediate needs since the cache may be
cleared at any time.image
- the pixel data to be uploaded if the texture is new or
needs new fringe pixels to simulate a new wrap modewrapMode
- the mode that describes the behavior for samples
outside the contentuseMipmap
- the flag indicates should mipmapping be used for this
textureboolean isFormatSupported(PixelFormat format)
PixelFormat
is supported; otherwise
returns false.
Note that the following formats are guaranteed to be supported across all devices:
BYTE_RGB
BYTE_RGBA_PRE
BYTE_GRAY
BYTE_ALPHA
Support for the other formats depends on the capabilities of the
device. Be sure to call this method before attempting to create
a Texture
with a non-standard format and plan to have an
alternate codepath if the given format is not supported.
format
- the PixelFormat
to testboolean isWrapModeSupported(Texture.WrapMode mode)
wrap mode
is directly
supported (i.e. not simulated) by the underlying pipeline and platform.mode
- the desired WrapMode
int getMaximumTextureSize()
int getRTTWidth(int w, Texture.WrapMode wrapMode)
int getRTTHeight(int h, Texture.WrapMode wrapMode)
Texture createMaskTexture(int width, int height, Texture.WrapMode wrapMode)
Texture createFloatTexture(int width, int height)
RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode)
RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode, boolean msaa)
boolean isCompatibleTexture(Texture tex)
tex
- the texture to check.Presentable createPresentable(PresentableState pState)
ShapeRep createPathRep()
ShapeRep createRoundRectRep()
ShapeRep createEllipseRep()
ShapeRep createArcRep()
void addFactoryListener(ResourceFactoryListener l)
void removeFactoryListener(ResourceFactoryListener l)
void setRegionTexture(Texture texture)
Texture getRegionTexture()
void setGlyphTexture(Texture texture)
Texture getGlyphTexture()
boolean isSuperShaderAllowed()
void dispose()
dispose
in interface GraphicsResource
PhongMaterial createPhongMaterial()
Mesh createMesh()
Copyright © 2020. All rights reserved.