Java Code Examples for java.awt.geom.GeneralPath#setWindingRule()
The following examples show how to use
java.awt.geom.GeneralPath#setWindingRule() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractRadial.java From mars-sim with GNU General Public License v3.0 | 6 votes |
/** * Returns the image of the MinMeasuredValue and MaxMeasuredValue dependend * @param WIDTH * @param COLOR * @param ROTATION_OFFSET * @return the image of the min or max measured value */ protected BufferedImage create_MEASURED_VALUE_Image(final int WIDTH, final Color COLOR, final double ROTATION_OFFSET) { if (WIDTH <= 36) // 36 is needed otherwise the image size could be smaller than 1 { return UTIL.createImage(1, 1, Transparency.TRANSLUCENT); } final int IMAGE_HEIGHT = (int) (WIDTH * 0.0280373832); final int IMAGE_WIDTH = IMAGE_HEIGHT; final BufferedImage IMAGE = UTIL.createImage(IMAGE_WIDTH, IMAGE_HEIGHT, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.rotate(ROTATION_OFFSET, IMAGE_WIDTH / 2.0, IMAGE_HEIGHT / 2.0); final GeneralPath INDICATOR = new GeneralPath(); INDICATOR.setWindingRule(Path2D.WIND_EVEN_ODD); INDICATOR.moveTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT); INDICATOR.lineTo(0.0, 0.0); INDICATOR.lineTo(IMAGE_WIDTH, 0.0); INDICATOR.closePath(); G2.setColor(COLOR); G2.fill(INDICATOR); G2.dispose(); return IMAGE; }
Example 2
Source File: LivreBase.java From brModelo with GNU General Public License v3.0 | 5 votes |
public Shape getRegiaoNota() { if (Regiao == null) { final int v1 = getHeight() / 3; final int h1 = getWidth() / 2; final int repo = v1 / 3; final int L = getLeft(); final int T = getTop(); final int TH = T + getHeight() - repo; final int LW = L + getWidth(); CubicCurve2D c = new CubicCurve2D.Double(); c.setCurve(LW, TH, LW - h1, TH - v1, L + h1, TH + v1, L, TH); CubicCurve2D c2 = new CubicCurve2D.Double(); int v2 = v1 / 3; c2.setCurve(L, T + v2, L + h1, T + v1 + v2, LW - h1, T - v1 + v2, LW, T + v2); GeneralPath pa = new GeneralPath(); pa.setWindingRule(GeneralPath.WIND_EVEN_ODD); pa.append(c2, true); pa.lineTo(LW, TH); pa.append(c, true); pa.lineTo(L, T + v2); pa.closePath(); Regiao = pa; int ptToMove = 3; this.reposicionePonto[ptToMove] = new Point(0, -repo); ptsToMove[ptToMove] = 1; ptToMove = 1; this.reposicionePonto[ptToMove] = new Point(0, repo); ptsToMove[ptToMove] = 1; } return Regiao; }
Example 3
Source File: AbstractGauge.java From mars-sim with GNU General Public License v3.0 | 5 votes |
/** * Returns an image of the lcd threshold indicator with the given size and color * @param WIDTH * @param HEIGHT * @param COLOR * @return an image of the lcd threshold indicator */ public BufferedImage create_LCD_THRESHOLD_Image(final int WIDTH, final int HEIGHT, final Color COLOR) { if (WIDTH <= 0 || HEIGHT <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, HEIGHT, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath LCD_THRESHOLD = new GeneralPath(); LCD_THRESHOLD.setWindingRule(Path2D.WIND_EVEN_ODD); LCD_THRESHOLD.moveTo(IMAGE_WIDTH * 0.4444444444444444, IMAGE_HEIGHT * 0.7777777777777778); LCD_THRESHOLD.lineTo(IMAGE_WIDTH * 0.5555555555555556, IMAGE_HEIGHT * 0.7777777777777778); LCD_THRESHOLD.lineTo(IMAGE_WIDTH * 0.5555555555555556, IMAGE_HEIGHT * 0.8888888888888888); LCD_THRESHOLD.lineTo(IMAGE_WIDTH * 0.4444444444444444, IMAGE_HEIGHT * 0.8888888888888888); LCD_THRESHOLD.lineTo(IMAGE_WIDTH * 0.4444444444444444, IMAGE_HEIGHT * 0.7777777777777778); LCD_THRESHOLD.closePath(); LCD_THRESHOLD.moveTo(IMAGE_WIDTH * 0.4444444444444444, IMAGE_HEIGHT * 0.3333333333333333); LCD_THRESHOLD.lineTo(IMAGE_WIDTH * 0.5555555555555556, IMAGE_HEIGHT * 0.3333333333333333); LCD_THRESHOLD.lineTo(IMAGE_WIDTH * 0.5555555555555556, IMAGE_HEIGHT * 0.7222222222222222); LCD_THRESHOLD.lineTo(IMAGE_WIDTH * 0.4444444444444444, IMAGE_HEIGHT * 0.7222222222222222); LCD_THRESHOLD.lineTo(IMAGE_WIDTH * 0.4444444444444444, IMAGE_HEIGHT * 0.3333333333333333); LCD_THRESHOLD.closePath(); LCD_THRESHOLD.moveTo(0.0, IMAGE_HEIGHT); LCD_THRESHOLD.lineTo(IMAGE_WIDTH, IMAGE_HEIGHT); LCD_THRESHOLD.lineTo(IMAGE_WIDTH * 0.5, 0.0); LCD_THRESHOLD.lineTo(0.0, IMAGE_HEIGHT); LCD_THRESHOLD.closePath(); G2.setColor(COLOR); G2.fill(LCD_THRESHOLD); G2.dispose(); return IMAGE; }
Example 4
Source File: Radial2Top.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override protected BufferedImage create_DISABLED_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, (int) (0.641860465116279 * WIDTH), Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath GAUGE_BACKGROUND = new GeneralPath(); GAUGE_BACKGROUND.setWindingRule(Path2D.WIND_EVEN_ODD); GAUGE_BACKGROUND.moveTo(IMAGE_WIDTH * 0.08372093023255814, IMAGE_HEIGHT * 0.7753623188405797); GAUGE_BACKGROUND.curveTo(IMAGE_WIDTH * 0.08372093023255814, IMAGE_HEIGHT * 0.42028985507246375, IMAGE_WIDTH * 0.26976744186046514, IMAGE_HEIGHT * 0.13043478260869565, IMAGE_WIDTH * 0.49767441860465117, IMAGE_HEIGHT * 0.13043478260869565); GAUGE_BACKGROUND.curveTo(IMAGE_WIDTH * 0.7255813953488373, IMAGE_HEIGHT * 0.13043478260869565, IMAGE_WIDTH * 0.9116279069767442, IMAGE_HEIGHT * 0.42028985507246375, IMAGE_WIDTH * 0.9116279069767442, IMAGE_HEIGHT * 0.7753623188405797); GAUGE_BACKGROUND.curveTo(IMAGE_WIDTH * 0.9116279069767442, IMAGE_HEIGHT * 0.8188405797101449, IMAGE_WIDTH * 0.9069767441860465, IMAGE_HEIGHT * 0.8695652173913043, IMAGE_WIDTH * 0.9069767441860465, IMAGE_HEIGHT * 0.8695652173913043); GAUGE_BACKGROUND.lineTo(IMAGE_WIDTH * 0.08837209302325581, IMAGE_HEIGHT * 0.8695652173913043); GAUGE_BACKGROUND.curveTo(IMAGE_WIDTH * 0.08837209302325581, IMAGE_HEIGHT * 0.8695652173913043, IMAGE_WIDTH * 0.08372093023255814, IMAGE_HEIGHT * 0.8115942028985508, IMAGE_WIDTH * 0.08372093023255814, IMAGE_HEIGHT * 0.7753623188405797); GAUGE_BACKGROUND.closePath(); G2.setColor(new Color(102, 102, 102, 178)); G2.fill(GAUGE_BACKGROUND); G2.dispose(); return IMAGE; }
Example 5
Source File: GeneralPathLoader.java From osp with GNU General Public License v3.0 | 5 votes |
public Object loadObject(XMLControl control, Object obj) { GeneralPath path = (GeneralPath) obj; path.reset(); path.setWindingRule(control.getInt("winding rule")); //$NON-NLS-1$ loadPathSegments(path, control.getString("segments")); //$NON-NLS-1$ return path; }
Example 6
Source File: StopWatch.java From mars-sim with GNU General Public License v3.0 | 5 votes |
private BufferedImage create_SMALL_POINTER_SHADOW_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath STOPWATCHPOINTERSMALL = new GeneralPath(); STOPWATCHPOINTERSMALL.setWindingRule(Path2D.WIND_EVEN_ODD); STOPWATCHPOINTERSMALL.moveTo(IMAGE_WIDTH * 0.4766355140186916, IMAGE_HEIGHT * 0.3130841121495327); STOPWATCHPOINTERSMALL.curveTo(IMAGE_WIDTH * 0.4766355140186916, IMAGE_HEIGHT * 0.32242990654205606, IMAGE_WIDTH * 0.48598130841121495, IMAGE_HEIGHT * 0.3317757009345794, IMAGE_WIDTH * 0.4953271028037383, IMAGE_HEIGHT * 0.3364485981308411); STOPWATCHPOINTERSMALL.curveTo(IMAGE_WIDTH * 0.4953271028037383, IMAGE_HEIGHT * 0.3364485981308411, IMAGE_WIDTH * 0.4953271028037383, IMAGE_HEIGHT * 0.35046728971962615, IMAGE_WIDTH * 0.4953271028037383, IMAGE_HEIGHT * 0.35046728971962615); STOPWATCHPOINTERSMALL.lineTo(IMAGE_WIDTH * 0.5046728971962616, IMAGE_HEIGHT * 0.35046728971962615); STOPWATCHPOINTERSMALL.curveTo(IMAGE_WIDTH * 0.5046728971962616, IMAGE_HEIGHT * 0.35046728971962615, IMAGE_WIDTH * 0.5046728971962616, IMAGE_HEIGHT * 0.3364485981308411, IMAGE_WIDTH * 0.5046728971962616, IMAGE_HEIGHT * 0.3364485981308411); STOPWATCHPOINTERSMALL.curveTo(IMAGE_WIDTH * 0.514018691588785, IMAGE_HEIGHT * 0.3317757009345794, IMAGE_WIDTH * 0.5233644859813084, IMAGE_HEIGHT * 0.32242990654205606, IMAGE_WIDTH * 0.5233644859813084, IMAGE_HEIGHT * 0.3130841121495327); STOPWATCHPOINTERSMALL.curveTo(IMAGE_WIDTH * 0.5233644859813084, IMAGE_HEIGHT * 0.3037383177570093, IMAGE_WIDTH * 0.514018691588785, IMAGE_HEIGHT * 0.29439252336448596, IMAGE_WIDTH * 0.5046728971962616, IMAGE_HEIGHT * 0.2897196261682243); STOPWATCHPOINTERSMALL.curveTo(IMAGE_WIDTH * 0.5046728971962616, IMAGE_HEIGHT * 0.2897196261682243, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.20093457943925233, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.20093457943925233); STOPWATCHPOINTERSMALL.curveTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.20093457943925233, IMAGE_WIDTH * 0.4953271028037383, IMAGE_HEIGHT * 0.2897196261682243, IMAGE_WIDTH * 0.4953271028037383, IMAGE_HEIGHT * 0.2897196261682243); STOPWATCHPOINTERSMALL.curveTo(IMAGE_WIDTH * 0.48598130841121495, IMAGE_HEIGHT * 0.29439252336448596, IMAGE_WIDTH * 0.4766355140186916, IMAGE_HEIGHT * 0.3037383177570093, IMAGE_WIDTH * 0.4766355140186916, IMAGE_HEIGHT * 0.3130841121495327); STOPWATCHPOINTERSMALL.closePath(); G2.setPaint(SHADOW_COLOR); G2.fill(STOPWATCHPOINTERSMALL); G2.dispose(); return IMAGE; }
Example 7
Source File: WindDirection.java From mars-sim with GNU General Public License v3.0 | 5 votes |
private BufferedImage create_SHIP_Image(final int WIDTH, BufferedImage image) { if (WIDTH <= 0) { return UTIL.createImage(1, 1, Transparency.TRANSLUCENT); } if (image == null) { image = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); } final Graphics2D G2 = image.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = image.getWidth(); final int IMAGE_HEIGHT = image.getHeight(); final GeneralPath SHIP = new GeneralPath(); SHIP.setWindingRule(Path2D.WIND_EVEN_ODD); SHIP.moveTo(IMAGE_WIDTH * 0.4439252336448598, IMAGE_HEIGHT * 0.7242990654205608); SHIP.curveTo(IMAGE_WIDTH * 0.4439252336448598, IMAGE_HEIGHT * 0.7242990654205608, IMAGE_WIDTH * 0.45794392523364486, IMAGE_HEIGHT * 0.7383177570093458, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.7383177570093458); SHIP.curveTo(IMAGE_WIDTH * 0.5420560747663551, IMAGE_HEIGHT * 0.7383177570093458, IMAGE_WIDTH * 0.5560747663551402, IMAGE_HEIGHT * 0.7242990654205608, IMAGE_WIDTH * 0.5560747663551402, IMAGE_HEIGHT * 0.7242990654205608); SHIP.curveTo(IMAGE_WIDTH * 0.5560747663551402, IMAGE_HEIGHT * 0.7242990654205608, IMAGE_WIDTH * 0.5654205607476636, IMAGE_HEIGHT * 0.6962616822429907, IMAGE_WIDTH * 0.5654205607476636, IMAGE_HEIGHT * 0.48598130841121495); SHIP.curveTo(IMAGE_WIDTH * 0.5654205607476636, IMAGE_HEIGHT * 0.2897196261682243, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.2336448598130841, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.2336448598130841); SHIP.curveTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.2336448598130841, IMAGE_WIDTH * 0.42990654205607476, IMAGE_HEIGHT * 0.2897196261682243, IMAGE_WIDTH * 0.42990654205607476, IMAGE_HEIGHT * 0.48598130841121495); SHIP.curveTo(IMAGE_WIDTH * 0.42990654205607476, IMAGE_HEIGHT * 0.719626168224299, IMAGE_WIDTH * 0.4439252336448598, IMAGE_HEIGHT * 0.7242990654205608, IMAGE_WIDTH * 0.4439252336448598, IMAGE_HEIGHT * 0.7242990654205608); SHIP.closePath(); G2.setColor(getBackgroundColor().LABEL_COLOR); G2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); G2.draw(SHIP); G2.dispose(); return image; }
Example 8
Source File: TrafficLight.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public BufferedImage createRedOnImage(final int WIDTH, final int HEIGHT) { final GraphicsConfiguration GFX_CONF = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); if (WIDTH <= 0 || HEIGHT <= 0) { return GFX_CONF.createCompatibleImage(1, 1, java.awt.Transparency.TRANSLUCENT); } final BufferedImage IMAGE = GFX_CONF.createCompatibleImage(WIDTH, HEIGHT, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final Ellipse2D LIGHT_ON = new Ellipse2D.Double(0.17346938775510204 * IMAGE_WIDTH, 0.07553956834532374 * IMAGE_HEIGHT, 0.6530612244897959 * IMAGE_WIDTH, 0.2302158273381295 * IMAGE_HEIGHT); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.1906474820143885 * IMAGE_HEIGHT), (0.32653061224489793f * IMAGE_WIDTH), new float[]{0.0f, 1.0f}, new Color[]{new Color(1f, 0f, 0f, 1f), new Color(0.2549019608f, 0f, 0.0156862745f, 1f)})); G2.fill(LIGHT_ON); final GeneralPath GLOW = new GeneralPath(); GLOW.setWindingRule(Path2D.WIND_EVEN_ODD); GLOW.moveTo(0.0 * IMAGE_WIDTH, 0.19424460431654678 * IMAGE_HEIGHT); GLOW.curveTo(0.0 * IMAGE_WIDTH, 0.29136690647482016 * IMAGE_HEIGHT, 0.22448979591836735 * IMAGE_WIDTH, 0.37050359712230213 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.37050359712230213 * IMAGE_HEIGHT); GLOW.curveTo(0.7755102040816326 * IMAGE_WIDTH, 0.37050359712230213 * IMAGE_HEIGHT, 1.0 * IMAGE_WIDTH, 0.29136690647482016 * IMAGE_HEIGHT, 1.0 * IMAGE_WIDTH, 0.1906474820143885 * IMAGE_HEIGHT); GLOW.curveTo(0.9081632653061225 * IMAGE_WIDTH, 0.13309352517985612 * IMAGE_HEIGHT, 0.7040816326530612 * IMAGE_WIDTH, 0.0683453237410072 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.0683453237410072 * IMAGE_HEIGHT); GLOW.curveTo(0.2857142857142857 * IMAGE_WIDTH, 0.0683453237410072 * IMAGE_HEIGHT, 0.08163265306122448 * IMAGE_WIDTH, 0.13309352517985612 * IMAGE_HEIGHT, 0.0 * IMAGE_WIDTH, 0.19424460431654678 * IMAGE_HEIGHT); GLOW.closePath(); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.1906474820143885 * IMAGE_HEIGHT), (0.5153061224489796f * IMAGE_WIDTH), new float[]{0.0f, 1.0f}, new Color[]{new Color(1f, 0f, 0f, 1f), new Color(0.4627450980f, 0.0196078431f, 0.0039215686f, 0f)})); G2.fill(GLOW); G2.dispose(); return IMAGE; }
Example 9
Source File: Clock.java From mars-sim with GNU General Public License v3.0 | 4 votes |
private BufferedImage create_SECOND_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); switch (getPointerType()) { case TYPE2: final Rectangle2D TOP = new Rectangle2D.Double(IMAGE_WIDTH * 0.4953271028, IMAGE_WIDTH * 0.0981308411, IMAGE_WIDTH * 0.0093457944, IMAGE_WIDTH * 0.1261682243); final Rectangle2D BOTTOM = new Rectangle2D.Double(IMAGE_WIDTH * 0.4906542056, IMAGE_WIDTH * 0.308411215, IMAGE_WIDTH * 0.0186915888, IMAGE_WIDTH * 0.191588785); final java.awt.geom.Area SECOND = new java.awt.geom.Area(TOP); SECOND.add(new java.awt.geom.Area(new Ellipse2D.Double(IMAGE_WIDTH * 0.453271028, IMAGE_WIDTH * 0.2196261682, IMAGE_WIDTH * 0.0934579439, IMAGE_WIDTH * 0.0934579439))); SECOND.subtract(new java.awt.geom.Area(new Ellipse2D.Double(IMAGE_WIDTH * 0.4672897196, IMAGE_WIDTH * 0.2336448598, IMAGE_WIDTH * 0.0654205607, IMAGE_WIDTH * 0.0654205607))); SECOND.add(new java.awt.geom.Area(BOTTOM)); final GeneralPath SECOND_POINTER = new GeneralPath(SECOND); G2.setPaint(ColorDef.RED.MEDIUM); G2.fill(SECOND_POINTER); break; case TYPE1: default: final GeneralPath SECONDPOINTER = new GeneralPath(); SECONDPOINTER.setWindingRule(Path2D.WIND_EVEN_ODD); SECONDPOINTER.moveTo(IMAGE_WIDTH * 0.5093457943925234, IMAGE_HEIGHT * 0.11682242990654206); SECONDPOINTER.lineTo(IMAGE_WIDTH * 0.5093457943925234, IMAGE_HEIGHT * 0.5747663551401869); SECONDPOINTER.lineTo(IMAGE_WIDTH * 0.49065420560747663, IMAGE_HEIGHT * 0.5747663551401869); SECONDPOINTER.lineTo(IMAGE_WIDTH * 0.49065420560747663, IMAGE_HEIGHT * 0.11682242990654206); SECONDPOINTER.lineTo(IMAGE_WIDTH * 0.5093457943925234, IMAGE_HEIGHT * 0.11682242990654206); SECONDPOINTER.closePath(); final Point2D SECONDPOINTER_START = new Point2D.Double(SECONDPOINTER.getBounds2D().getMaxX(), 0); final Point2D SECONDPOINTER_STOP = new Point2D.Double(SECONDPOINTER.getBounds2D().getMinX(), 0); final float[] SECONDPOINTER_FRACTIONS = { 0.0f, 0.47f, 1.0f }; final Color[] SECONDPOINTER_COLORS = { new Color(236, 123, 125, 255), new Color(231, 27, 33, 255), new Color(166, 40, 46, 255) }; final LinearGradientPaint SECONDPOINTER_GRADIENT = new LinearGradientPaint(SECONDPOINTER_START, SECONDPOINTER_STOP, SECONDPOINTER_FRACTIONS, SECONDPOINTER_COLORS); G2.setPaint(SECONDPOINTER_GRADIENT); G2.fill(SECONDPOINTER); break; } G2.dispose(); return IMAGE; }
Example 10
Source File: LivreBase.java From brModelo with GNU General Public License v3.0 | 4 votes |
public Shape getRegiaoVDocumentos() { if (Regiao == null) { final int v1 = getHeight() / 3; final int h1 = getWidth() / 2; final int repo = v1 / 3; final int L = getLeft(); int recuo = h1 / 8; final int T = getTop() + recuo; final int TH = T + getHeight() - repo - recuo; final int LW = L + getWidth() - recuo; CubicCurve2D c = new CubicCurve2D.Double(); c.setCurve(L, TH, L + h1, TH + v1, LW - h1, TH - v1, LW, TH); GeneralPath pa = new GeneralPath(); pa.setWindingRule(GeneralPath.WIND_EVEN_ODD); pa.moveTo(LW, TH); pa.lineTo(LW, T); pa.lineTo(L, T); pa.lineTo(L, TH); pa.append(c, false); int tam = recuo / 2; pa.moveTo(L + tam, T); pa.lineTo(L + tam, T - tam); pa.lineTo(LW + tam, T - tam); pa.lineTo(LW + tam, TH - tam); pa.lineTo(LW, TH - tam); pa.lineTo(LW, T); pa.lineTo(L + tam, T); tam = recuo; pa.moveTo(L + tam, T - (tam / 2)); pa.lineTo(L + tam, T - tam); pa.lineTo(LW + tam, T - tam); pa.lineTo(LW + tam, TH - tam); pa.lineTo(LW + (tam / 2), TH - tam); pa.lineTo(LW + (tam / 2), T - (tam / 2)); pa.lineTo(L + tam, T - (tam / 2)); pa.closePath(); Regiao = pa; final int ptToMove = 3; this.reposicionePonto[ptToMove] = new Point(-tam / 2, -repo); ptsToMove[ptToMove] = 1; } return Regiao; }
Example 11
Source File: Clock.java From mars-sim with GNU General Public License v3.0 | 4 votes |
private BufferedImage create_KNOB_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath KNOBSHADOW = new GeneralPath(); KNOBSHADOW.setWindingRule(Path2D.WIND_EVEN_ODD); KNOBSHADOW.moveTo(IMAGE_WIDTH * 0.4532710280373832, IMAGE_HEIGHT * 0.5046728971962616); KNOBSHADOW.curveTo(IMAGE_WIDTH * 0.4532710280373832, IMAGE_HEIGHT * 0.48130841121495327, IMAGE_WIDTH * 0.4719626168224299, IMAGE_HEIGHT * 0.45794392523364486, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.45794392523364486); KNOBSHADOW.curveTo(IMAGE_WIDTH * 0.5280373831775701, IMAGE_HEIGHT * 0.45794392523364486, IMAGE_WIDTH * 0.5467289719626168, IMAGE_HEIGHT * 0.48130841121495327, IMAGE_WIDTH * 0.5467289719626168, IMAGE_HEIGHT * 0.5046728971962616); KNOBSHADOW.curveTo(IMAGE_WIDTH * 0.5467289719626168, IMAGE_HEIGHT * 0.5327102803738317, IMAGE_WIDTH * 0.5280373831775701, IMAGE_HEIGHT * 0.5560747663551402, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.5560747663551402); KNOBSHADOW.curveTo(IMAGE_WIDTH * 0.4719626168224299, IMAGE_HEIGHT * 0.5560747663551402, IMAGE_WIDTH * 0.4532710280373832, IMAGE_HEIGHT * 0.5327102803738317, IMAGE_WIDTH * 0.4532710280373832, IMAGE_HEIGHT * 0.5046728971962616); KNOBSHADOW.closePath(); final Point2D KNOBSHADOW_START = new Point2D.Double(0, KNOBSHADOW.getBounds2D().getMinY()); final Point2D KNOBSHADOW_STOP = new Point2D.Double(0, KNOBSHADOW.getBounds2D().getMaxY()); final float[] KNOBSHADOW_FRACTIONS = { 0.0f, 1.0f }; final Color[] KNOBSHADOW_COLORS = { new Color(40, 40, 41, 255), new Color(13, 13, 13, 255) }; final LinearGradientPaint KNOBSHADOW_GRADIENT = new LinearGradientPaint(KNOBSHADOW_START, KNOBSHADOW_STOP, KNOBSHADOW_FRACTIONS, KNOBSHADOW_COLORS); G2.setPaint(KNOBSHADOW_GRADIENT); G2.fill(KNOBSHADOW); final GeneralPath KNOB = new GeneralPath(); KNOB.setWindingRule(Path2D.WIND_EVEN_ODD); KNOB.moveTo(IMAGE_WIDTH * 0.45794392523364486, IMAGE_HEIGHT * 0.5); KNOB.curveTo(IMAGE_WIDTH * 0.45794392523364486, IMAGE_HEIGHT * 0.4766355140186916, IMAGE_WIDTH * 0.4766355140186916, IMAGE_HEIGHT * 0.45794392523364486, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.45794392523364486); KNOB.curveTo(IMAGE_WIDTH * 0.5233644859813084, IMAGE_HEIGHT * 0.45794392523364486, IMAGE_WIDTH * 0.5420560747663551, IMAGE_HEIGHT * 0.4766355140186916, IMAGE_WIDTH * 0.5420560747663551, IMAGE_HEIGHT * 0.5); KNOB.curveTo(IMAGE_WIDTH * 0.5420560747663551, IMAGE_HEIGHT * 0.5233644859813084, IMAGE_WIDTH * 0.5233644859813084, IMAGE_HEIGHT * 0.5420560747663551, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.5420560747663551); KNOB.curveTo(IMAGE_WIDTH * 0.4766355140186916, IMAGE_HEIGHT * 0.5420560747663551, IMAGE_WIDTH * 0.45794392523364486, IMAGE_HEIGHT * 0.5233644859813084, IMAGE_WIDTH * 0.45794392523364486, IMAGE_HEIGHT * 0.5); KNOB.closePath(); final Point2D KNOB_START = new Point2D.Double(0, KNOB.getBounds2D().getMinY()); final Point2D KNOB_STOP = new Point2D.Double(0, KNOB.getBounds2D().getMaxY()); final float[] KNOB_FRACTIONS = { 0.0f, 1.0f }; final Color[] KNOB_COLORS = { new Color(238, 240, 242, 255), new Color(101, 105, 109, 255) }; final LinearGradientPaint KNOB_GRADIENT = new LinearGradientPaint(KNOB_START, KNOB_STOP, KNOB_FRACTIONS, KNOB_COLORS); G2.setPaint(KNOB_GRADIENT); G2.fill(KNOB); G2.dispose(); return IMAGE; }
Example 12
Source File: Clock.java From mars-sim with GNU General Public License v3.0 | 4 votes |
private BufferedImage create_SECOND_SHADOW_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); switch (getPointerType()) { case TYPE2: final Rectangle2D TOP = new Rectangle2D.Double(IMAGE_WIDTH * 0.4953271028, IMAGE_WIDTH * 0.0981308411, IMAGE_WIDTH * 0.0093457944, IMAGE_WIDTH * 0.1261682243); final Rectangle2D BOTTOM = new Rectangle2D.Double(IMAGE_WIDTH * 0.4906542056, IMAGE_WIDTH * 0.308411215, IMAGE_WIDTH * 0.0186915888, IMAGE_WIDTH * 0.191588785); final java.awt.geom.Area SECOND = new java.awt.geom.Area(TOP); SECOND.add(new java.awt.geom.Area(new Ellipse2D.Double(IMAGE_WIDTH * 0.453271028, IMAGE_WIDTH * 0.2196261682, IMAGE_WIDTH * 0.0934579439, IMAGE_WIDTH * 0.0934579439))); SECOND.subtract(new java.awt.geom.Area(new Ellipse2D.Double(IMAGE_WIDTH * 0.4672897196, IMAGE_WIDTH * 0.2336448598, IMAGE_WIDTH * 0.0654205607, IMAGE_WIDTH * 0.0654205607))); SECOND.add(new java.awt.geom.Area(BOTTOM)); final GeneralPath SECOND_POINTER = new GeneralPath(SECOND); ; G2.setPaint(SHADOW_COLOR); G2.fill(SECOND_POINTER); break; case TYPE1: default: final GeneralPath SECONDPOINTER = new GeneralPath(); SECONDPOINTER.setWindingRule(Path2D.WIND_EVEN_ODD); SECONDPOINTER.moveTo(IMAGE_WIDTH * 0.5093457943925234, IMAGE_HEIGHT * 0.11682242990654206); SECONDPOINTER.lineTo(IMAGE_WIDTH * 0.5093457943925234, IMAGE_HEIGHT * 0.5747663551401869); SECONDPOINTER.lineTo(IMAGE_WIDTH * 0.49065420560747663, IMAGE_HEIGHT * 0.5747663551401869); SECONDPOINTER.lineTo(IMAGE_WIDTH * 0.49065420560747663, IMAGE_HEIGHT * 0.11682242990654206); SECONDPOINTER.lineTo(IMAGE_WIDTH * 0.5093457943925234, IMAGE_HEIGHT * 0.11682242990654206); SECONDPOINTER.closePath(); G2.setPaint(SHADOW_COLOR); G2.fill(SECONDPOINTER); break; } G2.dispose(); return IMAGE; }
Example 13
Source File: SparkLine.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Returns a buffered image that contains the hi value indicator * @param WIDTH * @return a buffered image that contains the hi value indicator */ private BufferedImage create_HI_INDICATOR_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } // Define the size of the indicator int indicatorSize = (int) (0.015 * WIDTH); if (indicatorSize < 4) { indicatorSize = 4; } if (indicatorSize > 8) { indicatorSize = 8; } final BufferedImage IMAGE = UTIL.createImage(indicatorSize, indicatorSize, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath THRESHOLD_TRIANGLE = new GeneralPath(); THRESHOLD_TRIANGLE.setWindingRule(Path2D.WIND_EVEN_ODD); THRESHOLD_TRIANGLE.moveTo(IMAGE_WIDTH * 0.5, 0); THRESHOLD_TRIANGLE.lineTo(0, IMAGE_HEIGHT); THRESHOLD_TRIANGLE.lineTo(IMAGE_WIDTH, IMAGE_HEIGHT); THRESHOLD_TRIANGLE.lineTo(IMAGE_WIDTH * 0.5, 0); THRESHOLD_TRIANGLE.closePath(); final Point2D THRESHOLD_TRIANGLE_START = new Point2D.Double(0, THRESHOLD_TRIANGLE.getBounds2D().getMinY()); final Point2D THRESHOLD_TRIANGLE_STOP = new Point2D.Double(0, THRESHOLD_TRIANGLE.getBounds2D().getMaxY()); final float[] THRESHOLD_TRIANGLE_FRACTIONS = { 0.0f, 0.3f, 0.59f, 1.0f }; final Color[] THRESHOLD_TRIANGLE_COLORS = { new Color(82, 0, 0, 255), new Color(252, 29, 0, 255), new Color(252, 29, 0, 255), new Color(82, 0, 0, 255) }; final LinearGradientPaint THRESHOLD_TRIANGLE_GRADIENT = new LinearGradientPaint(THRESHOLD_TRIANGLE_START, THRESHOLD_TRIANGLE_STOP, THRESHOLD_TRIANGLE_FRACTIONS, THRESHOLD_TRIANGLE_COLORS); G2.setPaint(THRESHOLD_TRIANGLE_GRADIENT); G2.fill(THRESHOLD_TRIANGLE); G2.setColor(Color.RED); G2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); G2.draw(THRESHOLD_TRIANGLE); G2.dispose(); return IMAGE; }
Example 14
Source File: AbstractLinear.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Returns the image of the threshold indicator * @param WIDTH * @param HEIGHT * @return a buffered image of the threshold indicator */ protected BufferedImage create_THRESHOLD_Image(final int WIDTH, final int HEIGHT) { if (WIDTH <= 14 || HEIGHT <= 14) // 14 is needed otherwise the image size could be smaller than 1 { return UTIL.createImage(1, 1, Transparency.TRANSLUCENT); } final int IMAGE_WIDTH; final int IMAGE_HEIGHT; if (getOrientation() == Orientation.VERTICAL) { // Vertical orientation IMAGE_WIDTH = (int) (WIDTH * 0.0714285714); IMAGE_HEIGHT = (int) (IMAGE_WIDTH * 0.8); } else { // Horizontal orientation IMAGE_HEIGHT = (int) (HEIGHT * 0.0714285714); IMAGE_WIDTH = (int) (IMAGE_HEIGHT * 0.8); } final BufferedImage IMAGE = UTIL.createImage(IMAGE_WIDTH, IMAGE_HEIGHT, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.translate(0, IMAGE_WIDTH * 0.005); final GeneralPath THRESHOLD = new GeneralPath(); THRESHOLD.setWindingRule(Path2D.WIND_EVEN_ODD); final Point2D THRESHOLD_START; final Point2D THRESHOLD_STOP; if (getOrientation() == Orientation.VERTICAL) { // Vertical orientation THRESHOLD.moveTo(IMAGE_WIDTH * 0.1, IMAGE_HEIGHT * 0.5); THRESHOLD.lineTo(IMAGE_WIDTH * 0.9, IMAGE_HEIGHT * 0.1); THRESHOLD.lineTo(IMAGE_WIDTH * 0.9, IMAGE_HEIGHT * 0.9); THRESHOLD.lineTo(IMAGE_WIDTH * 0.1, IMAGE_HEIGHT * 0.5); THRESHOLD.closePath(); THRESHOLD_START = new Point2D.Double(THRESHOLD.getBounds2D().getMinX(), 0); THRESHOLD_STOP = new Point2D.Double(THRESHOLD.getBounds2D().getMaxX(), 0); } else { // Horizontal orientation THRESHOLD.moveTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.9); THRESHOLD.lineTo(IMAGE_WIDTH * 1.0, IMAGE_HEIGHT * 0.1); THRESHOLD.lineTo(IMAGE_WIDTH * 0.1, IMAGE_HEIGHT * 0.1); THRESHOLD.lineTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.9); THRESHOLD.closePath(); THRESHOLD_START = new Point2D.Double(0, THRESHOLD.getBounds2D().getMaxY()); THRESHOLD_STOP = new Point2D.Double(0, THRESHOLD.getBounds2D().getMinY()); } final float[] THRESHOLD_FRACTIONS = { 0.0f, 0.3f, 0.59f, 1.0f }; final Color[] THRESHOLD_COLORS = { getThresholdColor().DARK, getThresholdColor().MEDIUM, getThresholdColor().MEDIUM, getThresholdColor().DARK }; final LinearGradientPaint THRESHOLD_GRADIENT = new LinearGradientPaint(THRESHOLD_START, THRESHOLD_STOP, THRESHOLD_FRACTIONS, THRESHOLD_COLORS); G2.setPaint(THRESHOLD_GRADIENT); G2.fill(THRESHOLD); G2.setColor(Color.WHITE); G2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); G2.draw(THRESHOLD); G2.dispose(); return IMAGE; }
Example 15
Source File: LightBulb.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public BufferedImage createOnImage(final int WIDTH, final int HEIGHT, final Color GLOW_COLOR) { final GraphicsConfiguration GFX_CONF = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); if (WIDTH <= 0 || HEIGHT <= 0) { return GFX_CONF.createCompatibleImage(1, 1, java.awt.Transparency.TRANSLUCENT); } final BufferedImage IMAGE = GFX_CONF.createCompatibleImage(WIDTH, HEIGHT, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath GLOW = new GeneralPath(); GLOW.setWindingRule(Path2D.WIND_EVEN_ODD); GLOW.moveTo(0.05263157894736842 * IMAGE_WIDTH, 0.43859649122807015 * IMAGE_HEIGHT); GLOW.curveTo(0.05263157894736842 * IMAGE_WIDTH, 0.19298245614035087 * IMAGE_HEIGHT, 0.24561403508771928 * IMAGE_WIDTH, 0.0, 0.49122807017543857 * IMAGE_WIDTH, 0.0); GLOW.curveTo(0.7368421052631579 * IMAGE_WIDTH, 0.0, 0.9298245614035088 * IMAGE_WIDTH, 0.19298245614035087 * IMAGE_HEIGHT, 0.9298245614035088 * IMAGE_WIDTH, 0.43859649122807015 * IMAGE_HEIGHT); GLOW.curveTo(0.9298245614035088 * IMAGE_WIDTH, 0.6842105263157895 * IMAGE_HEIGHT, 0.7368421052631579 * IMAGE_WIDTH, 0.8771929824561403 * IMAGE_HEIGHT, 0.49122807017543857 * IMAGE_WIDTH, 0.8771929824561403 * IMAGE_HEIGHT); GLOW.curveTo(0.24561403508771928 * IMAGE_WIDTH, 0.8771929824561403 * IMAGE_HEIGHT, 0.05263157894736842 * IMAGE_WIDTH, 0.6842105263157895 * IMAGE_HEIGHT, 0.05263157894736842 * IMAGE_WIDTH, 0.43859649122807015 * IMAGE_HEIGHT); GLOW.closePath(); final float[] GLOW_FRACTIONS = { 0.0f, 0.08f, 0.09f, 0.24f, 0.25f, 0.51f, 0.88f, 1.0f }; final float GLOW_RED = GLOW_COLOR.getRed() * 1f / 255f; final float GLOW_GREEN = GLOW_COLOR.getGreen() * 1f / 255f; final float GLOW_BLUE = GLOW_COLOR.getBlue() * 1f / 255f; final Color[] GLOW_COLORS = { new Color(GLOW_RED, GLOW_GREEN, GLOW_BLUE, 1.0f), new Color(GLOW_RED, GLOW_GREEN, GLOW_BLUE, 0.95f), new Color(GLOW_RED, GLOW_GREEN, GLOW_BLUE, 0.9f), new Color(GLOW_RED, GLOW_GREEN, GLOW_BLUE, 0.7f), new Color(GLOW_RED, GLOW_GREEN, GLOW_BLUE, 0.55f), new Color(GLOW_RED, GLOW_GREEN, GLOW_BLUE, 0.25f), new Color(GLOW_RED, GLOW_GREEN, GLOW_BLUE, 0.1f), new Color(GLOW_RED, GLOW_GREEN, GLOW_BLUE, 0f) }; G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.4824561403508772 * IMAGE_WIDTH, 0.43859649122807015 * IMAGE_HEIGHT), (0.44298245614035087f * IMAGE_WIDTH), GLOW_FRACTIONS, GLOW_COLORS)); //G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.4824561403508772 * IMAGE_WIDTH, 0.43859649122807015 * IMAGE_HEIGHT), (0.44298245614035087f * IMAGE_WIDTH), new float[]{0.0f, 1.0f}, new Color[]{new Color(glowColor.getRed(), glowColor.getGreen(), glowColor.getBlue(), 255), new Color(glowColor.getRed(), glowColor.getGreen(), glowColor.getBlue(), 0)})); G2.fill(GLOW); final GeneralPath GLAS = new GeneralPath(); GLAS.setWindingRule(Path2D.WIND_EVEN_ODD); GLAS.moveTo(0.2894736842105263 * IMAGE_WIDTH, 0.43859649122807015 * IMAGE_HEIGHT); GLAS.curveTo(0.2894736842105263 * IMAGE_WIDTH, 0.5614035087719298 * IMAGE_HEIGHT, 0.38596491228070173 * IMAGE_WIDTH, 0.6052631578947368 * IMAGE_HEIGHT, 0.38596491228070173 * IMAGE_WIDTH, 0.7456140350877193 * IMAGE_HEIGHT); GLAS.curveTo(0.38596491228070173 * IMAGE_WIDTH, 0.7456140350877193 * IMAGE_HEIGHT, 0.5877192982456141 * IMAGE_WIDTH, 0.7456140350877193 * IMAGE_HEIGHT, 0.5877192982456141 * IMAGE_WIDTH, 0.7456140350877193 * IMAGE_HEIGHT); GLAS.curveTo(0.5877192982456141 * IMAGE_WIDTH, 0.6052631578947368 * IMAGE_HEIGHT, 0.6929824561403509 * IMAGE_WIDTH, 0.5614035087719298 * IMAGE_HEIGHT, 0.6929824561403509 * IMAGE_WIDTH, 0.43859649122807015 * IMAGE_HEIGHT); GLAS.curveTo(0.6929824561403509 * IMAGE_WIDTH, 0.32456140350877194 * IMAGE_HEIGHT, 0.6052631578947368 * IMAGE_WIDTH, 0.22807017543859648 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.22807017543859648 * IMAGE_HEIGHT); GLAS.curveTo(0.38596491228070173 * IMAGE_WIDTH, 0.22807017543859648 * IMAGE_HEIGHT, 0.2894736842105263 * IMAGE_WIDTH, 0.32456140350877194 * IMAGE_HEIGHT, 0.2894736842105263 * IMAGE_WIDTH, 0.43859649122807015 * IMAGE_HEIGHT); GLAS.closePath(); final float[] HSB = Color.RGBtoHSB(GLOW_COLOR.getRed(), GLOW_COLOR.getGreen(), GLOW_COLOR.getBlue(), null); final Color[] GLASS_GLOW_COLORS; if (glowColor.getRed() == glowColor.getGreen() && glowColor.getGreen() == glowColor.getBlue()) { GLASS_GLOW_COLORS = new Color[]{ new Color(Color.HSBtoRGB(0.0f, 0.0f, 0.6f)), new Color(Color.HSBtoRGB(0.0f, 0.0f, 0.4f)) }; } else { GLASS_GLOW_COLORS = new Color[]{ new Color(Color.HSBtoRGB(HSB[0], 0.6f, HSB[2])), new Color(Color.HSBtoRGB(HSB[0], 0.4f, HSB[2])) }; } final LinearGradientPaint GLAS_PAINT = new LinearGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.2894736842105263 * IMAGE_HEIGHT), new Point2D.Double(0.5 * IMAGE_WIDTH, 0.7017543859649122 * IMAGE_HEIGHT), new float[]{0.0f, 1.0f}, GLASS_GLOW_COLORS); G2.setPaint(GLAS_PAINT); G2.fill(GLAS); G2.setPaint(GLOW_COLOR); G2.setStroke(new BasicStroke((0.010101010101010102f * IMAGE_WIDTH), 0, 1)); G2.draw(GLAS); G2.dispose(); return IMAGE; }
Example 16
Source File: TrafficLight2.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public BufferedImage create2LightsRedImage(final int WIDTH, final int HEIGHT, final boolean IS_ON) { final GraphicsConfiguration GFX_CONF = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); if (WIDTH <= 0 || HEIGHT <= 0) { return GFX_CONF.createCompatibleImage(1, 1, java.awt.Transparency.TRANSLUCENT); } final BufferedImage IMAGE = GFX_CONF.createCompatibleImage(WIDTH, HEIGHT, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); if (!IS_ON) { final Ellipse2D RED_OFF = new Ellipse2D.Double(0.1875 * IMAGE_WIDTH, 0.11428571428571428 * IMAGE_HEIGHT, 0.625 * IMAGE_WIDTH, 0.35714285714285715 * IMAGE_HEIGHT); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.40714285714285714 * IMAGE_HEIGHT), (0.59375f * IMAGE_WIDTH), new float[]{0.0f, 0.98f, 0.99f, 1.0f}, new Color[]{new Color(0.3019607843f, 0f, 0f, 1f), new Color(0.0039215686f, 0f, 0f, 1f), new Color(0f, 0f, 0f, 1f), new Color(0f, 0f, 0f, 1f)})); G2.fill(RED_OFF); final Ellipse2D RED_HIGHLIGHT_OFF = new Ellipse2D.Double(0.2625 * IMAGE_WIDTH, 0.12142857142857143 * IMAGE_HEIGHT, 0.4625 * IMAGE_WIDTH, 0.14285714285714285 * IMAGE_HEIGHT); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.15 * IMAGE_HEIGHT), (0.2125f * IMAGE_WIDTH), new float[]{0.0f, 0.98f, 1.0f}, new Color[]{new Color(1f, 1f, 1f, 0.2235294118f), new Color(1f, 1f, 1f, 0.0274509804f), new Color(1f, 1f, 1f, 0.0274509804f)})); G2.fill(RED_HIGHLIGHT_OFF); } else { final Ellipse2D RED_GLOW = new Ellipse2D.Double(0.0 * IMAGE_WIDTH, 0.0 * IMAGE_HEIGHT, 1.0 * IMAGE_WIDTH, 0.5714285714285714 * IMAGE_HEIGHT); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.2857142857142857 * IMAGE_HEIGHT), (0.5f * IMAGE_WIDTH), new float[]{0.0f, 0.98f, 0.99f, 1.0f}, new Color[]{new Color(1f, 0f, 0f, 1f), new Color(1f, 0f, 0f, 0f), new Color(1f, 0f, 0f, 0f), new Color(1f, 0f, 0f, 0f)})); G2.fill(RED_GLOW); final Ellipse2D RED_ON = new Ellipse2D.Double(0.1875 * IMAGE_WIDTH, 0.11428571428571428 * IMAGE_HEIGHT, 0.625 * IMAGE_WIDTH, 0.35714285714285715 * IMAGE_HEIGHT); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.40714285714285714 * IMAGE_HEIGHT), (0.59375f * IMAGE_WIDTH), new float[]{0.0f, 0.98f, 0.99f, 1.0f}, new Color[]{new Color(1f, 0f, 0f, 1f), new Color(0.2549019608f, 0f, 0f, 1f), new Color(0.2470588235f, 0f, 0f, 1f), new Color(0.2470588235f, 0f, 0f, 1f)})); G2.fill(RED_ON); final GeneralPath RED_HIGHLIGHT_ON = new GeneralPath(); RED_HIGHLIGHT_ON.setWindingRule(Path2D.WIND_EVEN_ODD); RED_HIGHLIGHT_ON.moveTo(0.2625 * IMAGE_WIDTH, 0.18571428571428572 * IMAGE_HEIGHT); RED_HIGHLIGHT_ON.curveTo(0.2625 * IMAGE_WIDTH, 0.17142857142857143 * IMAGE_HEIGHT, 0.375 * IMAGE_WIDTH, 0.12142857142857143 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.12142857142857143 * IMAGE_HEIGHT); RED_HIGHLIGHT_ON.curveTo(0.625 * IMAGE_WIDTH, 0.12142857142857143 * IMAGE_HEIGHT, 0.725 * IMAGE_WIDTH, 0.16428571428571428 * IMAGE_HEIGHT, 0.725 * IMAGE_WIDTH, 0.18571428571428572 * IMAGE_HEIGHT); RED_HIGHLIGHT_ON.curveTo(0.725 * IMAGE_WIDTH, 0.22857142857142856 * IMAGE_HEIGHT, 0.625 * IMAGE_WIDTH, 0.2642857142857143 * IMAGE_HEIGHT, 0.5 * IMAGE_WIDTH, 0.2642857142857143 * IMAGE_HEIGHT); RED_HIGHLIGHT_ON.curveTo(0.375 * IMAGE_WIDTH, 0.2642857142857143 * IMAGE_HEIGHT, 0.2625 * IMAGE_WIDTH, 0.2357142857142857 * IMAGE_HEIGHT, 0.2625 * IMAGE_WIDTH, 0.18571428571428572 * IMAGE_HEIGHT); RED_HIGHLIGHT_ON.closePath(); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.15 * IMAGE_HEIGHT), (0.2125f * IMAGE_WIDTH), new float[]{0.0f, 0.98f, 1.0f}, new Color[]{new Color(1f, 1f, 1f, 0.6745098039f), new Color(1f, 1f, 1f, 0.0862745098f), new Color(1f, 1f, 1f, 0.0862745098f)})); G2.fill(RED_HIGHLIGHT_ON); } final Ellipse2D RED_INNER_SHADOW = new Ellipse2D.Double(0.1875 * IMAGE_WIDTH, 0.11428571428571428 * IMAGE_HEIGHT, 0.625 * IMAGE_WIDTH, 0.35714285714285715 * IMAGE_HEIGHT); G2.setPaint(new RadialGradientPaint(new Point2D.Double(0.5 * IMAGE_WIDTH, 0.29285714285714287 * IMAGE_HEIGHT), (0.3125f * IMAGE_WIDTH), new float[]{0.0f, 0.55f, 0.5501f, 0.78f, 0.79f, 1.0f}, new Color[]{new Color(0.0039215686f, 0.0039215686f, 0.0039215686f, 0f), new Color(0f, 0f, 0f, 0f), new Color(0f, 0f, 0f, 0f), new Color(0f, 0f, 0f, 0.1215686275f), new Color(0f, 0f, 0f, 0.1294117647f), new Color(0f, 0f, 0f, 0.4980392157f)})); G2.fill(RED_INNER_SHADOW); G2.dispose(); return IMAGE; }
Example 17
Source File: DigitalRadial.java From mars-sim with GNU General Public License v3.0 | 4 votes |
private BufferedImage create_10000FT_POINTER_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, (int) (1.0 * WIDTH), Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); //G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); //G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); //G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath POINTER10000FT = new GeneralPath(); POINTER10000FT.setWindingRule(Path2D.WIND_EVEN_ODD); POINTER10000FT.moveTo(IMAGE_WIDTH * 0.5186915887850467, IMAGE_HEIGHT * 0.4719626168224299); POINTER10000FT.curveTo(IMAGE_WIDTH * 0.514018691588785, IMAGE_HEIGHT * 0.4719626168224299, IMAGE_WIDTH * 0.514018691588785, IMAGE_HEIGHT * 0.4672897196261682, IMAGE_WIDTH * 0.514018691588785, IMAGE_HEIGHT * 0.4672897196261682); POINTER10000FT.lineTo(IMAGE_WIDTH * 0.514018691588785, IMAGE_HEIGHT * 0.3177570093457944); POINTER10000FT.lineTo(IMAGE_WIDTH * 0.5046728971962616, IMAGE_HEIGHT * 0.3037383177570093); POINTER10000FT.lineTo(IMAGE_WIDTH * 0.5046728971962616, IMAGE_HEIGHT * 0.1822429906542056); POINTER10000FT.lineTo(IMAGE_WIDTH * 0.5327102803738317, IMAGE_HEIGHT * 0.11682242990654206); POINTER10000FT.lineTo(IMAGE_WIDTH * 0.46261682242990654, IMAGE_HEIGHT * 0.11682242990654206); POINTER10000FT.lineTo(IMAGE_WIDTH * 0.4953271028037383, IMAGE_HEIGHT * 0.1822429906542056); POINTER10000FT.lineTo(IMAGE_WIDTH * 0.4953271028037383, IMAGE_HEIGHT * 0.29906542056074764); POINTER10000FT.lineTo(IMAGE_WIDTH * 0.48598130841121495, IMAGE_HEIGHT * 0.3177570093457944); POINTER10000FT.lineTo(IMAGE_WIDTH * 0.48598130841121495, IMAGE_HEIGHT * 0.4672897196261682); POINTER10000FT.curveTo(IMAGE_WIDTH * 0.48598130841121495, IMAGE_HEIGHT * 0.4672897196261682, IMAGE_WIDTH * 0.48598130841121495, IMAGE_HEIGHT * 0.4719626168224299, IMAGE_WIDTH * 0.48130841121495327, IMAGE_HEIGHT * 0.4719626168224299); POINTER10000FT.curveTo(IMAGE_WIDTH * 0.4719626168224299, IMAGE_HEIGHT * 0.48130841121495327, IMAGE_WIDTH * 0.4672897196261682, IMAGE_HEIGHT * 0.49065420560747663, IMAGE_WIDTH * 0.4672897196261682, IMAGE_HEIGHT * 0.5); POINTER10000FT.curveTo(IMAGE_WIDTH * 0.4672897196261682, IMAGE_HEIGHT * 0.5186915887850467, IMAGE_WIDTH * 0.48130841121495327, IMAGE_HEIGHT * 0.5327102803738317, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.5327102803738317); POINTER10000FT.curveTo(IMAGE_WIDTH * 0.5186915887850467, IMAGE_HEIGHT * 0.5327102803738317, IMAGE_WIDTH * 0.5327102803738317, IMAGE_HEIGHT * 0.5186915887850467, IMAGE_WIDTH * 0.5327102803738317, IMAGE_HEIGHT * 0.5); POINTER10000FT.curveTo(IMAGE_WIDTH * 0.5327102803738317, IMAGE_HEIGHT * 0.49065420560747663, IMAGE_WIDTH * 0.5280373831775701, IMAGE_HEIGHT * 0.48130841121495327, IMAGE_WIDTH * 0.5186915887850467, IMAGE_HEIGHT * 0.4719626168224299); POINTER10000FT.closePath(); G2.setColor(Color.WHITE); G2.fill(POINTER10000FT); G2.dispose(); return IMAGE; }
Example 18
Source File: DigitalRadial.java From mars-sim with GNU General Public License v3.0 | 4 votes |
private BufferedImage create_1000FT_POINTER_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, (int) (1.0 * WIDTH), Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); //G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); //G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); //G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath POINTER1000FT = new GeneralPath(); POINTER1000FT.setWindingRule(Path2D.WIND_EVEN_ODD); POINTER1000FT.moveTo(IMAGE_WIDTH * 0.5186915887850467, IMAGE_HEIGHT * 0.4719626168224299); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.514018691588785, IMAGE_HEIGHT * 0.46261682242990654, IMAGE_WIDTH * 0.5280373831775701, IMAGE_HEIGHT * 0.40186915887850466, IMAGE_WIDTH * 0.5280373831775701, IMAGE_HEIGHT * 0.40186915887850466); POINTER1000FT.lineTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.3317757009345794); POINTER1000FT.lineTo(IMAGE_WIDTH * 0.4719626168224299, IMAGE_HEIGHT * 0.40186915887850466); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.4719626168224299, IMAGE_HEIGHT * 0.40186915887850466, IMAGE_WIDTH * 0.48598130841121495, IMAGE_HEIGHT * 0.46261682242990654, IMAGE_WIDTH * 0.48130841121495327, IMAGE_HEIGHT * 0.4719626168224299); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.4719626168224299, IMAGE_HEIGHT * 0.48130841121495327, IMAGE_WIDTH * 0.4672897196261682, IMAGE_HEIGHT * 0.49065420560747663, IMAGE_WIDTH * 0.4672897196261682, IMAGE_HEIGHT * 0.5); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.4672897196261682, IMAGE_HEIGHT * 0.514018691588785, IMAGE_WIDTH * 0.4766355140186916, IMAGE_HEIGHT * 0.5280373831775701, IMAGE_WIDTH * 0.49065420560747663, IMAGE_HEIGHT * 0.5327102803738317); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.49065420560747663, IMAGE_HEIGHT * 0.5327102803738317, IMAGE_WIDTH * 0.46261682242990654, IMAGE_HEIGHT * 0.5747663551401869, IMAGE_WIDTH * 0.46261682242990654, IMAGE_HEIGHT * 0.5934579439252337); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.4672897196261682, IMAGE_HEIGHT * 0.616822429906542, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.6121495327102804, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.6121495327102804); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.6121495327102804, IMAGE_WIDTH * 0.5327102803738317, IMAGE_HEIGHT * 0.616822429906542, IMAGE_WIDTH * 0.5373831775700935, IMAGE_HEIGHT * 0.5934579439252337); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.5373831775700935, IMAGE_HEIGHT * 0.5747663551401869, IMAGE_WIDTH * 0.5093457943925234, IMAGE_HEIGHT * 0.5327102803738317, IMAGE_WIDTH * 0.5093457943925234, IMAGE_HEIGHT * 0.5327102803738317); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.5233644859813084, IMAGE_HEIGHT * 0.5280373831775701, IMAGE_WIDTH * 0.5327102803738317, IMAGE_HEIGHT * 0.514018691588785, IMAGE_WIDTH * 0.5327102803738317, IMAGE_HEIGHT * 0.5); POINTER1000FT.curveTo(IMAGE_WIDTH * 0.5327102803738317, IMAGE_HEIGHT * 0.49065420560747663, IMAGE_WIDTH * 0.5280373831775701, IMAGE_HEIGHT * 0.48130841121495327, IMAGE_WIDTH * 0.5186915887850467, IMAGE_HEIGHT * 0.4719626168224299); POINTER1000FT.closePath(); final Point2D POINTER1000FT_START = new Point2D.Double(0, POINTER1000FT.getBounds2D().getMinY()); final Point2D POINTER1000FT_STOP = new Point2D.Double(0, POINTER1000FT.getBounds2D().getMaxY()); final float[] POINTER1000FT_FRACTIONS = { 0.0f, 0.51f, 0.52f, 0.5201f, 0.53f, 1.0f }; final Color[] POINTER1000FT_COLORS = { new Color(255, 255, 255, 255), new Color(255, 255, 255, 255), new Color(255, 255, 255, 255), new Color(32, 32, 32, 255), new Color(32, 32, 32, 255), new Color(32, 32, 32, 255) }; final LinearGradientPaint POINTER1000FT_GRADIENT = new LinearGradientPaint(POINTER1000FT_START, POINTER1000FT_STOP, POINTER1000FT_FRACTIONS, POINTER1000FT_COLORS); G2.setPaint(POINTER1000FT_GRADIENT); G2.fill(POINTER1000FT); G2.dispose(); return IMAGE; }
Example 19
Source File: Radial1Vertical.java From mars-sim with GNU General Public License v3.0 | 4 votes |
@Override protected BufferedImage create_THRESHOLD_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); //G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); //G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath THRESHOLD = new GeneralPath(); THRESHOLD.setWindingRule(Path2D.WIND_EVEN_ODD); THRESHOLD.moveTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.3333333333333333); THRESHOLD.lineTo(IMAGE_WIDTH * 0.4866666666666667, IMAGE_HEIGHT * 0.37333333333333335); THRESHOLD.lineTo(IMAGE_WIDTH * 0.52, IMAGE_HEIGHT * 0.37333333333333335); THRESHOLD.lineTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.3333333333333333); THRESHOLD.closePath(); final Point2D THRESHOLD_START = new Point2D.Double(0, THRESHOLD.getBounds2D().getMinY()); final Point2D THRESHOLD_STOP = new Point2D.Double(0, THRESHOLD.getBounds2D().getMaxY()); final float[] THRESHOLD_FRACTIONS = { 0.0f, 0.3f, 0.59f, 1.0f }; final Color[] THRESHOLD_COLORS = { new Color(82, 0, 0, 255), new Color(252, 29, 0, 255), new Color(252, 29, 0, 255), new Color(82, 0, 0, 255) }; final LinearGradientPaint THRESHOLD_GRADIENT = new LinearGradientPaint(THRESHOLD_START, THRESHOLD_STOP, THRESHOLD_FRACTIONS, THRESHOLD_COLORS); G2.setPaint(THRESHOLD_GRADIENT); G2.fill(THRESHOLD); G2.setColor(Color.WHITE); G2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); G2.draw(THRESHOLD); G2.dispose(); return IMAGE; }
Example 20
Source File: Level.java From mars-sim with GNU General Public License v3.0 | 4 votes |
@Override protected BufferedImage create_POINTER_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE); //G2.setRenderingHint(java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION, java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); //G2.setRenderingHint(java.awt.RenderingHints.KEY_COLOR_RENDERING, java.awt.RenderingHints.VALUE_COLOR_RENDER_QUALITY); G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); //G2.setRenderingHint(java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); final GeneralPath POINTERREDSMALL = new GeneralPath(); POINTERREDSMALL.setWindingRule(Path2D.WIND_EVEN_ODD); POINTERREDSMALL.moveTo(IMAGE_WIDTH * 0.5233644859813084, IMAGE_HEIGHT * 0.35046728971962615); POINTERREDSMALL.lineTo(IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.1308411214953271); POINTERREDSMALL.lineTo(IMAGE_WIDTH * 0.4766355140186916, IMAGE_HEIGHT * 0.35046728971962615); POINTERREDSMALL.curveTo(IMAGE_WIDTH * 0.4766355140186916, IMAGE_HEIGHT * 0.35046728971962615, IMAGE_WIDTH * 0.49065420560747663, IMAGE_HEIGHT * 0.34579439252336447, IMAGE_WIDTH * 0.5, IMAGE_HEIGHT * 0.34579439252336447); POINTERREDSMALL.curveTo(IMAGE_WIDTH * 0.5093457943925234, IMAGE_HEIGHT * 0.34579439252336447, IMAGE_WIDTH * 0.5233644859813084, IMAGE_HEIGHT * 0.35046728971962615, IMAGE_WIDTH * 0.5233644859813084, IMAGE_HEIGHT * 0.35046728971962615); POINTERREDSMALL.closePath(); final Point2D POINTERREDSMALL_START = new Point2D.Double(0, POINTERREDSMALL.getBounds2D().getMinY()); final Point2D POINTERREDSMALL_STOP = new Point2D.Double(0, POINTERREDSMALL.getBounds2D().getMaxY()); final float[] POINTERREDSMALL_FRACTIONS = { 0.0f, 0.3f, 0.59f, 1.0f }; final Color[] POINTERREDSMALL_COLORS = { UTIL.setAlpha(getPointerColor().DARK, 180), UTIL.setAlpha(getPointerColor().LIGHT, 180), UTIL.setAlpha(getPointerColor().LIGHT, 180), UTIL.setAlpha(getPointerColor().DARK, 180) }; final java.awt.LinearGradientPaint POINTERREDSMALL_GRADIENT = new java.awt.LinearGradientPaint(POINTERREDSMALL_START, POINTERREDSMALL_STOP, POINTERREDSMALL_FRACTIONS, POINTERREDSMALL_COLORS); G2.setPaint(POINTERREDSMALL_GRADIENT); G2.fill(POINTERREDSMALL); final Color STROKE_COLOR_POINTERREDSMALL = getPointerColor().LIGHT; G2.setColor(STROKE_COLOR_POINTERREDSMALL); G2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); G2.draw(POINTERREDSMALL); final GeneralPath FRAMELEFT = new GeneralPath(); FRAMELEFT.setWindingRule(Path2D.WIND_EVEN_ODD); FRAMELEFT.moveTo(IMAGE_WIDTH * 0.20093457943925233, IMAGE_HEIGHT * 0.43457943925233644); FRAMELEFT.lineTo(IMAGE_WIDTH * 0.16355140186915887, IMAGE_HEIGHT * 0.43457943925233644); FRAMELEFT.lineTo(IMAGE_WIDTH * 0.16355140186915887, IMAGE_HEIGHT * 0.5607476635514018); FRAMELEFT.lineTo(IMAGE_WIDTH * 0.20093457943925233, IMAGE_HEIGHT * 0.5607476635514018); G2.setColor(super.getBackgroundColor().LABEL_COLOR); G2.draw(FRAMELEFT); final GeneralPath TRIANGLELEFT = new GeneralPath(); TRIANGLELEFT.setWindingRule(Path2D.WIND_EVEN_ODD); TRIANGLELEFT.moveTo(IMAGE_WIDTH * 0.16355140186915887, IMAGE_HEIGHT * 0.4719626168224299); TRIANGLELEFT.lineTo(IMAGE_WIDTH * 0.205607476635514, IMAGE_HEIGHT * 0.5); TRIANGLELEFT.lineTo(IMAGE_WIDTH * 0.16355140186915887, IMAGE_HEIGHT * 0.5233644859813084); TRIANGLELEFT.lineTo(IMAGE_WIDTH * 0.16355140186915887, IMAGE_HEIGHT * 0.4719626168224299); TRIANGLELEFT.closePath(); G2.setColor(super.getBackgroundColor().LABEL_COLOR); G2.fill(TRIANGLELEFT); final GeneralPath FRAMERIGHT = new GeneralPath(); FRAMERIGHT.setWindingRule(Path2D.WIND_EVEN_ODD); FRAMERIGHT.moveTo(IMAGE_WIDTH * 0.7990654205607477, IMAGE_HEIGHT * 0.43457943925233644); FRAMERIGHT.lineTo(IMAGE_WIDTH * 0.8364485981308412, IMAGE_HEIGHT * 0.43457943925233644); FRAMERIGHT.lineTo(IMAGE_WIDTH * 0.8364485981308412, IMAGE_HEIGHT * 0.5607476635514018); FRAMERIGHT.lineTo(IMAGE_WIDTH * 0.7990654205607477, IMAGE_HEIGHT * 0.5607476635514018); G2.setColor(super.getBackgroundColor().LABEL_COLOR); G2.draw(FRAMERIGHT); final GeneralPath TRIANGLERIGHT = new GeneralPath(); TRIANGLERIGHT.setWindingRule(Path2D.WIND_EVEN_ODD); TRIANGLERIGHT.moveTo(IMAGE_WIDTH * 0.8364485981308412, IMAGE_HEIGHT * 0.4719626168224299); TRIANGLERIGHT.lineTo(IMAGE_WIDTH * 0.794392523364486, IMAGE_HEIGHT * 0.5); TRIANGLERIGHT.lineTo(IMAGE_WIDTH * 0.8364485981308412, IMAGE_HEIGHT * 0.5233644859813084); TRIANGLERIGHT.lineTo(IMAGE_WIDTH * 0.8364485981308412, IMAGE_HEIGHT * 0.4719626168224299); TRIANGLERIGHT.closePath(); G2.setColor(super.getBackgroundColor().LABEL_COLOR); G2.fill(TRIANGLERIGHT); G2.dispose(); return IMAGE; }