APIdia Launch Partner
Top Methods
com.sun.prism

public Interface ResourceFactory

extends GraphicsResource
Known Direct Subinterfaces
com.sun.prism.ps.ShaderFactory
Known Direct Implementers
com.sun.prism.impl.BaseResourceFactory
Imports
com.sun.prism.Texture.WrapMode, com.sun.prism.impl.TextureResourcePool, com.sun.prism.shape.ShapeRep

Method Summary

Modifier and TypeMethod and Description
public void
public ShapeRep
public ShapeRep
public Texture
createFloatTexture(int width, int height)

public Texture
createMaskTexture(int width, int height, Texture.WrapMode wrapMode)

public Mesh
public MeshView
public ShapeRep
public PhongMaterial
public Presentable
public ShapeRep
public RTTexture
createRTTexture(int width, int height, Texture.WrapMode wrapMode)

public RTTexture
createRTTexture(int width, int height, Texture.WrapMode wrapMode, boolean msaa)

public Texture

Returns:

a new texture
createTexture
(Image
the pixel data to be uploaded to the new texture
image
,
Texture.Usage
the Dynamic vs. Static nature of the texture data
usageHint
,
Texture.WrapMode
the desired edge behavior (clamping vs. wrapping)
wrapMode
)

Returns a new Texture containing the pixels from the given image with the indicated texture edge wrap mode.

public Texture

Returns:

a new texture
createTexture
(Image
the pixel data to be uploaded to the new texture
image
,
Texture.Usage
the Dynamic vs. Static nature of the texture data
usageHint
,
Texture.WrapMode
the desired edge behavior (clamping vs. wrapping)
wrapMode
,
boolean
the flag indicates should texture be created with mipmap
useMipmap
)

Returns a new Texture containing the pixels from the given image with the indicated texture edge wrap mode.

public Texture

Returns:

texture most appropriate for the given intended format, wrap mode and dimensions
createTexture
(PixelFormat
intended pixel format of the data to be stored in this texture
formatHint
,
Texture.Usage
the Dynamic vs. Static nature of the texture data
usageHint
,
Texture.WrapMode
intended wrap mode to be used for the texture
wrapMode
,
int
width of the content in the texture
w
,
int
height of the content in the texture
h
)

Returns a new Texture with the given format and edge wrapping support.

public Texture

Returns:

texture most appropriate for the given intended format, wrap mode and dimensions
createTexture
(PixelFormat
intended pixel format of the data to be stored in this texture
formatHint
,
Texture.Usage
the Dynamic vs. Static nature of the texture data
usageHint
,
Texture.WrapMode
intended wrap mode to be used for the texture
wrapMode
,
int
width of the content in the texture
w
,
int
height of the content in the texture
h
,
boolean
the flag indicates should texture be created with mipmap
useMipmap
)

Returns a new Texture with the given format and edge wrapping support.

public Texture

Returns:

texture most appropriate for the given video image.
createTexture
(MediaFrame
the video image that we need to create a new texture for
frame
)

Returns a new Texture that can contain the video image as specified in the provided MediaFrame.

public Texture

Returns:

a cached texture
getCachedTexture
(Image
the pixel data to be uploaded if the texture is new or needs new fringe pixels to simulate a new wrap mode
image
,
Texture.WrapMode
the mode that describes the behavior for samples outside the content area
wrapMode
)

Returns a Texture for the given image set up to use or simulate the indicated wrap mode.

public Texture

Returns:

a cached texture
getCachedTexture
(Image
the pixel data to be uploaded if the texture is new or needs new fringe pixels to simulate a new wrap mode
image
,
Texture.WrapMode
the mode that describes the behavior for samples outside the content
wrapMode
,
boolean
the flag indicates should mipmapping be used for this texture
useMipmap
)

Returns a Texture for the given image set up to use or simulate the indicated wrap mode.

public Texture
public int

Returns:

the maximum supported texture dimension
getMaximumTextureSize
()

Returns the maximum supported texture dimension for this device.

public Texture
public int
getRTTHeight(int h, Texture.WrapMode wrapMode)

public int
getRTTWidth(int w, Texture.WrapMode wrapMode)

public TextureResourcePool<T>
public boolean

Returns:

whether this texture is compatible.
isCompatibleTexture
(Texture
the texture to check.
tex
)

A Texture may have been obtained from a different resource factory.

public boolean

Returns:

true if this graphics device is ready for use.
isDeviceReady
()

Returns status of this graphics device, possibly reinitializing it.

public boolean

Returns:

true if this resource factory has been disposed.
isDisposed
()

Returns whether this resource factory has been disposed.

public boolean

Returns:

true if the given format is supported; false otherwise
isFormatSupported
(PixelFormat
the PixelFormat to test
format
)

Returns true if the given PixelFormat is supported; otherwise returns false.

public boolean
public boolean

Returns:

true iff the wrap mode is supported and not simulated
isWrapModeSupported
(Texture.WrapMode
the desired WrapMode
mode
)

Returns true iff the indicated wrap mode is directly supported (i.e. not simulated) by the underlying pipeline and platform.

public void
public void
public void
Inherited from com.sun.prism.GraphicsResource:
dispose

Method Detail

