APIdia Launch Partner
Top Fields Constructors Methods
com.sun.prism.impl

public abstract Class BaseResourceFactory

extends Object
implements ResourceFactory
Class Inheritance
All Implemented Interfaces
com.sun.prism.ResourceFactory, com.sun.prism.GraphicsResource
Known Direct Subclasses
com.sun.prism.impl.ps.BaseShaderFactory, com.sun.prism.j2d.J2DResourceFactory, com.sun.prism.sw.SWResourceFactory
Imports
com.sun.javafx.geom.Rectangle, com.sun.prism.Image, .PixelFormat, .ResourceFactory, .ResourceFactoryListener, .Texture, .Texture.Usage, .Texture.WrapMode, java.util.Map, .WeakHashMap, .Collection, javafx.util.Pair

Field Summary

Modifier and TypeField and Description
private final Map<Image, Texture>
private boolean
private Texture
private final WeakHashMap<ResourceFactoryListener, Boolean>
private final Map<Image, Texture>
private Texture
private final Map<Image, Texture>
private boolean

Constructor Summary

AccessConstructor and Description
public
public
BaseResourceFactory(Map<Image, Texture> clampTexCache, Map<Image, Texture> repeatTexCache, Map<Image, Texture> mipmapTexCache)

Method Summary

Modifier and TypeMethod and Description
public void
protected boolean
protected boolean
protected boolean
protected boolean
protected void
protected void
public Texture
public Texture
public Texture
createTexture(Image image, Texture.Usage usageHint, Texture.WrapMode wrapMode)

Implements com.sun.prism.ResourceFactory.createTexture.

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

public Texture
createTexture(Image image, Texture.Usage usageHint, Texture.WrapMode wrapMode, boolean useMipmap)

Implements com.sun.prism.ResourceFactory.createTexture.

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

public void
private void
public Texture
getCachedTexture(Image image, Texture.WrapMode wrapMode)

Implements com.sun.prism.ResourceFactory.getCachedTexture.

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

public Texture
getCachedTexture(Image image, Texture.WrapMode wrapMode, boolean useMipmap)

Implements com.sun.prism.ResourceFactory.getCachedTexture.

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

protected ResourceFactoryListener[]
public Texture
public Texture
public boolean
isDeviceReady()

Implements com.sun.prism.ResourceFactory.isDeviceReady.

Returns status of this graphics device, possibly reinitializing it.

public boolean
isDisposed()

Implements com.sun.prism.ResourceFactory.isDisposed.

Returns whether this resource factory has been disposed.

public boolean
public boolean
isWrapModeSupported(Texture.WrapMode mode)

Implements com.sun.prism.ResourceFactory.isWrapModeSupported.

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

protected void
notifyReset()

Called when the factory is reset.

public void
public void
public void
pack-priv static long
sizeWithMipMap(int w, int h, PixelFormat format)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clampTexCacheback to summary
private final Map<Image, Texture> clampTexCache
disposedback to summary
private boolean disposed
glyphTextureback to summary
private Texture glyphTexture
listenerMapback to summary
private final WeakHashMap<ResourceFactoryListener, Boolean> listenerMap
mipmapTexCacheback to summary
private final Map<Image, Texture> mipmapTexCache
regionTextureback to summary
private Texture regionTexture
repeatTexCacheback to summary
private final Map<Image, Texture> repeatTexCache
superShaderAllowedback to summary
private boolean superShaderAllowed

Constructor Detail

BaseResourceFactoryback to summary
public BaseResourceFactory()
BaseResourceFactoryback to summary
public BaseResourceFactory(Map<Image, Texture> clampTexCache, Map<Image, Texture> repeatTexCache, Map<Image, Texture> mipmapTexCache)

Method Detail

addFactoryListenerback to summary
public void addFactoryListener(ResourceFactoryListener l)

Implements com.sun.prism.ResourceFactory.addFactoryListener.

