Java Doc for VolatileSurfaceManager.java in  » 6.0-JDK-Modules-sun » awt » sun » awt » image » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules sun » awt » sun.awt.image 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   sun.awt.image.SurfaceManager
      sun.awt.image.VolatileSurfaceManager

All known Subclasses:   sun.awt.image.BufImgVolatileSurfaceManager,
VolatileSurfaceManager
abstract public class VolatileSurfaceManager extends SurfaceManager implements DisplayChangedListener(Code)
This SurfaceManager variant manages an accelerated volatile surface, if it is possible to create that surface. If there is limited accelerated memory, or if the volatile surface disappears due to an operating system event, the VolatileSurfaceManager will attempt to restore the accelerated surface. If that fails, a system memory surface will be created in its place.


Field Summary
protected  Objectcontext
     Context for extra initialization parameters.
protected  booleanlostSurface
     Tracks loss of surface contents; queriable by user to see whether contents need to be restored.
protected  SurfaceDatasdAccel
     The accelerated SurfaceData object.
protected  SurfaceDatasdBackup
     The software-based SurfaceData object.
protected  SurfaceDatasdCurrent
     The current SurfaceData object.
protected  SurfaceDatasdPrevious
     A record-keeping object.
protected  SunVolatileImagevImg
     A reference to the VolatileImage whose contents are being managed.

Constructor Summary
protected  VolatileSurfaceManager(SunVolatileImage vImg, Object context)
    

Method Summary
public  voidacceleratedSurfaceLost()
     If the accelerated surface is the current SurfaceData for this manager, sets the variable lostSurface to true, which indicates that something happened to the image under management.
public  booleancontentsLost()
     Returns true if rendering data was lost since the last validate call.
public  voiddisplayChanged()
     Called from SunGraphicsEnv when there has been a display mode change. Note that we simply invalidate hardware surfaces here; we do not attempt to recreate or re-render them.
public  voidflush()
     Releases any associated hardware memory for this image by calling flush on sdAccel.
protected  SurfaceDatagetBackupSurface()
     Creates a software-based surface (of type BufImgSurfaceData). The software representation is only created when needed, which is only during some situation in which the hardware surface cannot be allocated.
public  ImageCapabilitiesgetCapabilities(GraphicsConfiguration gc)
    
public  SurfaceDatagetPrimarySurfaceData()
    
abstract protected  SurfaceDatainitAcceleratedSurface()
     Creates a new accelerated surface that is compatible with the current GraphicsConfiguration.
public  voidinitContents()
     Set contents of the current SurfaceData to default state (i.e.
public  voidinitialize()
     This init function is separate from the constructor because the things we are doing here necessitate the object's existence.
abstract protected  booleanisAccelerationEnabled()
     Returns true if acceleration is enabled.
protected  booleanisConfigValid(GraphicsConfiguration gc)
     Called by validate() to see whether the GC passed in is ok for rendering to.
public  voidpaletteChanged()
     When device palette changes, need to force a new copy of the image into our hardware cache to update the color indices of the pixels (indexed mode only).
protected  voidrestoreAcceleratedSurface()
     Restore sdAccel in case it was lost.
public  SurfaceDatarestoreContents()
     Called from a SurfaceData object, indicating that our accelerated surface has been lost and should be restored (perhaps using a backup system memory surface).
public  intvalidate(GraphicsConfiguration gc)
     Get the image ready for rendering.

Field Detail
context
protected Object context(Code)
Context for extra initialization parameters.



lostSurface
protected boolean lostSurface(Code)
Tracks loss of surface contents; queriable by user to see whether contents need to be restored.



sdAccel
protected SurfaceData sdAccel(Code)
The accelerated SurfaceData object.



sdBackup
protected SurfaceData sdBackup(Code)
The software-based SurfaceData object. Only create when first asked to (otherwise it is a waste of memory as it will only be used in situations of surface loss).



sdCurrent
protected SurfaceData sdCurrent(Code)
The current SurfaceData object.



sdPrevious
protected SurfaceData sdPrevious(Code)
A record-keeping object. This keeps track of which SurfaceData was in use during the last call to validate(). This lets us see whether the SurfaceData object has changed since then and allows us to return the correct returnCode to the user in the validate() call.



vImg
protected SunVolatileImage vImg(Code)
A reference to the VolatileImage whose contents are being managed.




Constructor Detail
VolatileSurfaceManager
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context)(Code)




Method Detail
acceleratedSurfaceLost
public void acceleratedSurfaceLost()(Code)
If the accelerated surface is the current SurfaceData for this manager, sets the variable lostSurface to true, which indicates that something happened to the image under management. This variable is used in the validate method to tell the caller that the surface contents need to be restored.



contentsLost
public boolean contentsLost()(Code)
Returns true if rendering data was lost since the last validate call.
See Also:   java.awt.image.VolatileImage.contentsLost



displayChanged
public void displayChanged()(Code)
Called from SunGraphicsEnv when there has been a display mode change. Note that we simply invalidate hardware surfaces here; we do not attempt to recreate or re-render them. This is to avoid threading conflicts with the native toolkit and associated threads. Instead, we just nullify the old surface data object and wait for a future method in the rendering process to recreate the surface.



flush
public void flush()(Code)
Releases any associated hardware memory for this image by calling flush on sdAccel. This method forces a lostSurface situation so any future operations on the image will need to revalidate the image first.



getBackupSurface
protected SurfaceData getBackupSurface()(Code)
Creates a software-based surface (of type BufImgSurfaceData). The software representation is only created when needed, which is only during some situation in which the hardware surface cannot be allocated. This allows apps to at least run, albeit more slowly than they would otherwise.



getCapabilities
public ImageCapabilities getCapabilities(GraphicsConfiguration gc)(Code)



getPrimarySurfaceData
public SurfaceData getPrimarySurfaceData()(Code)



initAcceleratedSurface
abstract protected SurfaceData initAcceleratedSurface()(Code)
Creates a new accelerated surface that is compatible with the current GraphicsConfiguration. Returns the new accelerated SurfaceData object, or null if the surface creation was not successful. Platform-specific subclasses should initialize an accelerated surface (e.g. a DirectDraw surface on Windows, an OpenGL pbuffer, or an X11 pixmap).



initContents
public void initContents()(Code)
Set contents of the current SurfaceData to default state (i.e. clear the background).



initialize
public void initialize()(Code)
This init function is separate from the constructor because the things we are doing here necessitate the object's existence. Otherwise, we end up calling into a subclass' overridden method during construction, before that subclass is completely constructed.



isAccelerationEnabled
abstract protected boolean isAccelerationEnabled()(Code)
Returns true if acceleration is enabled. If not, we simply use the backup SurfaceData object and return quickly from most methods in this class.



isConfigValid
protected boolean isConfigValid(GraphicsConfiguration gc)(Code)
Called by validate() to see whether the GC passed in is ok for rendering to. This generic implementation checks to see whether the GC is either null or is from the same device as the one that this image was created on. Platform- specific implementations may perform other checks as appropriate.



paletteChanged
public void paletteChanged()(Code)
When device palette changes, need to force a new copy of the image into our hardware cache to update the color indices of the pixels (indexed mode only).



restoreAcceleratedSurface
protected void restoreAcceleratedSurface()(Code)
Restore sdAccel in case it was lost. Do nothing in this default case; platform-specific implementations may do more in this situation as appropriate.



restoreContents
public SurfaceData restoreContents()(Code)
Called from a SurfaceData object, indicating that our accelerated surface has been lost and should be restored (perhaps using a backup system memory surface). Returns the newly restored primary SurfaceData object.



validate
public int validate(GraphicsConfiguration gc)(Code)
Get the image ready for rendering. This method is called to make sure that the accelerated SurfaceData exists and is ready to be used. Users call this method prior to any set of rendering to or from the image, to make sure the image is ready and compatible with the given GraphicsConfiguration. The image may not be "ready" if either we had problems creating it in the first place (e.g., there was no space in vram) or if the surface became lost (e.g., some other app or the OS caused vram surfaces to be removed). Note that we want to return RESTORED in any situation where the SurfaceData is different than it was last time. So whether it's software or hardware, if we have a different SurfaceData object, then the contents have been altered and we must reflect that change to the user.



Methods inherited from sun.awt.image.SurfaceManager
public void acceleratedSurfaceLost()(Code)(Java Doc)
public synchronized void flush()(Code)(Java Doc)
synchronized void flush(boolean deaccelerate)(Code)(Java Doc)
public Object getCacheData(Object key)(Code)(Java Doc)
public ImageCapabilities getCapabilities(GraphicsConfiguration gc)(Code)(Java Doc)
public static SurfaceManager getManager(Image img)(Code)(Java Doc)
abstract public SurfaceData getPrimarySurfaceData()(Code)(Java Doc)
abstract public SurfaceData restoreContents()(Code)(Java Doc)
public void setAccelerationPriority(float priority)(Code)(Java Doc)
public void setCacheData(Object key, Object value)(Code)(Java Doc)
public static void setImageAccessor(ImageAccessor ia)(Code)(Java Doc)
public static void setManager(Image img, SurfaceManager mgr)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.