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