Search in sources :

Example 66 with java.awt.image

use of java.awt.image in project megameklab by MegaMek.

the class ImageHelper method getRecordSheet.

public static Image getRecordSheet(Entity unit, boolean advanced) {
    Image recordSheet = null;
    String path = new File(recordSheetPath).getAbsolutePath() + File.separatorChar;
    if (unit instanceof BipedMech) {
        if (advanced) {
            recordSheet = new ImageIcon(path + "tobiped.png").getImage();
        } else {
            recordSheet = new ImageIcon(path + "twbiped.png").getImage();
        }
    } else if (unit instanceof QuadMech) {
        if (advanced) {
            recordSheet = new ImageIcon(path + "toquad.png").getImage();
        } else {
            recordSheet = new ImageIcon(path + "twquad.png").getImage();
        }
    } else if (unit instanceof VTOL) {
        recordSheet = new ImageIcon(path + "twvee-vtol.png").getImage();
    } else if ((unit instanceof LargeSupportTank) || ((unit instanceof Tank) && ((Tank) unit).isSuperHeavy())) {
        if (unit.getOInternal(LargeSupportTank.LOC_TURRET) > 0) {
            recordSheet = new ImageIcon(path + "twvee-lgsupground-turret.png").getImage();
        } else {
            recordSheet = new ImageIcon(path + "twvee-lgsupground.png").getImage();
        }
    } else if (unit instanceof Tank) {
        if ((unit.getMovementMode() == EntityMovementMode.NAVAL) || (unit.getMovementMode() == EntityMovementMode.SUBMARINE) || (unit.getMovementMode() == EntityMovementMode.HYDROFOIL)) {
            if (unit.getOInternal(((Tank) unit).getLocTurret()) > 0) {
                recordSheet = new ImageIcon(path + "twnaval-turret.png").getImage();
            } else {
                recordSheet = new ImageIcon(path + "twnaval.png").getImage();
            }
        } else if (advanced) {
            String imageName = "twvee-" + unit.getMovementModeAsString().toLowerCase().trim() + "-dualturret.png";
            recordSheet = new ImageIcon(path + imageName).getImage();
        } else {
            String imageName = "twvee-" + unit.getMovementModeAsString().toLowerCase().trim() + ".png";
            recordSheet = new ImageIcon(path + imageName).getImage();
        }
    } else if (unit instanceof Aero) {
        if (unit instanceof Dropship) {
            if (unit.getMovementMode() == EntityMovementMode.AERODYNE) {
                recordSheet = new ImageIcon(path + "twaerodyneds.png").getImage();
            } else {
                recordSheet = new ImageIcon(path + "twspheroidds.png").getImage();
            }
        } else if (unit instanceof ConvFighter) {
            recordSheet = new ImageIcon(path + "twconventionalfighter.png").getImage();
        } else if (unit instanceof SmallCraft) {
            if (unit.getMovementMode() == EntityMovementMode.AERODYNE) {
                recordSheet = new ImageIcon(path + "twaero-smallcraft.png").getImage();
            } else {
                recordSheet = new ImageIcon(path + "twspheroid-smallcraft.png").getImage();
            }
        } else {
            recordSheet = new ImageIcon(path + "twaero.png").getImage();
        }
    } else if (unit instanceof BattleArmor) {
        recordSheet = new ImageIcon(path + "twba.png").getImage();
    } else if (unit instanceof Protomech) {
        recordSheet = new ImageIcon(path + "twproto.png").getImage();
    }
    return recordSheet;
}
Also used : QuadMech(megamek.common.QuadMech) ImageIcon(javax.swing.ImageIcon) LargeSupportTank(megamek.common.LargeSupportTank) Dropship(megamek.common.Dropship) ConvFighter(megamek.common.ConvFighter) Image(java.awt.Image) LargeSupportTank(megamek.common.LargeSupportTank) Tank(megamek.common.Tank) SmallCraft(megamek.common.SmallCraft) VTOL(megamek.common.VTOL) Protomech(megamek.common.Protomech) BipedMech(megamek.common.BipedMech) File(java.io.File) Aero(megamek.common.Aero) BattleArmor(megamek.common.BattleArmor)

Example 67 with java.awt.image

use of java.awt.image in project megameklab by MegaMek.

the class ImageHelper method getRightShieldImage.

public static Image getRightShieldImage() {
    String path = new File(recordSheetPath).getAbsolutePath() + File.separatorChar;
    Image image = new ImageIcon(path + "twbiped-shield-right.png").getImage();
    return image;
}
Also used : ImageIcon(javax.swing.ImageIcon) Image(java.awt.Image) File(java.io.File)

Example 68 with java.awt.image

use of java.awt.image in project megameklab by MegaMek.

the class ImageHelper method getShieldImage.

public static Image getShieldImage() {
    String path = new File(recordSheetPath).getAbsolutePath() + File.separatorChar;
    Image image = new ImageIcon(path + "twbiped-shields.png").getImage();
    return image;
}
Also used : ImageIcon(javax.swing.ImageIcon) Image(java.awt.Image) File(java.io.File)

Example 69 with java.awt.image

use of java.awt.image in project megameklab by MegaMek.

the class ImageHelper method getLeftShieldImage.

public static Image getLeftShieldImage() {
    String path = new File(recordSheetPath).getAbsolutePath() + File.separatorChar;
    Image image = new ImageIcon(path + "twbiped-shield-left.png").getImage();
    return image;
}
Also used : ImageIcon(javax.swing.ImageIcon) Image(java.awt.Image) File(java.io.File)

Example 70 with java.awt.image

use of java.awt.image in project megameklab by MegaMek.

the class ImageHelper method getFluffPNG.

public static Image getFluffPNG(Entity unit, String path) {
    Image fluff = null;
    String fluffFile = path + unit.getChassis() + " " + unit.getModel() + ".png";
    if (new File(fluffFile.toLowerCase()).exists()) {
        fluff = new ImageIcon(fluffFile).getImage();
    }
    if (fluff == null) {
        fluffFile = path + unit.getModel() + ".png";
        if (new File(fluffFile.toLowerCase()).exists()) {
            fluff = new ImageIcon(fluffFile).getImage();
        }
    }
    if (fluff == null) {
        fluffFile = path + unit.getChassis() + ".png";
        if (new File(fluffFile.toLowerCase()).exists()) {
            fluff = new ImageIcon(fluffFile).getImage();
        }
    }
    return fluff;
}
Also used : ImageIcon(javax.swing.ImageIcon) Image(java.awt.Image) File(java.io.File)

Aggregations

Image (java.awt.Image)515 BufferedImage (java.awt.image.BufferedImage)263 ImageIcon (javax.swing.ImageIcon)127 Graphics2D (java.awt.Graphics2D)97 IOException (java.io.IOException)73 File (java.io.File)64 Point (java.awt.Point)53 URL (java.net.URL)51 Graphics (java.awt.Graphics)46 JLabel (javax.swing.JLabel)31 Dimension (java.awt.Dimension)28 Rectangle (java.awt.Rectangle)27 AffineTransform (java.awt.geom.AffineTransform)25 Color (java.awt.Color)24 Test (org.junit.Test)24 RenderedImage (java.awt.image.RenderedImage)21 ArrayList (java.util.ArrayList)21 Toolkit (java.awt.Toolkit)20 IIOImage (javax.imageio.IIOImage)18 MediaTracker (java.awt.MediaTracker)17