|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.freecol.client.gui.ImageLibrary
public final class ImageLibrary
Holds various images that can be called upon by others in order to display certain things.
Field Summary | |
---|---|
static int |
BEACH_STYLES
|
static java.lang.String |
DARKNESS
|
static java.lang.String |
DELETE
|
static java.lang.String |
LOST_CITY_RUMOUR
|
static java.lang.String |
PLOWED
|
static int |
RIVER_STYLES
|
static java.lang.String |
TILE_OWNED_BY_INDIANS
|
static java.lang.String |
TILE_TAKEN
|
static java.lang.String |
UNIT_SELECT
|
Constructor Summary | |
---|---|
ImageLibrary()
The constructor to use. |
|
ImageLibrary(java.lang.String freeColHome)
A constructor that takes a directory as FreeCol's home. |
Method Summary | |
---|---|
java.awt.Image |
getAlarmChip(Tension.Level alarm,
boolean visited)
Returns the alarm chip with the given color. |
java.awt.Image |
getBeachImage(int index)
Returns the beach image at the given index. |
java.awt.Image |
getBonusImage(ResourceType type)
|
java.awt.Image |
getBonusImage(Tile tile)
Returns the bonus-image for the given tile. |
javax.swing.ImageIcon |
getBonusImageIcon(ResourceType type)
Returns the bonus-ImageIcon at the given index. |
java.awt.Image |
getBorderImage(TileType type,
Map.Direction direction,
int x,
int y)
Returns the border terrain-image for the given type. |
java.awt.Image |
getCoastImage(TileType type,
Map.Direction direction,
int x,
int y)
Returns the coast terrain-image for the given type. |
java.awt.Image |
getCoatOfArmsImage(Nation nation)
Returns the coat-of-arms image for the given Nation. |
javax.swing.ImageIcon |
getCoatOfArmsImageIcon(Nation nation)
Returns the coat-of-arms image for the given Nation. |
java.awt.Image |
getColorChip(java.awt.Color color)
Returns the color chip with the given color. |
int |
getCompoundTerrainImageHeight(TileType type)
Returns the height of the terrain-image including overlays and forests for the given terrain type. |
java.awt.Image |
getForestImage(TileType type)
Returns the forest image for a terrain type. |
java.awt.Image |
getFoundingFatherImage(FoundingFather father)
Returns the portrait of this Founding Father. |
java.awt.Image |
getGoodsImage(GoodsType goodsType)
Returns the goods-image at the given index. |
javax.swing.ImageIcon |
getGoodsImageIcon(GoodsType goodsType)
Returns the goods-image for a goods type. |
java.awt.Image |
getMiscImage(java.lang.String id)
Returns the image with the given id. |
javax.swing.ImageIcon |
getMiscImageIcon(java.lang.String id)
Returns the image with the given id. |
java.awt.Image |
getMissionChip(java.awt.Color color,
boolean expertMission)
Returns the mission chip with the given color. |
java.awt.Image |
getMonarchImage(Nation nation)
Returns the monarch-image for the given tile. |
javax.swing.ImageIcon |
getMonarchImageIcon(Nation nation)
Returns the monarch-image icon for the given Nation. |
java.awt.Image |
getOverlayImage(TileType type,
int x,
int y)
Returns the overlay-image for the given type. |
java.awt.Image |
getRiverImage(int index)
Returns the river image at the given index. |
java.awt.Image |
getRiverMouthImage(Map.Direction direction,
int magnitude,
int x,
int y)
Returns the river mouth terrain-image for the direction and magnitude. |
javax.swing.ImageIcon |
getScaledBonusImageIcon(ResourceType type,
float scale)
|
javax.swing.ImageIcon |
getScaledGoodsImageIcon(GoodsType type,
float scale)
Returns the scaled goods-ImageIcon for a goods type. |
javax.swing.ImageIcon |
getScaledImageIcon(java.awt.Image image,
float scale)
Returns the scaled ImageIcon. |
javax.swing.ImageIcon |
getScaledImageIcon(javax.swing.ImageIcon inputIcon,
float scale)
Returns the scaled ImageIcon. |
ImageLibrary |
getScaledImageLibrary(float scalingFactor)
Gets a scaled version of this ImageLibrary . |
java.awt.Image |
getScaledTerrainImage(TileType type,
float scale)
Returns the scaled terrain-image for a terrain type (and position 0, 0). |
float |
getScalingFactor()
Returns the scaling factor used when creating this ImageLibrary. |
java.awt.Image |
getSettlementImage(Settlement.SettlementType settlementType)
Returns the graphics that will represent the given settlement. |
java.awt.Image |
getSettlementImage(Settlement settlement)
Returns the graphics that will represent the given settlement. |
java.awt.Image |
getTerrainImage(TileType type,
int x,
int y)
Returns the terrain-image for the given type. |
int |
getTerrainImageHeight(TileType type)
Returns the height of the terrain-image for a terrain type. |
int |
getTerrainImageWidth(TileType type)
Returns the width of the terrain-image for a terrain type. |
javax.swing.ImageIcon |
getUnitImageIcon(Unit unit)
Returns the ImageIcon that will represent the given unit. |
javax.swing.ImageIcon |
getUnitImageIcon(Unit unit,
boolean grayscale)
Returns the ImageIcon that will represent the given unit. |
javax.swing.ImageIcon |
getUnitImageIcon(UnitType unitType)
Returns the ImageIcon that will represent a unit of the given type. |
javax.swing.ImageIcon |
getUnitImageIcon(UnitType unitType,
boolean grayscale)
Returns the ImageIcon that will represent a unit of the given type. |
javax.swing.ImageIcon |
getUnitImageIcon(UnitType unitType,
Unit.Role role)
Returns the ImageIcon that will represent a unit of the given type and role. |
javax.swing.ImageIcon |
getUnitImageIcon(UnitType unitType,
Unit.Role role,
boolean grayscale)
Returns the ImageIcon that will represent a unit of the given type and role. |
void |
init()
Performs all necessary init operations such as loading of data files. |
javax.swing.ImageIcon |
scaleIcon(javax.swing.ImageIcon icon,
float scale)
|
java.awt.Image |
scaleImage(java.awt.Image image,
float scale)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int RIVER_STYLES
public static final int BEACH_STYLES
public static final java.lang.String UNIT_SELECT
public static final java.lang.String DELETE
public static final java.lang.String PLOWED
public static final java.lang.String TILE_TAKEN
public static final java.lang.String TILE_OWNED_BY_INDIANS
public static final java.lang.String LOST_CITY_RUMOUR
public static final java.lang.String DARKNESS
Constructor Detail |
---|
public ImageLibrary() throws FreeColException
FreeColException
- If one of the data files could not be found.public ImageLibrary(java.lang.String freeColHome) throws FreeColException
freeColHome
- The home of the freecol files.
FreeColException
- If one of the data files could not be found.Method Detail |
---|
public void init() throws FreeColException
FreeColException
- If one of the data files could not be found. *public float getScalingFactor()
getScaledImageLibrary(float)
was used to create
this object.public ImageLibrary getScaledImageLibrary(float scalingFactor) throws FreeColException
ImageLibrary
.
scalingFactor
- The factor used when scaling. 2 is twice
the size of the original images and 0.5 is half.
ImageLibrary
.
FreeColException
public java.awt.Image scaleImage(java.awt.Image image, float scale)
public javax.swing.ImageIcon scaleIcon(javax.swing.ImageIcon icon, float scale)
public java.awt.Image getFoundingFatherImage(FoundingFather father)
father
- a FoundingFather
value
Image
valuepublic java.awt.Image getMonarchImage(Nation nation)
nation
- The nation this monarch rules.
public javax.swing.ImageIcon getMonarchImageIcon(Nation nation)
nation
- The nation this monarch rules.
public javax.swing.ImageIcon getCoatOfArmsImageIcon(Nation nation)
nation
- The nation.
public java.awt.Image getCoatOfArmsImage(Nation nation)
nation
- The nation.
public java.awt.Image getBonusImage(Tile tile)
tile
-
public java.awt.Image getBonusImage(ResourceType type)
public javax.swing.ImageIcon getBonusImageIcon(ResourceType type)
type
- The type of the bonus-ImageIcon to return.public javax.swing.ImageIcon getScaledBonusImageIcon(ResourceType type, float scale)
public java.awt.Image getScaledTerrainImage(TileType type, float scale)
type
- The type of the terrain-image to return.scale
- The scale of the terrain image to return.
public java.awt.Image getOverlayImage(TileType type, int x, int y)
type
- The type of the terrain-image to return.x
- The x-coordinate of the location of the tile that is being
drawn.y
- The x-coordinate of the location of the tile that is being
drawn.
public java.awt.Image getTerrainImage(TileType type, int x, int y)
type
- The type of the terrain-image to return.x
- The x-coordinate of the location of the tile that is being
drawn.y
- The x-coordinate of the location of the tile that is being
drawn.
public java.awt.Image getBorderImage(TileType type, Map.Direction direction, int x, int y)
type
- The type of the terrain-image to return.direction
- a Direction
valuex
- The x-coordinate of the location of the tile that is being
drawn.y
- The x-coordinate of the location of the tile that is being
drawn.
public java.awt.Image getRiverMouthImage(Map.Direction direction, int magnitude, int x, int y)
direction
- a Direction
valuemagnitude
- an int
valuex
- The x-coordinate of the location of the tile that is being
drawn (ignored).y
- The x-coordinate of the location of the tile that is being
drawn (ignored).
public java.awt.Image getCoastImage(TileType type, Map.Direction direction, int x, int y)
type
- The type of the terrain-image to return.direction
- a Direction
valuex
- The x-coordinate of the location of the tile that is being
drawn.y
- The x-coordinate of the location of the tile that is being
drawn.
public java.awt.Image getRiverImage(int index)
index
- The index of the image to return.
public java.awt.Image getBeachImage(int index)
index
- The index of the image to return.
public java.awt.Image getForestImage(TileType type)
type
- The type of the terrain-image to return.
public java.awt.Image getMiscImage(java.lang.String id)
id
- The id of the image to return.
public javax.swing.ImageIcon getMiscImageIcon(java.lang.String id)
id
- The id of the image to return.
public java.awt.Image getGoodsImage(GoodsType goodsType)
goodsType
- The type of the goods-image to return.
public javax.swing.ImageIcon getGoodsImageIcon(GoodsType goodsType)
goodsType
- The type of the goods-image to return.
public javax.swing.ImageIcon getScaledGoodsImageIcon(GoodsType type, float scale)
type
- The type of the goods-ImageIcon to return.scale
- The scale of the goods-ImageIcon to return.
public java.awt.Image getColorChip(java.awt.Color color)
color
- The color of the color chip to return.
public java.awt.Image getMissionChip(java.awt.Color color, boolean expertMission)
color
- The color of the color chip to return.expertMission
- Indicates whether or not the missionary is an
expert.
public java.awt.Image getAlarmChip(Tension.Level alarm, boolean visited)
alarm
- The alarm level.
public int getTerrainImageWidth(TileType type)
type
- The type of the terrain-image.
public int getTerrainImageHeight(TileType type)
type
- The type of the terrain-image.
public int getCompoundTerrainImageHeight(TileType type)
type
- The type of the terrain-image.
public java.awt.Image getSettlementImage(Settlement.SettlementType settlementType)
settlementType
- The type of settlement whose graphics type is needed.
public java.awt.Image getSettlementImage(Settlement settlement)
settlement
- The settlement whose graphics type is needed.
public javax.swing.ImageIcon getUnitImageIcon(Unit unit)
unit
- The unit whose graphics type is needed.
ImageIcon
valuepublic javax.swing.ImageIcon getUnitImageIcon(UnitType unitType)
unitType
- an UnitType
value
ImageIcon
valuepublic javax.swing.ImageIcon getUnitImageIcon(UnitType unitType, Unit.Role role)
unitType
- an UnitType
valuerole
- a Role
value
ImageIcon
valuepublic javax.swing.ImageIcon getUnitImageIcon(Unit unit, boolean grayscale)
unit
- an Unit
valuegrayscale
- a boolean
value
ImageIcon
valuepublic javax.swing.ImageIcon getUnitImageIcon(UnitType unitType, boolean grayscale)
unitType
- an UnitType
valuegrayscale
- a boolean
value
ImageIcon
valuepublic javax.swing.ImageIcon getUnitImageIcon(UnitType unitType, Unit.Role role, boolean grayscale)
unitType
- an UnitType
valuerole
- a Role
valuegrayscale
- a boolean
value
ImageIcon
valuepublic javax.swing.ImageIcon getScaledImageIcon(javax.swing.ImageIcon inputIcon, float scale)
inputIcon
- an ImageIcon
valuescale
- The scale of the ImageIcon to return.
public javax.swing.ImageIcon getScaledImageIcon(java.awt.Image image, float scale)
image
- an Image
valuescale
- The scale of the ImageIcon to return.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |