Java Graphics Draw drawDiamond(Graphics2D g2d, int xPos, int yPos)

Here you can find the source of drawDiamond(Graphics2D g2d, int xPos, int yPos)

Description

draw Diamond

License

Open Source License

Declaration

public static void drawDiamond(Graphics2D g2d, int xPos, int yPos) 

Method Source Code

//package com.java2s;
/*/*from  w  ww  . ja va  2 s.  co  m*/
 * MegaMekLab - Copyright (C) 2008
 *
 * Original author - jtighe (torren@users.sourceforge.net)
 *
 * 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 program 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.
 */

import java.awt.Graphics2D;
import java.awt.Image;

import java.io.File;

import javax.swing.ImageIcon;

public class Main {
    public static String recordSheetPath = "./data/images/recordsheets/";

    public static void drawDiamond(Graphics2D g2d, int xPos, int yPos) {
        String path = new File(recordSheetPath).getAbsolutePath() + File.separatorChar;
        Image img = new ImageIcon(path + "shielddiamond.png").getImage();
        g2d.drawImage(img, xPos, yPos, 5, 5, null);

    }
}

Related

  1. drawColors(Color[] colors, Graphics g, int x1, int y1, int x2, int y2, int direction)
  2. drawCoordinateAxes(Graphics2D g, Component comp)
  3. drawCross(Graphics2D g2d, int x, int y, int size)
  4. drawCrosshatch(Graphics2D g, Color color, int left, int right, int top, int height, int spacing, int verticalOffset)
  5. drawCube(Graphics g, int x, int y, int w, int h, int d, float fac)
  6. drawDisc(Graphics g)
  7. drawDot(Graphics g, int x, int y)
  8. drawDots(Graphics g, int x0, int y0, int x1, int y1, int interval)
  9. drawDottedDashLine(Graphics2D g, int x1, int y1, int x2, int y2)