To use the class ‘com.xith3d.io.Archive’, i must
create a ‘com.xith3d.io.Scribable’ -Object.
For that, i also must convert my Texture in a BufferedImage.
Now, many pictures and textures are from type
‘BufferedImage.TYPE_CUSTOM’.
With that stored type under
‘com.xith3d.io.ScribeOutputStream’, the
ScribeInputStream fails, because BufferedImages
can not been created back with that type.
Another problem is the method close() (throws an exception) from class ‘com.xith3d.io.Archive’
after a read. I think there was a closed stream,
before this method can do this.
Also a problem that occurs is , if i convert an BufferedImage to a texture, the complett texture
was flipped from Bottom to Top.
Before i write the datas to the ScribeOutputStream,
i must call
BufferedImage bi=TextureLoader.tf.flipImageVertical(bi);
I think, with converting the datas from a BufferedImage
to a Texture the used ImageComponent2D flips
the image from Bottom to Top.
// Read in from ‘ScribeInputStream in’
int w = in.readInt();
int h = in.readInt();
//Reading in datas, are correct.I have proofed this.
int[] pixels = in.readIntArray();
BufferedImage bImage = new BufferedImage( w, h, BufferedImage.TYPE_INT_ARGB );
bImage.setRGB(0, 0, w, h, pixels, 0, w );
Texture2D tex = (Texture2D)TextureLoader.tf.loadTexture( bImage, “RGB”, false, Texture.NICEST, Texture.NICEST, Texture.WRAP );
//The next can flip the Image from Top to Bottom
tex.setImage(0, new ImageComponent2D(ImageComponent.FORMAT_RGBA, w, h, bImage));
Beside that, it is good component !!