Annotations
@Override
canClampToEdgeback to summary
protected boolean canClampToEdge()
canClampToZeroback to summary
protected boolean canClampToZero()
canRepeatback to summary
protected boolean canRepeat()
checkDisposedback to summary
protected boolean checkDisposed()
clearTextureCacheback to summary
protected void clearTextureCache()
clearTextureCacheback to summary
protected void clearTextureCache(Map<Image, Texture> texCache)
createFloatTextureback to summary
public Texture createFloatTexture(int width, int height)

Implements com.sun.prism.ResourceFactory.createFloatTexture.

Annotations
@Override
createMaskTextureback to summary
public Texture createMaskTexture(int width, int height, Texture.WrapMode wrapMode)

Implements com.sun.prism.ResourceFactory.createMaskTexture.

Annotations
@Override
createTextureback to summary
public Texture createTexture(Image image, Texture.Usage usageHint, Texture.WrapMode wrapMode)

Implements com.sun.prism.ResourceFactory.createTexture.

Doc from com.sun.prism.ResourceFactory.createTexture.

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);
Annotations
@Override
createTextureback to summary
public Texture createTexture(Image image, Texture.Usage usageHint, Texture.WrapMode wrapMode, boolean useMipmap)

Implements com.sun.prism.ResourceFactory.createTexture.

Doc from com.sun.prism.ResourceFactory.createTexture.

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);
Annotations
@Override
disposeback to summary
public void dispose()

Implements com.sun.prism.GraphicsResource.dispose.

Annotations
@Override
disposeResourcesback to summary
private void disposeResources()
getCachedTextureback to summary
public Texture getCachedTexture(Image image, Texture.WrapMode wrapMode)

Implements com.sun.prism.ResourceFactory.getCachedTexture.

Doc from com.sun.prism.ResourceFactory.getCachedTexture.

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.

Annotations
@Override
getCachedTextureback to summary
public Texture getCachedTexture(Image image, Texture.WrapMode wrapMode, boolean useMipmap)

Implements com.sun.prism.ResourceFactory.getCachedTexture.

Doc from com.sun.prism.ResourceFactory.getCachedTexture.

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.

Annotations
@Override
getFactoryListenersback to summary
protected ResourceFactoryListener[] getFactoryListeners()
getGlyphTextureback to summary
public Texture getGlyphTexture()

Implements com.sun.prism.ResourceFactory.getGlyphTexture.

Annotations
@Override
getRegionTextureback to summary
public Texture getRegionTexture()

Implements com.sun.prism.ResourceFactory.getRegionTexture.

Annotations
@Override
isDeviceReadyback to summary
public boolean isDeviceReady()

Implements com.sun.prism.ResourceFactory.isDeviceReady.

Doc from com.sun.prism.ResourceFactory.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.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Implements com.sun.prism.ResourceFactory.isDisposed.

Doc from com.sun.prism.ResourceFactory.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.

Annotations
@Override
isSuperShaderAllowedback to summary
public boolean isSuperShaderAllowed()

Implements com.sun.prism.ResourceFactory.isSuperShaderAllowed.

Annotations
@Override
isWrapModeSupportedback to summary
public boolean isWrapModeSupported(Texture.WrapMode mode)

Implements com.sun.prism.ResourceFactory.isWrapModeSupported.

Doc from com.sun.prism.ResourceFactory.isWrapModeSupported.

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

Annotations
@Override
notifyResetback to summary
protected void notifyReset()

Called when the factory is reset. Some resources (based in vram) could be lost.

removeFactoryListenerback to summary
public void removeFactoryListener(ResourceFactoryListener l)

Implements com.sun.prism.ResourceFactory.removeFactoryListener.

Annotations
@Override
setGlyphTextureback to summary
public void setGlyphTexture(Texture texture)

Implements com.sun.prism.ResourceFactory.setGlyphTexture.

Annotations
@Override
setRegionTextureback to summary
public void setRegionTexture(Texture texture)

Implements com.sun.prism.ResourceFactory.setRegionTexture.

Annotations
@Override
sizeWithMipMapback to summary
pack-priv static long sizeWithMipMap(int w, int h, PixelFormat format)