addFactoryListenerback to summary
public void addFactoryListener(ResourceFactoryListener l)
createArcRepback to summary
public ShapeRep createArcRep()
createEllipseRepback to summary
public ShapeRep createEllipseRep()
createFloatTextureback to summary
public Texture createFloatTexture(int width, int height)
createMaskTextureback to summary
public Texture createMaskTexture(int width, int height, Texture.WrapMode wrapMode)
createMeshback to summary
public Mesh createMesh()
createMeshViewback to summary
public MeshView createMeshView(Mesh mesh)
createPathRepback to summary
public ShapeRep createPathRep()
createPhongMaterialback to summary
public PhongMaterial createPhongMaterial()
createPresentableback to summary
public Presentable createPresentable(PresentableState pState)
createRoundRectRepback to summary
public ShapeRep createRoundRectRep()
createRTTextureback to summary
public RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode)
createRTTextureback to summary
public RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode, boolean msaa)
createTextureback to summary
public 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. 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);
Parameters
image:Image

the pixel data to be uploaded to the new texture

usageHint:Texture.Usage

the Dynamic vs. Static nature of the texture data

wrapMode:Texture.WrapMode

the desired edge behavior (clamping vs. wrapping)

Returns:Texture

a new texture

createTextureback to summary
public 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. 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);
Parameters
image:Image

the pixel data to be uploaded to the new texture

usageHint:Texture.Usage

the Dynamic vs. Static nature of the texture data

wrapMode:Texture.WrapMode

the desired edge behavior (clamping vs. wrapping)

useMipmap:boolean

the flag indicates should texture be created with mipmap

Returns:Texture

a new texture

createTextureback to summary
public 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. 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.

Parameters
formatHint:PixelFormat

intended pixel format of the data to be stored in this texture

usageHint:Texture.Usage

the Dynamic vs. Static nature of the texture data

wrapMode:Texture.WrapMode

intended wrap mode to be used for the texture

w:int

width of the content in the texture

h:int

height of the content in the texture

Returns:Texture

texture most appropriate for the given intended format, wrap mode and dimensions

createTextureback to summary
public 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. 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.

Parameters
formatHint:PixelFormat

intended pixel format of the data to be stored in this texture

usageHint:Texture.Usage

the Dynamic vs. Static nature of the texture data

wrapMode:Texture.WrapMode

intended wrap mode to be used for the texture

w:int

width of the content in the texture

h:int

height of the content in the texture

useMipmap:boolean

the flag indicates should texture be created with mipmap

Returns:Texture

texture most appropriate for the given intended format, wrap mode and dimensions

createTextureback to summary
public Texture createTexture(MediaFrame frame)

Returns a new 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.

Parameters
frame:MediaFrame

the video image that we need to create a new texture for

Returns:Texture

texture most appropriate for the given video image.

getCachedTextureback to summary
public Texture getCachedTexture(Image image, Texture.WrapMode wrapMode)

Returns a 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.

Parameters
image:Image

the pixel data to be uploaded if the texture is new or needs new fringe pixels to simulate a new wrap mode

wrapMode:Texture.WrapMode

the mode that describes the behavior for samples outside the content area

Returns:Texture

a cached texture

getCachedTextureback to summary
public 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. 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.

Parameters
image:Image

the pixel data to be uploaded if the texture is new or needs new fringe pixels to simulate a new wrap mode

wrapMode:Texture.WrapMode

the mode that describes the behavior for samples outside the content

useMipmap:boolean

the flag indicates should mipmapping be used for this texture

Returns:Texture

a cached texture

getGlyphTextureback to summary
public Texture getGlyphTexture()
getMaximumTextureSizeback to summary
public int getMaximumTextureSize()

Returns the maximum supported texture dimension for this device. For example, if this method returns 2048, it means that textures larger than 2048x2048 cannot be created.

Returns:int

the maximum supported texture dimension

getRegionTextureback to summary
public Texture getRegionTexture()
getRTTHeightback to summary
public int getRTTHeight(int h, Texture.WrapMode wrapMode)
getRTTWidthback to summary
public int getRTTWidth(int w, Texture.WrapMode wrapMode)
getTextureResourcePoolback to summary
public TextureResourcePool<T> getTextureResourcePool()
isCompatibleTextureback to summary
public boolean isCompatibleTexture(Texture tex)

A Texture may have been obtained from a different resource factory.

Parameters
tex:Texture

the texture to check.

Returns:boolean

whether this texture is compatible.

isDeviceReadyback to summary
public boolean isDeviceReady()

Returns status of this graphics device, possibly reinitializing it. If the device is not ready the createRTTexture and present operations will fail. As long as the device has not been disposed, creation of shaders and regular textures will succeed and return valid resources. All hardware resources (RenderTargets and SwapChains) have to be recreated after a device-lost event notification.

Note

since this method can reinitialize the graphics device if it has been released, it should only be called at the start of a rendering pass.

Returns:boolean

true if this graphics device is ready for use.

isDisposedback to summary
public boolean isDisposed()

Returns whether this resource factory has been disposed. If this resource factory has been disposed, it is no longer valid and will need to be recreated before any new resources can be created. Any attempt to create a resource will be ignored and will return null.

Returns:boolean

true if this resource factory has been disposed.

isFormatSupportedback to summary
public boolean isFormatSupported(PixelFormat format)

Returns true if the given 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.

Parameters
format:PixelFormat

the PixelFormat to test

Returns:boolean

true if the given format is supported; false otherwise

isSuperShaderAllowedback to summary
public boolean isSuperShaderAllowed()
isWrapModeSupportedback to summary
public boolean isWrapModeSupported(Texture.WrapMode mode)

Returns true iff the indicated wrap mode is directly supported (i.e. not simulated) by the underlying pipeline and platform.

Parameters
mode:Texture.WrapMode

the desired WrapMode

Returns:boolean

true iff the wrap mode is supported and not simulated

removeFactoryListenerback to summary
public void removeFactoryListener(ResourceFactoryListener l)
setGlyphTextureback to summary
public void setGlyphTexture(Texture texture)
setRegionTextureback to summary
public void setRegionTexture(Texture texture)