Java Draw Arrow draw_nav2_backward_arrow(Graphics2D g2, int x, int y, int length, int base_width)

Here you can find the source of draw_nav2_backward_arrow(Graphics2D g2, int x, int y, int length, int base_width)

Description

dranabackwararrow

License

Open Source License

Declaration

public static void draw_nav2_backward_arrow(Graphics2D g2, int x,
            int y, int length, int base_width) 

Method Source Code

//package com.java2s;
/**/*from   w w w . j a  v a2s  .c om*/
 * RadioHeadingArrowsHelper.java
 * 
 * Renders the radio navigatio object pointers. Used by RadioHeadingArrows.
 * 
 * Copyright (C) 2007  Georg Gruetter (gruetter@gmail.com)
 * Copyright (C) 2009  Marc Rogiers (marrog.123@gmail.com)
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2 
 * of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;

public class Main {
    public static void draw_nav2_backward_arrow(Graphics2D g2, int x,
            int y, int length, int base_width) {
        GeneralPath polyline;
        int arrow_top_y = y - length + (base_width / 3);
        int arrow_bottom_y = arrow_top_y + length;

        polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 9);
        polyline.moveTo(x - (base_width / 2), arrow_bottom_y);
        polyline.lineTo(x - (base_width / 2), y);
        polyline.lineTo(x - (base_width / 4), y - (base_width / 4));
        polyline.lineTo(x - (base_width / 4), arrow_top_y
                + (base_width / 4));
        polyline.lineTo(x, arrow_top_y);
        polyline.lineTo(x + (base_width / 4), arrow_top_y
                + (base_width / 4));
        polyline.lineTo(x + (base_width / 4), y - (base_width / 4));
        polyline.lineTo(x + (base_width / 2), y);
        polyline.lineTo(x + (base_width / 2), arrow_bottom_y);
        polyline.lineTo(x, y);
        polyline.lineTo(x - (base_width / 2), arrow_bottom_y);
        g2.draw(polyline);
    }
}

Related

  1. draw_nav1_backward_arrow(Graphics2D g2, int x, int y, int length, int base_width)
  2. drawArrow(final Graphics2D g, final int x1, final int y1, final int x2, final int y2)
  3. drawArrow(Graphics g, double x0, double y0, double x1, double y1, double weight)
  4. drawArrow(Graphics g, int x0, int y0, int x1, int y1, int headLength, int headAngle)
  5. drawArrow(Graphics g, int x1, int y1, int x2, int y2, int lineWidth)