From 953e0f798242b58a7aa0cc4594c8de4fe9b9998e Mon Sep 17 00:00:00 2001 From: Mark Bernard Date: Sun, 9 Jan 2005 23:59:33 +0000 Subject: [PATCH] iluGetImageInfo now working. --- src/java/org/lwjgl/devil/ILU.java | 16 ++++---- src/java/org/lwjgl/devil/ILinfo.java | 42 +++++++++++--------- src/java/org/lwjgl/devil/ILpointf.java | 8 +++- src/java/org/lwjgl/devil/ILpointi.java | 8 +++- src/java/org/lwjgl/test/devil/BasicTest.java | 41 ++++++++++++++----- 5 files changed, 73 insertions(+), 42 deletions(-) diff --git a/src/java/org/lwjgl/devil/ILU.java b/src/java/org/lwjgl/devil/ILU.java index 7d4d158e..bca57a5d 100644 --- a/src/java/org/lwjgl/devil/ILU.java +++ b/src/java/org/lwjgl/devil/ILU.java @@ -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 + * @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); diff --git a/src/java/org/lwjgl/devil/ILinfo.java b/src/java/org/lwjgl/devil/ILinfo.java index 31563321..986a4ebf 100644 --- a/src/java/org/lwjgl/devil/ILinfo.java +++ b/src/java/org/lwjgl/devil/ILinfo.java @@ -32,25 +32,29 @@ package org.lwjgl.devil; /** - * @author Mark Bernard - * date: 3-Jan-2005 + * $Id$ + * + * ILinfo information holding class. + * + * @author captainjester + * @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 } diff --git a/src/java/org/lwjgl/devil/ILpointf.java b/src/java/org/lwjgl/devil/ILpointf.java index c80f06d7..5a127c92 100644 --- a/src/java/org/lwjgl/devil/ILpointf.java +++ b/src/java/org/lwjgl/devil/ILpointf.java @@ -32,8 +32,12 @@ package org.lwjgl.devil; /** - * @author Mark Bernard - * date: 3-Jan-2005 + * $Id$ + * + * ILpointf information holding class. + * + * @author captainjester + * @version $Revision$ */ public class ILpointf { public float x; diff --git a/src/java/org/lwjgl/devil/ILpointi.java b/src/java/org/lwjgl/devil/ILpointi.java index de6a50d5..3a2e5f32 100644 --- a/src/java/org/lwjgl/devil/ILpointi.java +++ b/src/java/org/lwjgl/devil/ILpointi.java @@ -32,8 +32,12 @@ package org.lwjgl.devil; /** - * @author Mark Bernard - * date: 3-Jan-2005 + * $Id$ + * + * ILpointi information holding class. + * + * @author captainjester + * @version $Revision$ */ public class ILpointi { public int x; diff --git a/src/java/org/lwjgl/test/devil/BasicTest.java b/src/java/org/lwjgl/test/devil/BasicTest.java index 6d569f65..c9cf93ac 100644 --- a/src/java/org/lwjgl/test/devil/BasicTest.java +++ b/src/java/org/lwjgl/test/devil/BasicTest.java @@ -39,7 +39,7 @@ import java.nio.ByteOrder; import java.nio.IntBuffer; /** * $Id$ - *

The core DevIL API.

+ *

The core DevIL and ILU API.

* * @author Mark Bernard * @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