Package megamek.client.ui.tileset
Class EntityImage
java.lang.Object
megamek.client.ui.tileset.EntityImage
- Direct Known Subclasses:
FighterSquadronIcon
Handles the rotated and damaged and preview images for a unit.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEntityImage(Image base, Image wreck, Camouflage camouflage, Component comp, Entity entity, int secondaryPos) EntityImage(Image base, Image wreck, Camouflage camouflage, Component comp, Entity entity, int secondaryPos, boolean preview, boolean withShadows) EntityImage(Image base, Image wreck, Camouflage camouflage, Entity entity, int secondaryPos, boolean preview, boolean withShadows) EntityImage(Image base, Camouflage camouflage, Component comp, Entity entity) -
Method Summary
Modifier and TypeMethodDescriptionprotected ImageapplyColor(Image image, int facing) Applies the unit individual or player camouflage to the icon.protected ImageapplyDropShadow(Image image) static intcalculateDamageLevel(Entity entity) Worker function that calculates the entity's damage level for the purposes of displaying damage to avoid particularly dumb-looking situationsstatic EntityImagecreateIcon(Image base, Image wreck, Camouflage camouflage, Entity entity, int secondaryPos) static EntityImagecreateIcon(Image base, Image wreck, Camouflage camouflage, Entity entity, int secondaryPos, boolean preview, boolean withShadows) static EntityImagecreateIcon(Image base, Camouflage camouflage, Entity entity) static EntityImagecreateIcon(Image base, Camouflage camouflage, Entity entity, boolean withShadows) static EntityImagecreateLobbyIcon(Image base, Camouflage camouflage, Entity entity) getBase()intgetFacing(int facing) getIcon()getWreckFacing(int facing) booleanvoidCreates images applying damage decals, rotating and scaling.loadPreviewImage(boolean showDamage) protected BufferedImagerotateImage(Image img, int dir) Rotates a given unit image into direction dir.voidsetCamouflage(Camouflage camouflage)
-
Field Details
-
base
The base (unit) image used for this icon. -
icon
A smaller icon used for the unit overview. -
facings
-
-
Constructor Details
-
EntityImage
-
EntityImage
public EntityImage(Image base, Image wreck, Camouflage camouflage, Component comp, Entity entity, int secondaryPos) -
EntityImage
public EntityImage(Image base, Image wreck, Camouflage camouflage, Entity entity, int secondaryPos, boolean preview, boolean withShadows) -
EntityImage
public EntityImage(Image base, Image wreck, Camouflage camouflage, Component comp, Entity entity, int secondaryPos, boolean preview, boolean withShadows)
-
-
Method Details
-
createIcon
-
createIcon
public static EntityImage createIcon(Image base, Camouflage camouflage, Entity entity, boolean withShadows) -
createLobbyIcon
-
createIcon
public static EntityImage createIcon(Image base, Image wreck, Camouflage camouflage, Entity entity, int secondaryPos) -
createIcon
public static EntityImage createIcon(Image base, Image wreck, Camouflage camouflage, Entity entity, int secondaryPos, boolean preview, boolean withShadows) -
calculateDamageLevel
Worker function that calculates the entity's damage level for the purposes of displaying damage to avoid particularly dumb-looking situations -
getCamouflage
-
setCamouflage
-
getDmgLvl
public int getDmgLvl() -
isAssetImage
public boolean isAssetImage()- Returns:
- whether this processed image was created for a Battlefield Support Asset.
-
loadFacings
public void loadFacings()Creates images applying damage decals, rotating and scaling. -
rotateImage
Rotates a given unit image into direction dir. -
getFacing
-
getWreckFacing
-
getBase
-
getTilesetBase
- Returns:
- The unmodified tileset image this icon was created from. Stable across
loadFacings(), unlikegetBase(), and therefore usable as a cache identity.
-
getIcon
-
loadPreviewImage
-
applyColor
Applies the unit individual or player camouflage to the icon. -
applyDropShadow
-