eu.hansolo.steelseries.tools.ForegroundImageFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SteelSeries Show documentation
Show all versions of SteelSeries Show documentation
The SteelSeries is a javabeans component library that contains gauges.
You will find linear and radial gauges. In addition you will also find
digital displays, indicators from cars and some instruments from airplanes and
sailboats.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package eu.hansolo.steelseries.tools;
/**
*
* @author hansolo
*/
public enum ForegroundImageFactory
{
INSTANCE;
private int radWidth = 0;
private boolean radWithCenterKnob = true;
private eu.hansolo.steelseries.tools.ForegroundType radType = eu.hansolo.steelseries.tools.ForegroundType.FG_TYPE1;
private final java.awt.GraphicsConfiguration GFX_CONF = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
private java.awt.image.BufferedImage radForegroundImage = GFX_CONF.createCompatibleImage(200, 200, java.awt.Transparency.TRANSLUCENT);
private int linWidth = 0;
private int linHeight = 0;
private boolean linWithCenterKnob = false;
private java.awt.image.BufferedImage linForegroundImage = GFX_CONF.createCompatibleImage(200, 200, java.awt.Transparency.TRANSLUCENT);
/**
* Creates the foreground image for a radial gauge.
* The image parameters and the image will be cached. If the
* current request has the same parameters as the last request
* it will return the already created image instead of creating
* a new image.
* @param WIDTH
* @return a buffered image that contains the foreground image of a radial gauge
*/
public java.awt.image.BufferedImage createRadialForeground(final int WIDTH)
{
return createRadialForeground(WIDTH, true, eu.hansolo.steelseries.tools.ForegroundType.FG_TYPE1);
}
/**
* Creates the foreground image for a radial gauge.
* The image parameters and the image will be cached. If the
* current request has the same parameters as the last request
* it will return the already created image instead of creating
* a new image.
* @param WIDTH
* @param WITH_CENTER_KNOB
* @return a buffered image that contains the foreground image of a radial gauge
*/
public java.awt.image.BufferedImage createRadialForeground(final int WIDTH, final boolean WITH_CENTER_KNOB)
{
return createRadialForeground(WIDTH, WITH_CENTER_KNOB, eu.hansolo.steelseries.tools.ForegroundType.FG_TYPE1);
}
/**
* Creates the foreground image for a radial gauge.
* The image parameters and the image will be cached. If the
* current request has the same parameters as the last request
* it will return the already created image instead of creating
* a new image.
* @param WIDTH
* @param WITH_CENTER_KNOB
* @param TYPE
* @return a buffered image that contains the foreground image of a radial gauge
*/
public java.awt.image.BufferedImage createRadialForeground(final int WIDTH, final boolean WITH_CENTER_KNOB, final eu.hansolo.steelseries.tools.ForegroundType TYPE)
{
if (WIDTH <= 0)
{
return GFX_CONF.createCompatibleImage(200, 200, java.awt.Transparency.TRANSLUCENT);
}
// Take image from cache instead of creating a new one if parameters are the same as last time
if (radWidth == WIDTH && radWithCenterKnob == WITH_CENTER_KNOB && radType == TYPE)
{
return radForegroundImage;
}
radForegroundImage.flush();
radForegroundImage = GFX_CONF.createCompatibleImage(WIDTH, WIDTH, java.awt.Transparency.TRANSLUCENT);
final java.awt.Graphics2D G2 = radForegroundImage.createGraphics();
G2.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING, java.awt.RenderingHints.VALUE_ANTIALIAS_ON);
final int IMAGE_WIDTH = radForegroundImage.getWidth();
final int IMAGE_HEIGHT = radForegroundImage.getHeight();
if (WITH_CENTER_KNOB)
{
final java.awt.geom.Ellipse2D E_CENTER_KNOB_FRAME = new java.awt.geom.Ellipse2D.Double(IMAGE_WIDTH * 0.4579439163208008, IMAGE_HEIGHT * 0.4579439163208008, IMAGE_WIDTH * 0.08411216735839844, IMAGE_HEIGHT * 0.08411216735839844);
final java.awt.geom.Point2D E_CENTER_KNOB_FRAME_START = new java.awt.geom.Point2D.Double(0, E_CENTER_KNOB_FRAME.getBounds2D().getMinY());
final java.awt.geom.Point2D E_CENTER_KNOB_FRAME_STOP = new java.awt.geom.Point2D.Double(0, E_CENTER_KNOB_FRAME.getBounds2D().getMaxY());
final float[] E_CENTER_KNOB_FRAME_FRACTIONS =
{
0.0f,
0.46f,
1.0f
};
final java.awt.Color[] E_CENTER_KNOB_FRAME_COLORS =
{
new java.awt.Color(180, 180, 180, 255),
new java.awt.Color(63, 63, 63, 255),
new java.awt.Color(40, 40, 40, 255)
};
final java.awt.LinearGradientPaint E_CENTER_KNOB_FRAME_GRADIENT = new java.awt.LinearGradientPaint(E_CENTER_KNOB_FRAME_START, E_CENTER_KNOB_FRAME_STOP, E_CENTER_KNOB_FRAME_FRACTIONS, E_CENTER_KNOB_FRAME_COLORS);
G2.setPaint(E_CENTER_KNOB_FRAME_GRADIENT);
G2.fill(E_CENTER_KNOB_FRAME);
final java.awt.geom.Ellipse2D E_CENTER_KNOB_MAIN = new java.awt.geom.Ellipse2D.Double(IMAGE_WIDTH * 0.4672897160053253, IMAGE_HEIGHT * 0.4672897160053253, IMAGE_WIDTH * 0.06542053818702698, IMAGE_HEIGHT * 0.06542053818702698);
final java.awt.geom.Point2D E_CENTER_KNOB_MAIN_START = new java.awt.geom.Point2D.Double(0, E_CENTER_KNOB_MAIN.getBounds2D().getMinY());
final java.awt.geom.Point2D E_CENTER_KNOB_MAIN_STOP = new java.awt.geom.Point2D.Double(0, E_CENTER_KNOB_MAIN.getBounds2D().getMaxY());
final float[] E_CENTER_KNOB_MAIN_FRACTIONS =
{
0.0f,
1.0f
};
final java.awt.Color[] E_CENTER_KNOB_MAIN_COLORS =
{
new java.awt.Color(217, 217, 217, 255),
new java.awt.Color(191, 191, 191, 255)
};
final java.awt.LinearGradientPaint E_CENTER_KNOB_MAIN_GRADIENT = new java.awt.LinearGradientPaint(E_CENTER_KNOB_MAIN_START, E_CENTER_KNOB_MAIN_STOP, E_CENTER_KNOB_MAIN_FRACTIONS, E_CENTER_KNOB_MAIN_COLORS);
G2.setPaint(E_CENTER_KNOB_MAIN_GRADIENT);
G2.fill(E_CENTER_KNOB_MAIN);
final java.awt.geom.Ellipse2D E_CENTER_KNOB_INNERSHADOW = new java.awt.geom.Ellipse2D.Double(IMAGE_WIDTH * 0.4672897160053253, IMAGE_HEIGHT * 0.4672897160053253, IMAGE_WIDTH * 0.06542053818702698, IMAGE_HEIGHT * 0.06542053818702698);
final java.awt.geom.Point2D E_CENTER_KNOB_INNERSHADOW_CENTER = new java.awt.geom.Point2D.Double((0.4953271028037383 * IMAGE_WIDTH), (0.49065420560747663 * IMAGE_HEIGHT));
final float[] E_CENTER_KNOB_INNERSHADOW_FRACTIONS =
{
0.0f,
0.75f,
0.76f,
1.0f
};
final java.awt.Color[] E_CENTER_KNOB_INNERSHADOW_COLORS =
{
new java.awt.Color(0, 0, 0, 0),
new java.awt.Color(0, 0, 0, 0),
new java.awt.Color(0, 0, 0, 1),
new java.awt.Color(0, 0, 0, 51)
};
final java.awt.RadialGradientPaint E_CENTER_KNOB_INNERSHADOW_GRADIENT = new java.awt.RadialGradientPaint(E_CENTER_KNOB_INNERSHADOW_CENTER, (float) (0.03271028037383177 * IMAGE_WIDTH), E_CENTER_KNOB_INNERSHADOW_FRACTIONS, E_CENTER_KNOB_INNERSHADOW_COLORS);
G2.setPaint(E_CENTER_KNOB_INNERSHADOW_GRADIENT);
G2.fill(E_CENTER_KNOB_INNERSHADOW);
}
final java.awt.geom.GeneralPath HIGHLIGHT = new java.awt.geom.GeneralPath();
final java.awt.geom.Point2D HIGHLIGHT_START = new java.awt.geom.Point2D.Double();
final java.awt.geom.Point2D HIGHLIGHT_STOP = new java.awt.geom.Point2D.Double();
final float[] HIGHLIGHT_FRACTIONS =
{
0.0f,
1.0f
};
final java.awt.Color[] HIGHLIGHT_COLORS =
{
new java.awt.Color(1.0f, 1.0f, 1.0f, 0.3f),
new java.awt.Color(1.0f, 1.0f, 1.0f, 0.1f)
};
final java.awt.LinearGradientPaint HIGHLIGHT_GRADIENT;
switch(TYPE)
{
case FG_TYPE1:
HIGHLIGHT.setWindingRule(java.awt.geom.GeneralPath.WIND_EVEN_ODD);
HIGHLIGHT.moveTo(IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.49065420560747663);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.5, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.5046728971962616, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.5093457943925234);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.20093457943925233, IMAGE_HEIGHT * 0.4532710280373832, IMAGE_WIDTH * 0.32710280373831774, IMAGE_HEIGHT * 0.4158878504672897, IMAGE_WIDTH * 0.49065420560747663, IMAGE_HEIGHT * 0.4158878504672897);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.6588785046728972, IMAGE_HEIGHT * 0.4158878504672897, IMAGE_WIDTH * 0.794392523364486, IMAGE_HEIGHT * 0.4439252336448598, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.514018691588785);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.5046728971962616, IMAGE_WIDTH * 0.9205607476635514, IMAGE_HEIGHT * 0.5, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.49065420560747663);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.2757009345794392, IMAGE_WIDTH * 0.7476635514018691, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.08411214953271028);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.2523364485981308, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.2803738317757009, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.49065420560747663);
HIGHLIGHT.closePath();
HIGHLIGHT_START.setLocation(0, HIGHLIGHT.getBounds2D().getMinY());
HIGHLIGHT_STOP.setLocation(0, HIGHLIGHT.getBounds2D().getMaxY());
HIGHLIGHT_GRADIENT = new java.awt.LinearGradientPaint(HIGHLIGHT_START, HIGHLIGHT_STOP, HIGHLIGHT_FRACTIONS, HIGHLIGHT_COLORS);
G2.setPaint(HIGHLIGHT_GRADIENT);
G2.fill(HIGHLIGHT);
break;
case FG_TYPE2:
HIGHLIGHT.setWindingRule(java.awt.geom.GeneralPath.WIND_EVEN_ODD);
HIGHLIGHT.moveTo(IMAGE_WIDTH * 0.13551401869158877, IMAGE_HEIGHT * 0.6962616822429907);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.21495327102803738, IMAGE_HEIGHT * 0.5887850467289719, IMAGE_WIDTH * 0.3177570093457944, IMAGE_HEIGHT * 0.5, IMAGE_WIDTH * 0.46261682242990654, IMAGE_HEIGHT * 0.4252336448598131);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.6121495327102804, IMAGE_HEIGHT * 0.34579439252336447, IMAGE_WIDTH * 0.7336448598130841, IMAGE_HEIGHT * 0.3177570093457944, IMAGE_WIDTH * 0.8738317757009346, IMAGE_HEIGHT * 0.32242990654205606);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.7663551401869159, IMAGE_HEIGHT * 0.11214953271028037, IMAGE_WIDTH * 0.5280373831775701, IMAGE_HEIGHT * 0.02336448598130841, IMAGE_WIDTH * 0.3130841121495327, IMAGE_HEIGHT * 0.1308411214953271);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.09813084112149532, IMAGE_HEIGHT * 0.2383177570093458, IMAGE_WIDTH * 0.028037383177570093, IMAGE_HEIGHT * 0.48598130841121495, IMAGE_WIDTH * 0.13551401869158877, IMAGE_HEIGHT * 0.6962616822429907);
HIGHLIGHT.closePath();
HIGHLIGHT_START.setLocation((0.3130841121495327 * IMAGE_WIDTH), (0.13551401869158877 * IMAGE_HEIGHT) );
HIGHLIGHT_STOP.setLocation(((0.3130841121495327 + 0.1824447802691637) * IMAGE_WIDTH), ((0.13551401869158877 + 0.3580680424308394) * IMAGE_HEIGHT) );
HIGHLIGHT_GRADIENT = new java.awt.LinearGradientPaint(HIGHLIGHT_START, HIGHLIGHT_STOP, HIGHLIGHT_FRACTIONS, HIGHLIGHT_COLORS);
G2.setPaint(HIGHLIGHT_GRADIENT);
G2.fill(HIGHLIGHT);
break;
case FG_TYPE3:
HIGHLIGHT.setWindingRule(java.awt.geom.GeneralPath.WIND_EVEN_ODD);
HIGHLIGHT.moveTo(IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.5093457943925234);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.2102803738317757, IMAGE_HEIGHT * 0.5560747663551402, IMAGE_WIDTH * 0.46261682242990654, IMAGE_HEIGHT * 0.5607476635514018, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.5607476635514018);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.5373831775700935, IMAGE_HEIGHT * 0.5607476635514018, IMAGE_WIDTH * 0.794392523364486, IMAGE_HEIGHT * 0.5607476635514018, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.5093457943925234);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.2757009345794392, IMAGE_WIDTH * 0.7383177570093458, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.08411214953271028);
HIGHLIGHT.curveTo(IMAGE_WIDTH * 0.2616822429906542, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.2757009345794392, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.5093457943925234);
HIGHLIGHT.closePath();
HIGHLIGHT_START.setLocation(0, HIGHLIGHT.getBounds2D().getMinY() );
HIGHLIGHT_STOP.setLocation(0, HIGHLIGHT.getBounds2D().getMaxY() );
HIGHLIGHT_GRADIENT = new java.awt.LinearGradientPaint(HIGHLIGHT_START, HIGHLIGHT_STOP, HIGHLIGHT_FRACTIONS, HIGHLIGHT_COLORS);
G2.setPaint(HIGHLIGHT_GRADIENT);
G2.fill(HIGHLIGHT);
break;
}
G2.dispose();
// Cache current values
radWidth = WIDTH;
radWithCenterKnob = WITH_CENTER_KNOB;
radType = TYPE;
return radForegroundImage;
}
/**
* Creates the foreground image for a linear gauge.
* The image parameters and the image will be cached. If the
* current request has the same parameters as the last request
* it will return the already created image instead of creating
* a new image.
* @param WIDTH
* @param HEIGHT
* @return a buffered image that contains the foreground image of a linear gauge
*/
public java.awt.image.BufferedImage createLinearForeground(final int WIDTH, final int HEIGHT)
{
return createLinearForeground(WIDTH, HEIGHT, false);
}
public java.awt.image.BufferedImage createLinearForeground(final int WIDTH, final int HEIGHT, final boolean WITH_CENTER_KNOB)
{
if (WIDTH <= 0 || HEIGHT <= 0)
{
return GFX_CONF.createCompatibleImage(140, 140, java.awt.Transparency.TRANSLUCENT);
}
// Take image from cache instead of creating a new one if parameters are the same as last time
if (linWidth == WIDTH && linHeight == HEIGHT && linWithCenterKnob == WITH_CENTER_KNOB)
{
return linForegroundImage;
}
linForegroundImage.flush();
linForegroundImage = GFX_CONF.createCompatibleImage(WIDTH, HEIGHT, java.awt.Transparency.TRANSLUCENT);
final java.awt.Graphics2D G2 = linForegroundImage.createGraphics();
G2.setRenderingHint(java.awt.RenderingHints.KEY_ANTIALIASING, java.awt.RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(java.awt.RenderingHints.KEY_STROKE_CONTROL, java.awt.RenderingHints.VALUE_STROKE_PURE);
final int IMAGE_WIDTH = linForegroundImage.getWidth();
final int IMAGE_HEIGHT = linForegroundImage.getHeight();
if (WITH_CENTER_KNOB)
{
final java.awt.geom.Ellipse2D E_CENTER_KNOB_FRAME = new java.awt.geom.Ellipse2D.Double(IMAGE_WIDTH * 0.4579439163208008, IMAGE_HEIGHT * 0.4579439163208008, IMAGE_WIDTH * 0.08411216735839844, IMAGE_HEIGHT * 0.08411216735839844);
final java.awt.geom.Point2D E_CENTER_KNOB_FRAME_START = new java.awt.geom.Point2D.Double(0, E_CENTER_KNOB_FRAME.getBounds2D().getMinY());
final java.awt.geom.Point2D E_CENTER_KNOB_FRAME_STOP = new java.awt.geom.Point2D.Double(0, E_CENTER_KNOB_FRAME.getBounds2D().getMaxY());
final float[] E_CENTER_KNOB_FRAME_FRACTIONS =
{
0.0f,
0.46f,
1.0f
};
final java.awt.Color[] E_CENTER_KNOB_FRAME_COLORS =
{
new java.awt.Color(180, 180, 180, 255),
new java.awt.Color(63, 63, 63, 255),
new java.awt.Color(40, 40, 40, 255)
};
final java.awt.LinearGradientPaint E_CENTER_KNOB_FRAME_GRADIENT = new java.awt.LinearGradientPaint(E_CENTER_KNOB_FRAME_START, E_CENTER_KNOB_FRAME_STOP, E_CENTER_KNOB_FRAME_FRACTIONS, E_CENTER_KNOB_FRAME_COLORS);
G2.setPaint(E_CENTER_KNOB_FRAME_GRADIENT);
G2.fill(E_CENTER_KNOB_FRAME);
final java.awt.geom.Ellipse2D E_CENTER_KNOB_MAIN = new java.awt.geom.Ellipse2D.Double(IMAGE_WIDTH * 0.4672897160053253, IMAGE_HEIGHT * 0.4672897160053253, IMAGE_WIDTH * 0.06542053818702698, IMAGE_HEIGHT * 0.06542053818702698);
final java.awt.geom.Point2D E_CENTER_KNOB_MAIN_START = new java.awt.geom.Point2D.Double(0, E_CENTER_KNOB_MAIN.getBounds2D().getMinY());
final java.awt.geom.Point2D E_CENTER_KNOB_MAIN_STOP = new java.awt.geom.Point2D.Double(0, E_CENTER_KNOB_MAIN.getBounds2D().getMaxY());
final float[] E_CENTER_KNOB_MAIN_FRACTIONS =
{
0.0f,
1.0f
};
final java.awt.Color[] E_CENTER_KNOB_MAIN_COLORS =
{
new java.awt.Color(217, 217, 217, 255),
new java.awt.Color(191, 191, 191, 255)
};
final java.awt.LinearGradientPaint E_CENTER_KNOB_MAIN_GRADIENT = new java.awt.LinearGradientPaint(E_CENTER_KNOB_MAIN_START, E_CENTER_KNOB_MAIN_STOP, E_CENTER_KNOB_MAIN_FRACTIONS, E_CENTER_KNOB_MAIN_COLORS);
G2.setPaint(E_CENTER_KNOB_MAIN_GRADIENT);
G2.fill(E_CENTER_KNOB_MAIN);
final java.awt.geom.Ellipse2D E_CENTER_KNOB_INNERSHADOW = new java.awt.geom.Ellipse2D.Double(IMAGE_WIDTH * 0.4672897160053253, IMAGE_HEIGHT * 0.4672897160053253, IMAGE_WIDTH * 0.06542053818702698, IMAGE_HEIGHT * 0.06542053818702698);
final java.awt.geom.Point2D E_CENTER_KNOB_INNERSHADOW_CENTER = new java.awt.geom.Point2D.Double((0.4953271028037383 * IMAGE_WIDTH), (0.49065420560747663 * IMAGE_HEIGHT));
final float[] E_CENTER_KNOB_INNERSHADOW_FRACTIONS =
{
0.0f,
0.75f,
0.76f,
1.0f
};
final java.awt.Color[] E_CENTER_KNOB_INNERSHADOW_COLORS =
{
new java.awt.Color(0, 0, 0, 0),
new java.awt.Color(0, 0, 0, 0),
new java.awt.Color(0, 0, 0, 1),
new java.awt.Color(0, 0, 0, 51)
};
final java.awt.RadialGradientPaint E_CENTER_KNOB_INNERSHADOW_GRADIENT = new java.awt.RadialGradientPaint(E_CENTER_KNOB_INNERSHADOW_CENTER, (float) (0.03271028037383177 * IMAGE_WIDTH), E_CENTER_KNOB_INNERSHADOW_FRACTIONS, E_CENTER_KNOB_INNERSHADOW_COLORS);
G2.setPaint(E_CENTER_KNOB_INNERSHADOW_GRADIENT);
G2.fill(E_CENTER_KNOB_INNERSHADOW);
}
// Highlight
final java.awt.geom.GeneralPath GLASSEFFECT = new java.awt.geom.GeneralPath();
GLASSEFFECT.setWindingRule(java.awt.geom.GeneralPath.WIND_EVEN_ODD);
final java.awt.geom.Point2D GLASSEFFECT_START;
final java.awt.geom.Point2D GLASSEFFECT_STOP;
final java.awt.LinearGradientPaint GLASSEFFECT_GRADIENT;
if (WIDTH >= HEIGHT)
{
// Horizontal glass effect
GLASSEFFECT.moveTo(18, IMAGE_HEIGHT - 18);
GLASSEFFECT.lineTo(IMAGE_WIDTH - 18, IMAGE_HEIGHT - 18);
GLASSEFFECT.curveTo(IMAGE_WIDTH - 18, IMAGE_HEIGHT - 18, IMAGE_WIDTH - 27, IMAGE_HEIGHT * 0.7, IMAGE_WIDTH - 27, IMAGE_HEIGHT * 0.5);
GLASSEFFECT.curveTo(IMAGE_WIDTH - 27, 27, IMAGE_WIDTH - 18, 18, IMAGE_WIDTH - 18, 18);
GLASSEFFECT.lineTo(18, 18);
GLASSEFFECT.curveTo(18, 18, 27, IMAGE_HEIGHT * 0.2857142857142857, 27, IMAGE_HEIGHT * 0.5);
GLASSEFFECT.curveTo(27, IMAGE_HEIGHT * 0.7, 18, IMAGE_HEIGHT - 18, 18, IMAGE_HEIGHT - 18);
GLASSEFFECT.closePath();
GLASSEFFECT_START = new java.awt.geom.Point2D.Double(0, GLASSEFFECT.getBounds2D().getMaxY() );
GLASSEFFECT_STOP = new java.awt.geom.Point2D.Double(0, GLASSEFFECT.getBounds2D().getMinY() );
}
else
{
// Vertical glass effect
GLASSEFFECT.setWindingRule(java.awt.geom.GeneralPath.WIND_EVEN_ODD);
GLASSEFFECT.moveTo(18, 18);
GLASSEFFECT.lineTo(18, IMAGE_HEIGHT - 18);
GLASSEFFECT.curveTo(18, IMAGE_HEIGHT - 18, 27, IMAGE_HEIGHT - 27, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT - 27);
GLASSEFFECT.curveTo(IMAGE_WIDTH - 27, IMAGE_HEIGHT - 27, IMAGE_WIDTH - 18, IMAGE_HEIGHT - 18, IMAGE_WIDTH - 18, IMAGE_HEIGHT - 18);
GLASSEFFECT.lineTo(IMAGE_WIDTH - 18, 18);
GLASSEFFECT.curveTo(IMAGE_WIDTH - 18, 18, IMAGE_WIDTH - 27, 27, IMAGE_WIDTH * 0.5, 27);
GLASSEFFECT.curveTo(27, 27, 18, 18, 18, 18);
GLASSEFFECT.closePath();
GLASSEFFECT_START = new java.awt.geom.Point2D.Double(GLASSEFFECT.getBounds2D().getMinX(), 0);
GLASSEFFECT_STOP = new java.awt.geom.Point2D.Double(GLASSEFFECT.getBounds2D().getMaxX(), 0);
}
final float[] GLASSEFFECT_FRACTIONS =
{
0.0f,
0.06f,
0.07f,
0.12f,
0.17f,
0.1701f,
0.79f,
0.8f,
0.84f,
0.93f,
0.94f,
0.96f,
0.97f,
1.0f
};
final java.awt.Color[] GLASSEFFECT_COLORS =
{
new java.awt.Color(255, 255, 255, 0),
new java.awt.Color(255, 255, 255, 0),
new java.awt.Color(255, 255, 255, 0),
new java.awt.Color(255, 255, 255, 0),
new java.awt.Color(255, 255, 255, 3),
new java.awt.Color(255, 255, 255, 5),
new java.awt.Color(255, 255, 255, 5),
new java.awt.Color(255, 255, 255, 5),
new java.awt.Color(255, 255, 255, 20),
new java.awt.Color(255, 255, 255, 73),
new java.awt.Color(255, 255, 255, 76),
new java.awt.Color(255, 255, 255, 30),
new java.awt.Color(255, 255, 255, 10),
new java.awt.Color(255, 255, 255, 5)
};
GLASSEFFECT_GRADIENT = new java.awt.LinearGradientPaint(GLASSEFFECT_START, GLASSEFFECT_STOP, GLASSEFFECT_FRACTIONS, GLASSEFFECT_COLORS);
G2.setPaint(GLASSEFFECT_GRADIENT);
G2.fill(GLASSEFFECT);
G2.dispose();
// Cache current values
linWidth = WIDTH;
linHeight = HEIGHT;
linWithCenterKnob = WITH_CENTER_KNOB;
return linForegroundImage;
}
@Override
public String toString()
{
return "ForegroundImageFactory";
}
}