agile2d.opengl
Class ImageUtils

java.lang.Object
  |
  +--agile2d.opengl.ImageUtils

public class ImageUtils
extends Object

Performs operations on Java AWT BufferedImage data.

In particular, provides methods to convert from Java component ordering (A,R,G,B) to OpenGL component ordering (R, G, B, A) - necessary because for some unknowable reason Java and OpenGL's large set of component orderings manage to not overlap!


Constructor Summary
ImageUtils()
           
 
Method Summary
static int ARGBtoRGBA(int srcPix)
           
static void convertAndFlipARGBtoRGBA(int[] srcPixels, int imageWidth, int imageHeight, int width, int height)
          Converts a Java ARGB Image into a GL RGBA Image.
static void convertARGBtoRGBA(int[] srcPixels, int srcScanSize, int sx1, int sy1, int width, int height, int[] dstPixels, int dstScanSize)
          Converts a Java ARGB Image into a GL RGBA Image.
static int nextPowerOf2(int size)
          Returns the power of 2 immediately larger or equal to the specified size
static int RGBAtoARGB(int srcPix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageUtils

public ImageUtils()
Method Detail

nextPowerOf2

public static int nextPowerOf2(int size)
Returns the power of 2 immediately larger or equal to the specified size

Parameters:
size - the size
Returns:
the power of 2 immediately larger or equal to the specified size

ARGBtoRGBA

public static int ARGBtoRGBA(int srcPix)

RGBAtoARGB

public static int RGBAtoARGB(int srcPix)

convertARGBtoRGBA

public static void convertARGBtoRGBA(int[] srcPixels,
                                     int srcScanSize,
                                     int sx1,
                                     int sy1,
                                     int width,
                                     int height,
                                     int[] dstPixels,
                                     int dstScanSize)
Converts a Java ARGB Image into a GL RGBA Image. Takes the source data from srcPixels and stores the result in dstPixels. (They can point to the same pixel array to perform the conversion inline).


convertAndFlipARGBtoRGBA

public static void convertAndFlipARGBtoRGBA(int[] srcPixels,
                                            int imageWidth,
                                            int imageHeight,
                                            int width,
                                            int height)
Converts a Java ARGB Image into a GL RGBA Image. In addition, this flips the Y orientation of the image.



Copyright © 2002 by University of Maryland, USA All rights reserved.