Used correct colorSpace in android Image loaders

experimental
Nehon 11 years ago
parent 7356b727c3
commit 1b7421a153
  1. 1
      jme3-android/src/main/java/com/jme3/renderer/android/TextureUtil.java
  2. 4
      jme3-android/src/main/java/com/jme3/texture/plugins/AndroidImageLoader.java
  3. 3
      jme3-android/src/main/java/com/jme3/texture/plugins/AndroidNativeImageLoader.java

@ -6,7 +6,6 @@ import android.opengl.ETC1Util.ETC1Texture;
import android.opengl.GLES20; import android.opengl.GLES20;
import android.opengl.GLUtils; import android.opengl.GLUtils;
import com.jme3.asset.AndroidImageInfo; import com.jme3.asset.AndroidImageInfo;
import com.jme3.math.FastMath;
import com.jme3.renderer.RendererException; import com.jme3.renderer.RendererException;
import com.jme3.texture.Image; import com.jme3.texture.Image;
import com.jme3.texture.Image.Format; import com.jme3.texture.Image.Format;

@ -5,6 +5,7 @@ import com.jme3.asset.AndroidImageInfo;
import com.jme3.asset.AssetInfo; import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetLoader; import com.jme3.asset.AssetLoader;
import com.jme3.texture.Image; import com.jme3.texture.Image;
import com.jme3.texture.image.ColorSpace;
import java.io.IOException; import java.io.IOException;
public class AndroidImageLoader implements AssetLoader { public class AndroidImageLoader implements AssetLoader {
@ -13,7 +14,8 @@ public class AndroidImageLoader implements AssetLoader {
AndroidImageInfo imageInfo = new AndroidImageInfo(info); AndroidImageInfo imageInfo = new AndroidImageInfo(info);
Bitmap bitmap = imageInfo.getBitmap(); Bitmap bitmap = imageInfo.getBitmap();
Image image = new Image(imageInfo.getFormat(), bitmap.getWidth(), bitmap.getHeight(), null); Image image = new Image(imageInfo.getFormat(), bitmap.getWidth(), bitmap.getHeight(), null, ColorSpace.sRGB);
image.setEfficentData(imageInfo); image.setEfficentData(imageInfo);
return image; return image;
} }

@ -5,6 +5,7 @@ import com.jme3.asset.AssetLoadException;
import com.jme3.asset.AssetLoader; import com.jme3.asset.AssetLoader;
import com.jme3.asset.TextureKey; import com.jme3.asset.TextureKey;
import com.jme3.texture.Image; import com.jme3.texture.Image;
import com.jme3.texture.image.ColorSpace;
import com.jme3.util.BufferUtils; import com.jme3.util.BufferUtils;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
@ -90,7 +91,7 @@ public class AndroidNativeImageLoader implements AssetLoader {
BufferUtils.destroyDirectBuffer(origDataBuffer); BufferUtils.destroyDirectBuffer(origDataBuffer);
BufferUtils.destroyDirectBuffer(headerDataBuffer); BufferUtils.destroyDirectBuffer(headerDataBuffer);
Image img = new Image(getImageFormat(numComponents), width, height, imageDataBuffer); Image img = new Image(getImageFormat(numComponents), width, height, imageDataBuffer, ColorSpace.sRGB);
return img; return img;
} }

Loading…
Cancel
Save