| java.lang.Object com.javujavu.javux.wings.WingImage
WingImage | public class WingImage (Code) | | This class extends functionality of java.awt.Image .
WingImage contains java.awt.Image object as
source image and following parameters describing how the image is rendered.
- source rectangle - describing used area of source image,
- optional stretch insets - describing stretch margin,
- optional tile mode - telling if the image is stretched or tiled,
- optional alpha - making the image transparent as a whole
This is one of the core WingS classes required by all the components
This class is thread safe.
|
Constructor Summary | |
public | WingImage(WingImage image, int part, int width, int height) | public | WingImage(WingImage image) | public | WingImage(WingImage image, int x, int y, int width, int height) | public | WingImage(Image image) | public | WingImage(Image image, int x, int y, int width, int height) |
Method Summary | |
public boolean | drawImage(Graphics g, int x, int y, ImageObserver o) Draws the image.
Parameters: g - destination graphics Parameters: x - the x coordinate. Parameters: y - the y coordinate. Parameters: o - object to be notified as more of the image is available. | public boolean | drawImage(Graphics g, int x, int y, int w, int h, ImageObserver o) Draws the image scaling if necessary
using its stretch margin and tile mode.
Parameters: g - destination graphics Parameters: x - the x coordinate. Parameters: y - the y coordinate. Parameters: w - the width of the rectangle. Parameters: h - the height of the rectangle. Parameters: o - object to be notified as more of the image is available. | public boolean | drawSmoothImage(Graphics g, int x, int y, int w, int h, ImageObserver o) | public int | getAlpha() | public int | getHeight() | public Image | getImage() | public Rectangle | getSourceRect() | public Insets | getStretch() | public int | getTile() | public int | getWidth() | public static Image | loadImage(String filePath) | public static Image | loadImage(URL location) | public static Image | loadImage(String file, Class ref) | public static Image | loadImage(byte[] data) | public static Image | loadImage(Image img) | public void | setAlpha(int alpha) | public void | setStretch(Insets stretch) | public void | setTile(int tile) |
NO_TILE | final public static int NO_TILE(Code) | | no tile, the image is stretched along X and Y axis
|
TILE_E | final public static int TILE_E(Code) | | the image is stretched along Y axis and tiled along X axis starting from the east border
|
TILE_N | final public static int TILE_N(Code) | | the image is stretched along X axis and tiled along Y axis starting from the north border
|
TILE_NE | final public static int TILE_NE(Code) | | the image is tiled along X and Y axis starting from the northeast corner
|
TILE_NW | final public static int TILE_NW(Code) | | the image is tiled along X and Y axis starting from the northwest corner
|
TILE_S | final public static int TILE_S(Code) | | the image is stretched along X axis and tiled along Y axis starting from the south border
|
TILE_SE | final public static int TILE_SE(Code) | | the image is tiled along X and Y axis starting from the southeast corner
|
TILE_SW | final public static int TILE_SW(Code) | | the image is tiled along X and Y axis starting from the south-west corner
|
TILE_W | final public static int TILE_W(Code) | | the image is stretched along Y axis and tiled along X axis starting from the west border
|
alpha | protected int alpha(Code) | | |
WingImage | public WingImage(WingImage image, int part, int width, int height)(Code) | | Creates a new WingImage
calculating source rectangle in the following way:
area of the source image is threat as a grid with the specified
cell size, the source rectangle is an area covering specified
cell of the grid counting from the top left corner
All other properties are derived from the source image
Parameters: image - source image Parameters: part - grid cell number Parameters: width - grid cell width Parameters: height - grid cell height |
WingImage | public WingImage(WingImage image)(Code) | | Creates a new WingImage using the whole area of the source image
All other properties are derived from the source image
Parameters: image - source image |
WingImage | public WingImage(WingImage image, int x, int y, int width, int height)(Code) | | Creates a new WingImage using specified area of the source image
All other properties are derived from the source image
Parameters: image - source image Parameters: x - x coordinate Parameters: y - y coordinate Parameters: width - width Parameters: height - height |
WingImage | public WingImage(Image image)(Code) | | Creates a new WingImage using the whole area of the source image
Parameters: image - source image |
WingImage | public WingImage(Image image, int x, int y, int width, int height)(Code) | | Creates a new WingImage using specified area of the source image
Parameters: image - source image Parameters: x - x coordinate Parameters: y - y coordinate Parameters: width - width Parameters: height - height |
drawImage | public boolean drawImage(Graphics g, int x, int y, ImageObserver o)(Code) | | Draws the image.
Parameters: g - destination graphics Parameters: x - the x coordinate. Parameters: y - the y coordinate. Parameters: o - object to be notified as more of the image is available. false if the image pixels are still changing;true otherwise. |
drawImage | public boolean drawImage(Graphics g, int x, int y, int w, int h, ImageObserver o)(Code) | | Draws the image scaling if necessary
using its stretch margin and tile mode.
Parameters: g - destination graphics Parameters: x - the x coordinate. Parameters: y - the y coordinate. Parameters: w - the width of the rectangle. Parameters: h - the height of the rectangle. Parameters: o - object to be notified as more of the image is available. false if the image pixels are still changing;true otherwise. |
getAlpha | public int getAlpha()(Code) | | Returns value of the alpha property
alpha value |
getHeight | public int getHeight()(Code) | | Returns height of the source rectangle
height of the source rectangle |
getImage | public Image getImage()(Code) | | Returns source image
source image |
getSourceRect | public Rectangle getSourceRect()(Code) | | Returns the source rectangle
used source rectangle |
getStretch | public Insets getStretch()(Code) | | Returns the stretch margin
the stretch margin |
getTile | public int getTile()(Code) | | Returns the tile mode
the tile mode |
getWidth | public int getWidth()(Code) | | Returns width of the source rectangle
width of the source rectangle |
loadImage | public static Image loadImage(byte[] data)(Code) | | |
setAlpha | public void setAlpha(int alpha)(Code) | | Sets the alpha property
Parameters: alpha - a new alpha value in the range 0-255 |
setStretch | public void setStretch(Insets stretch)(Code) | | Sets the stretch margin
Parameters: stretch - new stretch margin |
setTile | public void setTile(int tile)(Code) | | Sets the tile mode
Parameters: tile - new tile mode |
|
|