Source Code Cross Referenced for AlphaComposite.java in  » Apache-Harmony-Java-SE » java-package » java » awt » 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 » Apache Harmony Java SE » java package » java.awt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:        /**
018:         * @author Igor V. Stolyarov
019:         * @version $Revision$
020:         */package java.awt;
021:
022:        import java.awt.Composite;
023:        import java.awt.CompositeContext;
024:        import java.awt.RenderingHints;
025:        import java.awt.image.ColorModel;
026:
027:        import org.apache.harmony.awt.gl.ICompositeContext;
028:        import org.apache.harmony.awt.internal.nls.Messages;
029:
030:        public final class AlphaComposite implements  Composite {
031:
032:            public static final int CLEAR = 1;
033:
034:            public static final int SRC = 2;
035:
036:            public static final int DST = 9;
037:
038:            public static final int SRC_OVER = 3;
039:
040:            public static final int DST_OVER = 4;
041:
042:            public static final int SRC_IN = 5;
043:
044:            public static final int DST_IN = 6;
045:
046:            public static final int SRC_OUT = 7;
047:
048:            public static final int DST_OUT = 8;
049:
050:            public static final int SRC_ATOP = 10;
051:
052:            public static final int DST_ATOP = 11;
053:
054:            public static final int XOR = 12;
055:
056:            public static final AlphaComposite Clear = new AlphaComposite(CLEAR);
057:
058:            public static final AlphaComposite Src = new AlphaComposite(SRC);
059:
060:            public static final AlphaComposite Dst = new AlphaComposite(DST);
061:
062:            public static final AlphaComposite SrcOver = new AlphaComposite(
063:                    SRC_OVER);
064:
065:            public static final AlphaComposite DstOver = new AlphaComposite(
066:                    DST_OVER);
067:
068:            public static final AlphaComposite SrcIn = new AlphaComposite(
069:                    SRC_IN);
070:
071:            public static final AlphaComposite DstIn = new AlphaComposite(
072:                    DST_IN);
073:
074:            public static final AlphaComposite SrcOut = new AlphaComposite(
075:                    SRC_OUT);
076:
077:            public static final AlphaComposite DstOut = new AlphaComposite(
078:                    DST_OUT);
079:
080:            public static final AlphaComposite SrcAtop = new AlphaComposite(
081:                    SRC_ATOP);
082:
083:            public static final AlphaComposite DstAtop = new AlphaComposite(
084:                    DST_ATOP);
085:
086:            public static final AlphaComposite Xor = new AlphaComposite(XOR);
087:
088:            private int rule;
089:            private float alpha;
090:
091:            private AlphaComposite(int rule, float alpha) {
092:                if (rule < CLEAR || rule > XOR) {
093:                    // awt.11D=Unknown rule
094:                    throw new IllegalArgumentException(Messages
095:                            .getString("awt.11D")); //$NON-NLS-1$
096:                }
097:                if (alpha < 0.0f || alpha > 1.0f) {
098:                    // awt.11E=Wrong alpha value
099:                    throw new IllegalArgumentException(Messages
100:                            .getString("awt.11E")); //$NON-NLS-1$
101:                }
102:
103:                this .rule = rule;
104:                this .alpha = alpha;
105:            }
106:
107:            private AlphaComposite(int rule) {
108:                this (rule, 1.0f);
109:            }
110:
111:            public CompositeContext createContext(ColorModel srcColorModel,
112:                    ColorModel dstColorModel, RenderingHints hints) {
113:                return new ICompositeContext(this , srcColorModel, dstColorModel);
114:            }
115:
116:            @Override
117:            public boolean equals(Object obj) {
118:                if (!(obj instanceof  AlphaComposite)) {
119:                    return false;
120:                }
121:                AlphaComposite other = (AlphaComposite) obj;
122:                return (this .rule == other.getRule() && this .alpha == other
123:                        .getAlpha());
124:            }
125:
126:            @Override
127:            public int hashCode() {
128:                int hash = Float.floatToIntBits(alpha);
129:                int tmp = hash >>> 24;
130:                hash <<= 8;
131:                hash |= tmp;
132:                hash ^= rule;
133:                return hash;
134:            }
135:
136:            public int getRule() {
137:                return rule;
138:            }
139:
140:            public float getAlpha() {
141:                return alpha;
142:            }
143:
144:            public static AlphaComposite getInstance(int rule, float alpha) {
145:                if (alpha == 1.0f) {
146:                    return getInstance(rule);
147:                }
148:                return new AlphaComposite(rule, alpha);
149:            }
150:
151:            public static AlphaComposite getInstance(int rule) {
152:                switch (rule) {
153:                case CLEAR:
154:                    return Clear;
155:                case SRC:
156:                    return Src;
157:                case DST:
158:                    return Dst;
159:                case SRC_OVER:
160:                    return SrcOver;
161:                case DST_OVER:
162:                    return DstOver;
163:                case SRC_IN:
164:                    return SrcIn;
165:                case DST_IN:
166:                    return DstIn;
167:                case SRC_OUT:
168:                    return SrcOut;
169:                case DST_OUT:
170:                    return DstOut;
171:                case SRC_ATOP:
172:                    return SrcAtop;
173:                case DST_ATOP:
174:                    return DstAtop;
175:                case XOR:
176:                    return Xor;
177:                default:
178:                    // awt.11D=Unknown rule
179:                    throw new IllegalArgumentException(Messages
180:                            .getString("awt.11D")); //$NON-NLS-1$
181:                }
182:            }
183:
184:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.