iluGetImageInfo now working.
This commit is contained in:
parent
af70a0ef76
commit
953e0f7982
|
@ -37,8 +37,12 @@ import org.lwjgl.BufferChecks;
|
|||
import org.lwjgl.LWJGLException;
|
||||
|
||||
/**
|
||||
* @author Mark Bernard
|
||||
* date: 3-Jan-2005
|
||||
* $Id$
|
||||
*
|
||||
* The DevIL ILU API.
|
||||
*
|
||||
* @author captainjester <captainjester@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class ILU {
|
||||
/** Have we been created? */
|
||||
|
@ -111,9 +115,7 @@ public class ILU {
|
|||
public static native boolean iluFlipImage();
|
||||
public static native boolean iluGammaCorrect(float gamma);
|
||||
public static native int iluGenImage();
|
||||
// TODO result placed in a pointer
|
||||
// TODO implement
|
||||
// public static native void iluGetImageInfo(ILinfo info[]);
|
||||
public static native void iluGetImageInfo(ILinfo info);
|
||||
public static native int iluGetInteger(int mode);
|
||||
public static void iluGetIntegerv(int mode, IntBuffer param) {
|
||||
BufferChecks.checkDirect(param);
|
||||
|
@ -130,11 +132,9 @@ public class ILU {
|
|||
public static native boolean iluNoisify(float tolerance);
|
||||
public static native boolean iluPixelize(int pixSize);
|
||||
// TODO result placed in a pointer
|
||||
// TODO implement
|
||||
// public static native void iluRegionfv(ILpointf points[], int n);
|
||||
// TODO result placed in a pointer
|
||||
// TODO implement
|
||||
// public static native void iluRegioniv(ILpointi points[], int n);
|
||||
// public static native void iluRegioniv(ILpointi points[], int n);
|
||||
public static native boolean iluReplaceColour(byte red, byte green, byte blue, float tolerance);
|
||||
public static native boolean iluRotate(float angle);
|
||||
|
||||
|
|
|
@ -32,25 +32,29 @@
|
|||
package org.lwjgl.devil;
|
||||
|
||||
/**
|
||||
* @author Mark Bernard
|
||||
* date: 3-Jan-2005
|
||||
* $Id$
|
||||
*
|
||||
* ILinfo information holding class.
|
||||
*
|
||||
* @author captainjester <captainjester@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class ILinfo {
|
||||
public int Id; // the image's id
|
||||
public byte Data[]; // the image's data
|
||||
public int Width; // the image's width
|
||||
public int Height; // the image's height
|
||||
public int Depth; // the image's depth
|
||||
public byte Bpp; // bytes per pixel (not bits) of the image
|
||||
public int SizeOfData; // the total size of the data (in bytes)
|
||||
public int Format; // image format (in IL enum style)
|
||||
public int Type; // image type (in IL enum style)
|
||||
public int Origin; // origin of the image
|
||||
public byte Palette[]; // the image's palette
|
||||
public int PalType; // palette type
|
||||
public int PalSize; // palette size
|
||||
public int CubeFlags; // flags for what cube map sides are present
|
||||
public int NumNext; // number of images following
|
||||
public int NumMips; // number of mipmaps
|
||||
public int NumLayers; // number of layers
|
||||
public int id; // the image's id
|
||||
public byte data[]; // the image's data
|
||||
public int width; // the image's width
|
||||
public int height; // the image's height
|
||||
public int depth; // the image's depth
|
||||
public byte bpp; // bytes per pixel (not bits) of the image
|
||||
public int sizeOfData; // the total size of the data (in bytes)
|
||||
public int format; // image format (in IL enum style)
|
||||
public int type; // image type (in IL enum style)
|
||||
public int origin; // origin of the image
|
||||
public byte palette[]; // the image's palette
|
||||
public int palType; // palette type
|
||||
public int palSize; // palette size
|
||||
public int cubeFlags; // flags for what cube map sides are present
|
||||
public int numNext; // number of images following
|
||||
public int numMips; // number of mipmaps
|
||||
public int numLayers; // number of layers
|
||||
}
|
||||
|
|
|
@ -32,8 +32,12 @@
|
|||
package org.lwjgl.devil;
|
||||
|
||||
/**
|
||||
* @author Mark Bernard
|
||||
* date: 3-Jan-2005
|
||||
* $Id$
|
||||
*
|
||||
* ILpointf information holding class.
|
||||
*
|
||||
* @author captainjester <captainjester@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class ILpointf {
|
||||
public float x;
|
||||
|
|
|
@ -32,8 +32,12 @@
|
|||
package org.lwjgl.devil;
|
||||
|
||||
/**
|
||||
* @author Mark Bernard
|
||||
* date: 3-Jan-2005
|
||||
* $Id$
|
||||
*
|
||||
* ILpointi information holding class.
|
||||
*
|
||||
* @author captainjester <captainjester@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class ILpointi {
|
||||
public int x;
|
||||
|
|
|
@ -39,7 +39,7 @@ import java.nio.ByteOrder;
|
|||
import java.nio.IntBuffer;
|
||||
/**
|
||||
* $Id$
|
||||
* <p>The core DevIL API.</p>
|
||||
* <p>The core DevIL and ILU API.</p>
|
||||
*
|
||||
* @author Mark Bernard <captainjester@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
|
@ -54,8 +54,7 @@ public class BasicTest {
|
|||
e.printStackTrace();
|
||||
System.exit(0);
|
||||
}
|
||||
String err = ILU.iluErrorString(IL.ilGetError());
|
||||
System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR);
|
||||
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
|
||||
System.out.println("ilGenImages");
|
||||
IntBuffer im = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||
IL.ilGenImages(1, im);
|
||||
|
@ -63,21 +62,18 @@ public class BasicTest {
|
|||
IL.ilBindImage(im.get(0));
|
||||
IL.ilEnable(IL.IL_ORIGIN_SET);
|
||||
IL.ilOriginFunc(IL.IL_ORIGIN_UPPER_LEFT);
|
||||
err = ILU.iluErrorString(IL.ilGetError());
|
||||
System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR);
|
||||
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
|
||||
String imageFile = "F:/Apps/Java/eclipse/workspace/LWJGL/res/ILtest.tga";
|
||||
URL imageURL = BasicTest.class.getResource("/res/ILtest.tga");
|
||||
System.out.println("ilLoadFromURL " + imageURL);
|
||||
System.out.println("load lump = " + IL.ilLoadFromURL(imageURL));
|
||||
err = ILU.iluErrorString(IL.ilGetError());
|
||||
System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR);
|
||||
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
|
||||
int newIm = IL.ilCloneCurImage();
|
||||
IL.ilCopyImage(im.get(0));
|
||||
IL.ilBindImage(newIm);
|
||||
ByteBuffer buf = IL.ilGetData();
|
||||
System.out.println("ilGetData");
|
||||
err = ILU.iluErrorString(IL.ilGetError());
|
||||
System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR);
|
||||
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
|
||||
int limit = buf.limit();
|
||||
System.out.println("limit = " + limit);
|
||||
for(int i=0;i<buf.limit();i+=3) {
|
||||
|
@ -86,7 +82,30 @@ public class BasicTest {
|
|||
|
||||
System.out.println("current image = " + im.get(0) + " IL.ilGetInteger(IL.IL_ACTIVE_IMAGE) = " + IL.ilGetInteger(IL.IL_ACTIVE_IMAGE));
|
||||
System.out.println("Version: " + IL.ilGetInteger(IL.IL_VERSION_NUM));
|
||||
err = ILU.iluErrorString(IL.ilGetError());
|
||||
System.out.println("err = " + err + " IL_NO_ERROR = " + IL.IL_NO_ERROR);
|
||||
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
|
||||
|
||||
ILinfo info = new ILinfo();
|
||||
ILU.iluGetImageInfo(info);
|
||||
System.out.println("info.id = " + info.id);
|
||||
System.out.println("info.width = " + info.width);
|
||||
System.out.println("info.height = " + info.height);
|
||||
System.out.println("info.depth = " + info.depth);
|
||||
System.out.println("info.bpp = " + info.bpp);
|
||||
System.out.println("info.sizeOfData = " + info.sizeOfData);
|
||||
System.out.println("info.format = " + info.format);
|
||||
System.out.println("info.type = " + info.type);
|
||||
System.out.println("info.origin = " + info.origin);
|
||||
System.out.println("info.palType = " + info.palType);
|
||||
System.out.println("info.palSize = " + info.palSize);
|
||||
System.out.println("info.numNext = " + info.numNext);
|
||||
System.out.println("info.numMips = " + info.numMips);
|
||||
System.out.println("info.numLayers = " + info.numLayers);
|
||||
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
|
||||
|
||||
// ILpointf pointf[] = new ILpointf[3];
|
||||
// ILU.iluRegionfv(pointf, pointf.length);
|
||||
// for(int i=0;i<pointf.length;i++) {
|
||||
// System.out.println("point[" + i + "] x = " + pointf[i].x + " y = " + pointf[i].y);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue