|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjgame.ImageUtil
Some handy utilities for loading an manipulating images; used internally by jgame.
Field Summary | |
java.awt.MediaTracker |
mediatracker
|
jgame.ImageUtil.DummyObserver |
observer
|
Constructor Summary | |
ImageUtil(java.awt.Component comp)
|
Method Summary | |
java.awt.image.BufferedImage |
createCompatibleImage(int width,
int height,
int transparency)
Create empty image with given alpha mode that should be efficient on this display |
java.awt.Image |
crop(java.awt.Image img,
int x,
int y,
int width,
int height)
|
void |
ensureLoaded(java.awt.Image img)
|
java.awt.Image |
flip(java.awt.Image img,
boolean horiz,
boolean vert)
|
int[] |
getPixels(java.awt.Image img)
|
int[] |
getPixels(java.awt.Image img,
int x,
int y,
int width,
int height)
|
java.awt.Dimension |
getSize(java.awt.Image img)
|
boolean |
isOpaque(java.awt.Image img,
int alpha_thresh)
true means the image has some transparent pixels below the given alpha threshold, false means image is completely opaque. |
java.awt.Image |
loadImage(java.lang.String imgfile)
Load image from resource path (using getResource). |
java.awt.Image |
loadImage(java.net.URL imgurl)
Returns null if there was an error. |
java.awt.Image |
rotate(java.awt.Image img,
int angle)
for angle, only increments of 90 are allowed |
java.awt.Image |
scale(java.awt.Image img,
int width,
int height)
Returns a smoothly scaled image using getScaledInstance. |
java.awt.Image |
toCompatibleBitmask(java.awt.Image img,
int thresh,
java.awt.Color bg_col,
boolean fast)
Turn a (possibly) translucent or indexed image into a display-compatible bitmask image using the given alpha threshold and render-to-background colour. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.awt.MediaTracker mediatracker
public jgame.ImageUtil.DummyObserver observer
Constructor Detail |
public ImageUtil(java.awt.Component comp)
Method Detail |
public java.awt.Image loadImage(java.lang.String imgfile)
public java.awt.Image loadImage(java.net.URL imgurl)
public java.awt.Dimension getSize(java.awt.Image img)
public boolean isOpaque(java.awt.Image img, int alpha_thresh)
public int[] getPixels(java.awt.Image img)
public int[] getPixels(java.awt.Image img, int x, int y, int width, int height)
public java.awt.Image rotate(java.awt.Image img, int angle)
public java.awt.Image flip(java.awt.Image img, boolean horiz, boolean vert)
public java.awt.Image scale(java.awt.Image img, int width, int height)
public void ensureLoaded(java.awt.Image img) throws java.lang.Exception
java.lang.Exception
public java.awt.Image crop(java.awt.Image img, int x, int y, int width, int height)
public java.awt.Image toCompatibleBitmask(java.awt.Image img, int thresh, java.awt.Color bg_col, boolean fast)
thresh
- alpha threshold between 0 and 255fast
- use fast algorithm (only set bg_col behind transp. pixels)public java.awt.image.BufferedImage createCompatibleImage(int width, int height, int transparency)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |