org.jmonkeyengine.tralala
Class ImageUtilities

java.lang.Object
  extended by org.jmonkeyengine.tralala.ImageUtilities

public class ImageUtilities
extends java.lang.Object


Constructor Summary
ImageUtilities()
           
 
Method Summary
static com.jme3.texture.Texture2D createTexture(java.awt.image.BufferedImage img, java.awt.Graphics2D g)
          this method calls dispose on Graphics2D g
static Pair<java.awt.image.BufferedImage,java.awt.Graphics2D> fillBackground(java.awt.image.BufferedImage originalImage, java.awt.Color color)
          the graphic2d changes, must use the new one for future operations.
static java.awt.image.BufferedImage flip(java.awt.image.BufferedImage image, boolean flipHorizontal, boolean flipVertical)
          the graphic2d changes, must use the new one for future operations.
static int getAlpha(int color)
           
static int getBlue(int color)
           
static java.awt.Color getColor(java.awt.image.BufferedImage image, int x, int y, boolean hasAlpha)
           
static int getGreen(int color)
           
static int getRed(int color)
           
static java.awt.Color[] getVerticalColors(java.awt.image.BufferedImage image, int x, boolean hasAlpha)
           
static void gradientPaint(java.awt.Graphics2D g2d, java.awt.geom.Point2D startPosition, java.awt.Color startColor, java.awt.geom.Point2D endPosition, java.awt.Color endColor, int sx, int sy, int ex, int ey)
           
static java.io.InputStream loadFile(java.lang.String filepath, com.jme3.asset.AssetManager assetManager)
           
static java.awt.image.BufferedImage loadImage(java.lang.String url, com.jme3.asset.AssetManager assetManager)
           
static void main(java.lang.String[] args)
           
static java.awt.image.BufferedImage rotateImage(java.awt.image.BufferedImage image, float angle)
          the graphic2d changes, must use the new one for future operations.
static java.awt.image.BufferedImage symmetrifyX(java.awt.image.BufferedImage image, boolean useFirstHalfImage, boolean flipHorizontial)
           
static java.awt.image.BufferedImage symmetrifyY(java.awt.image.BufferedImage image, boolean useFirstHalfImage, boolean flipVertical)
           
static void test(com.jme3.app.SimpleApplication scene)
          Reads the colors of first column of an image and creates a gradient texture.
static void verticalGradient(java.awt.image.BufferedImage image, java.awt.Graphics2D g2d, java.awt.Color... colors)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageUtilities

public ImageUtilities()
Method Detail

main

public static void main(java.lang.String[] args)

test

public static void test(com.jme3.app.SimpleApplication scene)
Reads the colors of first column of an image and creates a gradient texture.


symmetrifyX

public static java.awt.image.BufferedImage symmetrifyX(java.awt.image.BufferedImage image,
                                                       boolean useFirstHalfImage,
                                                       boolean flipHorizontial)

symmetrifyY

public static java.awt.image.BufferedImage symmetrifyY(java.awt.image.BufferedImage image,
                                                       boolean useFirstHalfImage,
                                                       boolean flipVertical)

flip

public static java.awt.image.BufferedImage flip(java.awt.image.BufferedImage image,
                                                boolean flipHorizontal,
                                                boolean flipVertical)
the graphic2d changes, must use the new one for future operations. use image.createGraphics();


getVerticalColors

public static java.awt.Color[] getVerticalColors(java.awt.image.BufferedImage image,
                                                 int x,
                                                 boolean hasAlpha)

getColor

public static java.awt.Color getColor(java.awt.image.BufferedImage image,
                                      int x,
                                      int y,
                                      boolean hasAlpha)

getRed

public static int getRed(int color)

getGreen

public static int getGreen(int color)

getBlue

public static int getBlue(int color)

getAlpha

public static int getAlpha(int color)

rotateImage

public static java.awt.image.BufferedImage rotateImage(java.awt.image.BufferedImage image,
                                                       float angle)
the graphic2d changes, must use the new one for future operations. use image.createGraphics();


verticalGradient

public static void verticalGradient(java.awt.image.BufferedImage image,
                                    java.awt.Graphics2D g2d,
                                    java.awt.Color... colors)

gradientPaint

public static void gradientPaint(java.awt.Graphics2D g2d,
                                 java.awt.geom.Point2D startPosition,
                                 java.awt.Color startColor,
                                 java.awt.geom.Point2D endPosition,
                                 java.awt.Color endColor,
                                 int sx,
                                 int sy,
                                 int ex,
                                 int ey)

fillBackground

public static Pair<java.awt.image.BufferedImage,java.awt.Graphics2D> fillBackground(java.awt.image.BufferedImage originalImage,
                                                                                    java.awt.Color color)
the graphic2d changes, must use the new one for future operations.


loadFile

public static java.io.InputStream loadFile(java.lang.String filepath,
                                           com.jme3.asset.AssetManager assetManager)

loadImage

public static java.awt.image.BufferedImage loadImage(java.lang.String url,
                                                     com.jme3.asset.AssetManager assetManager)

createTexture

public static com.jme3.texture.Texture2D createTexture(java.awt.image.BufferedImage img,
                                                       java.awt.Graphics2D g)
this method calls dispose on Graphics2D g