Save This Page
Home » openjdk-7 » sun » awt » image » [javadoc | source]
sun.awt.image
abstract public class: SurfaceManager [javadoc | source]
java.lang.Object
   sun.awt.image.SurfaceManager

Direct Known Subclasses:
    BufImgSurfaceManager, WinBackBufferSurfaceManager, X11VolatileSurfaceManager, WinVolatileSurfaceManager, VolatileSurfaceManager, BufImgVolatileSurfaceManager, GLXVolatileSurfaceManager, WGLVolatileSurfaceManager

The abstract base class that manages the various SurfaceData objects that represent an Image's contents. Subclasses can customize how the surfaces are organized, whether to cache the original contents in an accelerated surface, and so on.

The SurfaceManager also maintains an arbitrary "cache" mechanism which allows other agents to store data in it specific to their use of this image. The most common use of the caching mechanism is for destination SurfaceData objects to store cached copies of the source image.
Nested Class Summary:
abstract public static class  SurfaceManager.ImageAccessor   
class  SurfaceManager.ImageCapabilitiesGc   
public static interface  SurfaceManager.ProxiedGraphicsConfig  An interface for GraphicsConfiguration objects to implement if their surfaces accelerate images using SurfaceDataProxy objects. Implementing this interface facilitates the default implementation of getImageCapabilities() above. 
public static interface  SurfaceManager.FlushableCacheData  An interface for Objects used in the SurfaceManager cache to implement if they have data that should be flushed when the Image is flushed. 
Method from sun.awt.image.SurfaceManager Summary:
acceleratedSurfaceLost,   flush,   flush,   getCacheData,   getCapabilities,   getManager,   getPrimarySurfaceData,   restoreContents,   setAccelerationPriority,   setCacheData,   setImageAccessor,   setManager
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.awt.image.SurfaceManager Detail:
 public  void acceleratedSurfaceLost() 
    Notification that any accelerated surfaces associated with this manager have been "lost", which might mean that they need to be manually restored or recreated. The default implementation does nothing, but platform-specific variants which have accelerated surfaces should perform any necessary actions.
 public synchronized  void flush() 
    Releases system resources in use by ancillary SurfaceData objects, such as surfaces cached in accelerated memory. Subclasses should override to release any of their flushable data.

    The default implementation will visit all of the value objects in the cacheMap and flush them if they implement the FlushableCacheData interface.

 synchronized  void flush(boolean deaccelerate) 
 public Object getCacheData(Object key) 
    Return an arbitrary cached object for an arbitrary cache key. Other objects can use this mechanism to store cached data about the source image that will let them save time when using or manipulating the image in the future.

    Note that the cache is maintained as a simple Map with no attempts to keep it up to date or invalidate it so any data stored here must either not be dependent on the state of the image or it must be individually tracked to see if it is outdated or obsolete.

    The SurfaceData object of the primary (destination) surface has a StateTracker mechanism which can help track the validity and "currentness" of any data stored here. For convenience and expediency an object stored as cached data may implement the FlushableCacheData interface specified below so that it may be notified immediately if the flush() method is ever called.

 public ImageCapabilities getCapabilities(GraphicsConfiguration gc) 
    Returns an ImageCapabilities object which can be inquired as to the specific capabilities of this Image. The capabilities object will return true for isAccelerated() if the image has a current and valid SurfaceDataProxy object cached for the specified GraphicsConfiguration parameter.

    This class provides a default implementation of the ImageCapabilities that will try to determine if there is an associated SurfaceDataProxy object and if it is up to date, but only works for GraphicsConfiguration objects which implement the ProxiedGraphicsConfig interface defined below. In practice, all configs which can be accelerated are currently implementing that interface.

    A null GraphicsConfiguration returns a value based on whether the image is currently accelerated on its default GraphicsConfiguration.

 public static SurfaceManager getManager(Image img) 
    Returns the SurfaceManager object contained within the given Image.
 abstract public SurfaceData getPrimarySurfaceData()
    Returns the main SurfaceData object that "owns" the pixels for this SurfaceManager. This SurfaceData is used as the destination surface in a rendering operation and is the most authoritative storage for the current state of the pixels, though other versions might be cached in other locations for efficiency.
 abstract public SurfaceData restoreContents()
    Restores the primary surface being managed, and then returns the replacement surface. This is called when an accelerated surface has been "lost", in an attempt to auto-restore its contents.
 public  void setAccelerationPriority(float priority) 
    Called when image's acceleration priority is changed.

    The default implementation will visit all of the value objects in the cacheMap when the priority gets set to 0.0 and flush them if they implement the FlushableCacheData interface.

 public  void setCacheData(Object key,
    Object value) 
    Store an arbitrary cached object for an arbitrary cache key. See the getCacheData() method for notes on tracking the validity of data stored using this mechanism.
 public static  void setImageAccessor(SurfaceManager.ImageAccessor ia) 
 public static  void setManager(Image img,
    SurfaceManager mgr)