B4J Question GifDecoder library for B4J

max123

Well-Known Member
Licensed User
Longtime User
Hi All,

I've tried to convert Andrew Graham GifDecoder library (B4A) for use with B4J on desktop devices, so I made some changes and instead of using some Android classes I've used some JavaFX classes, example:

  • javafx.embed.swing.SwingFXUtils
  • javafx.scene.image.Image
  • javafx.scene.image.PixelFormat
  • javafx.scene.image.PixelReader
  • javafx.scene.shape.Rectangle
  • java.awt.image.BufferedImage
  • javax.imageio.ImageIO

Library compile without errors after several modifications made to fit from Android to JavaFX but when I use it with B4J I've some errors that I can not solve, first of all I can't read the .gif file in AssetDir directory with the command Load(File.DirAssets, "myFile.gif"), I saw that for Android Andrew use this:

B4X:
is = BA.applicationContext.getAssets().open(gifname.toLowerCase(BA.cul));

I have tried the next but will not work, the log of B4J tells me -> java.io. FileNotFoundException: AssetsDir\slider.gif (the system cannot find the path specified):

B4X:
is = new BufferedInputStream(new FileInputStream(new File(anywheresoftware.b4a.objects.streams.File.getDirAssets(), gifname.toLowerCase(BA.cul))));

I tried then to put my gif file in the Objects folder of my project, and from B4J point the file with File.DirApp, this way the file is read (not all) but after I get an error -> java. lang. ArrayIndexOutOfBoundsException.

In the past I have created simple libraries but I'm not expert with Java, could someone help me to make this great library working with B4J?

I have attached the Eclipse project and a simple B4J project that just try to load one gif file.

Hello and thank you in advance for community help. ;)
 

Attachments

  • jGifDecoder.zip
    53.1 KB · Views: 275
Last edited:

max123

Well-Known Member
Licensed User
Longtime User
There are no people interested to animated gifs on desktop devices? Please help me! :(
 
Upvote 0
Top