001: /*
002: * Copyright (c) 2005-2008 Substance Kirill Grouchnikov. All Rights Reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * o Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * o Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * o Neither the name of Substance Kirill Grouchnikov nor the names of
015: * its contributors may be used to endorse or promote products derived
016: * from this software without specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
020: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
021: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
022: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
025: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
026: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
027: * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
028: * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029: */
030: package org.jvnet.substance.color;
031:
032: import java.awt.Color;
033:
034: import org.jvnet.substance.utils.SubstanceColorUtilities;
035: import org.jvnet.substance.utils.SubstanceCoreUtilities;
036:
037: /**
038: * Implementation of negated color scheme. Negated color scheme is based on
039: * some original color scheme, negating all the colors.
040: *
041: * @author Kirill Grouchnikov
042: */
043: public class NegatedColorScheme extends BaseColorScheme {
044: /**
045: * The main ultra-light color.
046: */
047: private Color mainUltraLightColor;
048:
049: /**
050: * The main extra-light color.
051: */
052: private Color mainExtraLightColor;
053:
054: /**
055: * The main light color.
056: */
057: private Color mainLightColor;
058:
059: /**
060: * The main medium color.
061: */
062: private Color mainMidColor;
063:
064: /**
065: * The main dark color.
066: */
067: private Color mainDarkColor;
068:
069: /**
070: * The main ultra-dark color.
071: */
072: private Color mainUltraDarkColor;
073:
074: /**
075: * The foreground color.
076: */
077: private Color foregroundColor;
078:
079: /**
080: * The original color scheme.
081: */
082: private ColorScheme origScheme;
083:
084: /**
085: * Creates a new inverted scheme.
086: *
087: * @param origScheme
088: * The original color scheme.
089: */
090: public NegatedColorScheme(ColorScheme origScheme) {
091: this .origScheme = origScheme;
092:
093: this .foregroundColor = SubstanceColorUtilities
094: .invertColor(origScheme.getForegroundColor());
095:
096: this .mainUltraDarkColor = SubstanceColorUtilities
097: .invertColor(origScheme.getUltraDarkColor());
098: this .mainDarkColor = SubstanceColorUtilities
099: .invertColor(origScheme.getDarkColor());
100: this .mainMidColor = SubstanceColorUtilities
101: .invertColor(origScheme.getMidColor());
102: this .mainLightColor = SubstanceColorUtilities
103: .invertColor(origScheme.getLightColor());
104: this .mainExtraLightColor = SubstanceColorUtilities
105: .invertColor(origScheme.getExtraLightColor());
106: this .mainUltraLightColor = SubstanceColorUtilities
107: .invertColor(origScheme.getUltraLightColor());
108:
109: this .id = "Negated "
110: + SubstanceCoreUtilities.getSchemeId(origScheme);
111: }
112:
113: /*
114: * (non-Javadoc)
115: *
116: * @see org.jvnet.substance.color.ColorScheme#getForegroundColor()
117: */
118: public Color getForegroundColor() {
119: return this .foregroundColor;
120: }
121:
122: /*
123: * (non-Javadoc)
124: *
125: * @see org.jvnet.substance.color.ColorScheme#getUltraLightColor()
126: */
127: public Color getUltraLightColor() {
128: return this .mainUltraLightColor;
129: }
130:
131: /*
132: * (non-Javadoc)
133: *
134: * @see org.jvnet.substance.color.ColorScheme#getExtraLightColor()
135: */
136: public Color getExtraLightColor() {
137: return this .mainExtraLightColor;
138: }
139:
140: /*
141: * (non-Javadoc)
142: *
143: * @see org.jvnet.substance.color.ColorScheme#getLightColor()
144: */
145: public Color getLightColor() {
146: return this .mainLightColor;
147: }
148:
149: /*
150: * (non-Javadoc)
151: *
152: * @see org.jvnet.substance.color.ColorScheme#getMidColor()
153: */
154: public Color getMidColor() {
155: return this .mainMidColor;
156: }
157:
158: /*
159: * (non-Javadoc)
160: *
161: * @see org.jvnet.substance.color.ColorScheme#getDarkColor()
162: */
163: public Color getDarkColor() {
164: return this .mainDarkColor;
165: }
166:
167: /*
168: * (non-Javadoc)
169: *
170: * @see org.jvnet.substance.color.ColorScheme#getUltraDarkColor()
171: */
172: public Color getUltraDarkColor() {
173: return this .mainUltraDarkColor;
174: }
175:
176: /**
177: * Returns the original color scheme.
178: *
179: * @return The original color scheme.
180: */
181: public ColorScheme getOrigScheme() {
182: return this.origScheme;
183: }
184: }
|