ImagePainter is fantastic and everything but I seem to have a bit of a problem displaying some lines.
Could very well be me not understanding something.
Test case showing the problem:
package com.cis.pipesandstuff.manictubes2.test;
import com.jme3.app.SimpleApplication;
import com.jme3.math.ColorRGBA;
import com.jme3.texture.Image;
import com.jme3.texture.image.ColorSpace;
import com.jme3.util.BufferUtils;
import com.zero_separation.plugins.imagepainter.ImagePainter;
/**
*
* @author jo
*/
public class TestImagePainter extends SimpleApplication {
public static void main(String[] args) {
TestImagePainter app = new TestImagePainter();
app.start();
}
@Override
public void simpleInitApp() {
Image image = new Image(Image.Format.BGR8, 642, 692, BufferUtils.createByteBuffer(642 * 4 * 692), null, ColorSpace.Linear);
ImagePainter imagePainter = new ImagePainter(image);
imagePainter.paintLine(
561, 211,
461, 69,
1, ColorRGBA.Blue, ImagePainter.BlendMode.SET);
}
}
Exception:
java.lang.IllegalArgumentException: x and y must be inside the image dimensions
at com.jme3.texture.image.DefaultImageRaster.rangeCheck(DefaultImageRaster.java:54)
at com.jme3.texture.image.DefaultImageRaster.setPixel(DefaultImageRaster.java:116)
at com.zero_separation.plugins.imagepainter.ImagePainter.paintPixel(ImagePainter.java:528)
at com.zero_separation.plugins.imagepainter.ImagePainter.paintLine(ImagePainter.java:451)
at com.cis.pipesandstuff.manictubes2.test.TestImagePainter.simpleInitApp(TestImagePainter.java:32)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:227)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:131)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:212)
at java.lang.Thread.run(Thread.java:745)
To me, x and y are inside the image dimensions? A’m I wrong?
Edit: works fine most of the time… I use it to create a top view image of my track to help me create it, and it works fine with other tracks (values).