Class GraphicsHelper
java.lang.Object
GraphicsHelper
public class GraphicsHelper
- extends Object
|
Method Summary |
(package private) static Image |
arrayToImage(int[] data,
String type)
|
static Image |
createImage(String filename)
Hilfsmethode zum sicheren Erzeugen eines Image aus einem Dateinamen. |
static ImageIcon |
createImageIcon(String filename)
Hilfsmethode zum sicheren Erzeugen eines ImageIcon aus einem Dateinamen. |
(package private) static void |
drawScaledSpriteFromFrame(Image spritesheet,
Graphics2D g2d,
int x1goal,
int y1goal,
int x2goal,
int y2goal,
int x1source,
int y1source,
int x2source,
int y2source)
//If you just want to draw the sprites, Java's Graphics class has a drawImage method
//that will pull a specific area of the image out for you. |
static Image |
getImageFromSpritesheet(String filename,
int x,
int y,
int width,
int height)
|
static Image |
getImageFromSpritesheet(String filename,
String sheetname,
String spritename)
|
(package private) static int[] |
imageToArray(Image image)
|
static ImageIcon |
imageToImageIcon(Image image)
|
static Image |
resizeImage(Image image,
int x,
int y)
|
static ImageIcon |
resizeImageIcon(ImageIcon icon,
int x,
int y)
|
(package private) static Image |
rotateImage(Image image,
int degrees)
|
(package private) static void |
setPixel(Image image,
int pixelNumber,
int newData)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
imageIcons
static HashMap<String,ImageIcon> imageIcons
images
static HashMap<String,Image> images
GraphicsHelper
public GraphicsHelper()
arrayToImage
static Image arrayToImage(int[] data,
String type)
createImage
public static Image createImage(String filename)
- Hilfsmethode zum sicheren Erzeugen eines Image aus einem Dateinamen.
createImageIcon
public static ImageIcon createImageIcon(String filename)
- Hilfsmethode zum sicheren Erzeugen eines ImageIcon aus einem Dateinamen.
drawScaledSpriteFromFrame
static void drawScaledSpriteFromFrame(Image spritesheet,
Graphics2D g2d,
int x1goal,
int y1goal,
int x2goal,
int y2goal,
int x1source,
int y1source,
int x2source,
int y2source)
- //If you just want to draw the sprites, Java's Graphics class has a drawImage method
//that will pull a specific area of the image out for you. You just have to specify the source image,
//where you want to draw the sprite on your Graphics object (x, y, width, height), and in what frame
//of the image the sprite is located (x, y, width, height).
//http://docs.oracle.com/javase/1.5.0/docs/api/java/awt/Graphics.html#drawImage%28java.awt.Image,%20int,%20int,%20int,%20int,%20int,%20int,%20int,%20int,%20java.awt.image.ImageObserver%29
getImageFromSpritesheet
public static Image getImageFromSpritesheet(String filename,
int x,
int y,
int width,
int height)
getImageFromSpritesheet
public static Image getImageFromSpritesheet(String filename,
String sheetname,
String spritename)
imageToArray
static int[] imageToArray(Image image)
imageToImageIcon
public static ImageIcon imageToImageIcon(Image image)
resizeImage
public static Image resizeImage(Image image,
int x,
int y)
resizeImageIcon
public static ImageIcon resizeImageIcon(ImageIcon icon,
int x,
int y)
rotateImage
static Image rotateImage(Image image,
int degrees)
setPixel
static void setPixel(Image image,
int pixelNumber,
int newData)