Source Code Cross Referenced for SunWritableRaster.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 Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:
026:        package sun.awt.image;
027:
028:        import java.awt.Point;
029:        import java.awt.Rectangle;
030:        import java.awt.Image;
031:        import java.awt.image.DataBuffer;
032:        import java.awt.image.DataBufferByte;
033:        import java.awt.image.DataBufferUShort;
034:        import java.awt.image.DataBufferInt;
035:        import java.awt.image.SampleModel;
036:        import java.awt.image.WritableRaster;
037:
038:        import sun.java2d.SurfaceData;
039:        import sun.java2d.StateTrackableDelegate;
040:
041:        /**
042:         * This class exists as a middle layer between WritableRaster and its
043:         * implementation specific subclasses (ByteComponentRaster, ShortBandedRaster,
044:         * etc).
045:         * It provides utilities to steal the data arrays from the standard DataBuffer
046:         * types and also steals the StateTrackableDelegate from the associated
047:         * DataBuffer so that it can be updated when the data is changed.
048:         */
049:        public class SunWritableRaster extends WritableRaster {
050:            private static DataStealer stealer;
051:
052:            public static interface DataStealer {
053:                public byte[] getData(DataBufferByte dbb, int bank);
054:
055:                public short[] getData(DataBufferUShort dbus, int bank);
056:
057:                public int[] getData(DataBufferInt dbi, int bank);
058:
059:                public StateTrackableDelegate getTrackable(DataBuffer db);
060:            }
061:
062:            public static void setDataStealer(DataStealer ds) {
063:                if (stealer != null) {
064:                    throw new InternalError("Attempt to set DataStealer twice");
065:                }
066:                stealer = ds;
067:            }
068:
069:            public static byte[] stealData(DataBufferByte dbb, int bank) {
070:                return stealer.getData(dbb, bank);
071:            }
072:
073:            public static short[] stealData(DataBufferUShort dbus, int bank) {
074:                return stealer.getData(dbus, bank);
075:            }
076:
077:            public static int[] stealData(DataBufferInt dbi, int bank) {
078:                return stealer.getData(dbi, bank);
079:            }
080:
081:            public static StateTrackableDelegate stealTrackable(DataBuffer db) {
082:                return stealer.getTrackable(db);
083:            }
084:
085:            public static void markDirty(DataBuffer db) {
086:                stealer.getTrackable(db).markDirty();
087:            }
088:
089:            public static void markDirty(WritableRaster wr) {
090:                if (wr instanceof  SunWritableRaster) {
091:                    ((SunWritableRaster) wr).markDirty();
092:                } else {
093:                    markDirty(wr.getDataBuffer());
094:                }
095:            }
096:
097:            public static void markDirty(Image img) {
098:                SurfaceData.getPrimarySurfaceData(img).markDirty();
099:            }
100:
101:            private StateTrackableDelegate theTrackable;
102:
103:            public SunWritableRaster(SampleModel sampleModel, Point origin) {
104:                super (sampleModel, origin);
105:                theTrackable = stealTrackable(dataBuffer);
106:            }
107:
108:            public SunWritableRaster(SampleModel sampleModel,
109:                    DataBuffer dataBuffer, Point origin) {
110:                super (sampleModel, dataBuffer, origin);
111:                theTrackable = stealTrackable(dataBuffer);
112:            }
113:
114:            public SunWritableRaster(SampleModel sampleModel,
115:                    DataBuffer dataBuffer, Rectangle aRegion,
116:                    Point sampleModelTranslate, WritableRaster parent) {
117:                super (sampleModel, dataBuffer, aRegion, sampleModelTranslate,
118:                        parent);
119:                theTrackable = stealTrackable(dataBuffer);
120:            }
121:
122:            /**
123:             * Mark the TrackableDelegate of the associated DataBuffer dirty.
124:             */
125:            public final void markDirty() {
126:                theTrackable.markDirty();
127:            }
128:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.